package cn.wisenergy.web.admin.controller.app;

import cn.wisenergy.common.utils.exception.CustomException;
import cn.wisenergy.common.utils.exception.RESP_CODE_ENUM;
import cn.wisenergy.common.utils.exception.Result;
import cn.wisenergy.model.app.WorkUser;
import cn.wisenergy.service.WorkUserService;
import cn.wisenergy.web.admin.controller.common.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @Authotr:陈奇
 * @QQ1799796883
 */
@RestController
@Api(tags = "用户模块")
@Slf4j
public class WorkUserController extends BaseController {
    @Autowired
    private WorkUserService workUserService;

    @ApiOperation(value = "根据id获取用户信息", notes = "根据id获取用户信息", httpMethod = "GET")
    @ApiImplicitParam(name = "id", value = "用户id", dataType = "int", required = true)
    @GetMapping(value = "/getUserInfo")
    public Result<WorkUser> getUserInfo(Integer id) {
        log.info("UserController[]getUserInfo[]input.param.id" + id);
        if (null == id) {
            throw new CustomException(RESP_CODE_ENUM.INPUT_PARAM_IS_NULL);
        }
        WorkUser workUser = workUserService.getById(id);
        return getResult(workUser);
    }

}
