package com.mosty.base.controller;

import com.mosty.base.service.UserInfoService;
import com.mosty.common.base.domain.ResponseResult;
import com.mosty.common.core.business.entity.SysUser;
import com.mosty.common.token.JwtSysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dw
 * @since 2022/8/8
 * 部门数据处理相关
 **/
@Api(tags = "用户信息相关接口")
@RestController
@AllArgsConstructor
@RequestMapping("/userFeign")
public class UserInfoController {

    private final UserInfoService userDeptService;

    @ApiOperation("根据用户Id获取用户详情信息")
    @JwtSysUser
    @GetMapping("getUserInfo/{userId}")
    public ResponseResult<SysUser> getUserInfo(@PathVariable("userId") String userId) {
        return ResponseResult.success(this.userDeptService.getUserInfo(userId));
    }

    @ApiOperation("根据用户Id获取用户详情信息")
    @JwtSysUser
    @GetMapping("getUserInfoBySfzh/{sfzh}")
    public ResponseResult<SysUser> getUserInfoBySfzh(@PathVariable("sfzh") String sfzh) {
        return ResponseResult.success(this.userDeptService.getUserInfoBySfzh(sfzh));
    }

    @ApiOperation("根据用户Id获取用户详情信息")
    @JwtSysUser
    @GetMapping("getUserOrFjInfoBySfzh/{sfzh}")
    public ResponseResult<SysUser> getUserOrFjInfoBySfzh(@PathVariable("sfzh") String sfzh) {
        return ResponseResult.success(this.userDeptService.getUserOrFjInfoBySfzh(sfzh));
    }


}
