package com.panzhihua.applets.api;
|
|
import com.panzhihua.common.service.user.UserService;
|
import com.panzhihua.common.controller.BaseController;
|
import com.panzhihua.common.exceptions.UnAuthenticationException;
|
import com.panzhihua.common.model.vos.LoginUserInfoVO;
|
import com.panzhihua.common.model.vos.R;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.util.ObjectUtils;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
|
/**
|
* @program: springcloud_k8s_panzhihuazhihuishequ
|
* @description: 用户
|
* @author: huang.hongfa weixin hhf9596 qq 959656820
|
* @create: 2020-11-24 12:03
|
**/
|
@RestController
|
@RequestMapping("/user/")
|
@Api(tags = {"用户模块"})
|
public class UserApi extends BaseController {
|
@Resource
|
private UserService userService;
|
|
@ApiOperation(value = "当前登录用户信息",response = LoginUserInfoVO.class)
|
@GetMapping("info")
|
public R getUserInfo(){
|
Integer userId = this.getUserId();
|
boolean empty = ObjectUtils.isEmpty(userId);
|
if (empty) {
|
throw new UnAuthenticationException();
|
}
|
R<LoginUserInfoVO> r = userService.getUserInfoByUserId(userId + "");
|
return r;
|
}
|
}
|