UserController.java 1017 B

12345678910111213141516171819202122232425262728293031
  1. package com.seecoder.dataanalysis.web.controller;
  2. import com.seecoder.dataanalysis.aspect.auth.Authorized;
  3. import com.seecoder.dataanalysis.data.entity.eval.User;
  4. import com.seecoder.dataanalysis.logic.user.UserService;
  5. import com.seecoder.dataanalysis.web.Response;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.GetMapping;
  8. import org.springframework.web.bind.annotation.PathVariable;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RestController;
  11. /**
  12. * @author mars
  13. */
  14. @RestController
  15. @RequestMapping(path = "/api/user")
  16. public class UserController {
  17. private final UserService userService;
  18. @Autowired
  19. public UserController(UserService userService) {
  20. this.userService = userService;
  21. }
  22. @GetMapping("")
  23. @Authorized()
  24. public Response getCurrentUser(User user) {
  25. return Response.buildSuccess(userService.getUserById(user.getUserId()));
  26. }
  27. }