✨ Introducing new features. #1631 【讨论帖】重构目前整体架构核心,不调用认证中心 ,资源服务器自行校验 token   <=>

23d705cfbb
This commit is contained in:
小七 committed 2020-11-29 16:10:16 +08:00
1 parent c03076e711
commit 317fb80c01
1 file changed
+15
@@ -28,6 +28,7 @@ import com.pig4cloud.pigx.admin.service.SysUserService;
import com.pig4cloud.pigx.common.core.util.R;
import com.pig4cloud.pigx.common.log.annotation.SysLog;
import com.pig4cloud.pigx.common.security.annotation.Inner;
import com.pig4cloud.pigx.common.security.util.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@@ -63,6 +64,20 @@ public class SysUserController {
return R.ok(userService.findUserInfo(user));
}
/**
* 获取当前用户全部信息
* @return 用户信息
*/
@GetMapping(value = { "/info" })
public R info() {
String username = SecurityUtils.getUser().getUsername();
SysUser user = userService.getOne(Wrappers.<SysUser>query().lambda().eq(SysUser::getUsername, username));
if (user == null) {
return R.failed(null, "获取当前用户信息失败");
}
return R.ok(userService.findUserInfo(user));
}
/**
* 通过ID查询用户信息
* @param id ID