|
@@ -1,6 +1,7 @@
|
|
|
package com.example.controller.user;
|
|
|
|
|
|
import com.example.constant.JwtClaimsConstant;
|
|
|
+import com.example.context.BaseContext;
|
|
|
import com.example.dto.PasswordDTO;
|
|
|
import com.example.dto.UserDTO;
|
|
|
import com.example.dto.UserLoginDTO;
|
|
@@ -9,7 +10,9 @@ import com.example.properties.JwtProperties;
|
|
|
import com.example.result.Result;
|
|
|
import com.example.service.UserService;
|
|
|
import com.example.utils.JwtUtil;
|
|
|
+import com.example.vo.TeacherVO;
|
|
|
import com.example.vo.UserLoginVO;
|
|
|
+import com.example.vo.UserVO;
|
|
|
import io.jsonwebtoken.Claims;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
@@ -102,4 +105,12 @@ public class UserController {
|
|
|
Long id = Long.valueOf(claims.get(JwtClaimsConstant.USER_ID).toString());
|
|
|
return Result.success(userService.getRole(id));
|
|
|
}
|
|
|
+ @GetMapping("/me")
|
|
|
+ @ApiOperation(value = "根据token查询当前用户信息")
|
|
|
+ public Result<UserVO> getById(){
|
|
|
+ Long id = BaseContext.getCurrentId();
|
|
|
+ log.info("查询用户详情:{}",id);
|
|
|
+ UserVO userVO=userService.getById(id);
|
|
|
+ return Result.success(userVO);
|
|
|
+ }
|
|
|
}
|