package com.sptg.estate.biz.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.sptg.common.core.beans.PageBean;
import com.sptg.estate.api.dto.BaseUser;
import com.sptg.estate.api.dto.UserInfoDto;
import com.sptg.estate.api.feigns.BaseUserFeign;
import com.sptg.estate.biz.service.BaseUserServiceInterface;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * title: BaseUserController
 * package: com.sptg.estate.biz.controller
 * description:
 *
 *
 *
 */
@RestController
public class BaseUserController implements BaseUserFeign {

    private final BaseUserServiceInterface baseUserServiceInterface;

    @Autowired
    public BaseUserController(BaseUserServiceInterface baseUserServiceInterface) {
        this.baseUserServiceInterface = baseUserServiceInterface;
    }

    /* -------------------------------------------------------------------------------------------------------------- */

    @Override
    @GetMapping(value = "/visitor/getUserById/{userId}")
    public BaseUser getUserById(@PathVariable(value = "userId") String userId) {
        return this.baseUserServiceInterface.selectUserById(userId);
    }

    @Override
    @PostMapping(value = "/visitor/pagingQueryServerUser")
    public Page<UserInfoDto> pagingQueryServerUser(@RequestBody PageBean<UserInfoDto, String> pageBean) {
        return this.baseUserServiceInterface.pagingQueryServerUser(pageBean);
    }

    @Override
    @PostMapping(value = "/visitor/pagingQueryServerUserEnable")
    public Page<UserInfoDto> pagingQueryServerUserEnable(@RequestBody PageBean<UserInfoDto, String> pageBean) {
        return this.baseUserServiceInterface.pagingQueryServerUserEnable(pageBean);
    }
    @Override
    @PostMapping(value = "/visitor/pagingQueryUser")
    public Page<UserInfoDto> pagingQueryUser(@RequestBody PageBean<UserInfoDto, String> pageBean) {
        return this.baseUserServiceInterface.pagingQueryUser(pageBean);
    }
    @Override
    @PostMapping(value = "/visitor/pagingQueryUserEnable")
    public Page<UserInfoDto> pagingQueryUserEnable(@RequestBody PageBean<UserInfoDto, String> pageBean) {
        return this.baseUserServiceInterface.pagingQueryUserEnable(pageBean);
    }
}
