UserController.java 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. package com.dataeasy.server.service.controller;
  2. import com.dataeasy.server.pojo.user.LoginRequest;
  3. import com.dataeasy.server.pojo.user.NicknameRequest;
  4. import com.dataeasy.server.pojo.user.UserInfoVO;
  5. import com.dataeasy.server.service.manager.IUserManager;
  6. import me.chanjar.weixin.common.error.WxErrorException;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.validation.annotation.Validated;
  9. import org.springframework.web.bind.annotation.GetMapping;
  10. import org.springframework.web.bind.annotation.PostMapping;
  11. import org.springframework.web.bind.annotation.RequestBody;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13. import org.springframework.web.bind.annotation.RestController;
  14. /**
  15. * @author tyuio
  16. * @version 1.0.0
  17. * @description 用户 controller
  18. * @date 2024/12/13 15:09
  19. */
  20. @RestController
  21. @RequestMapping("/user")
  22. public class UserController {
  23. @Autowired
  24. private IUserManager userManager;
  25. /**
  26. * 用户登录
  27. * @param request
  28. * @return 访问凭据
  29. */
  30. @PostMapping("/login")
  31. public String login(@RequestBody @Validated LoginRequest request) throws WxErrorException {
  32. return userManager.login(request);
  33. }
  34. /**
  35. * 查询当前用户信息
  36. * @return
  37. */
  38. @GetMapping("/queryUserInfo")
  39. public UserInfoVO queryUserInfo() {
  40. return userManager.queryUserInfo();
  41. }
  42. /**
  43. * 修改昵称
  44. */
  45. @PostMapping("/modifyNickname")
  46. public void modifyNickname(@RequestBody @Validated NicknameRequest request) {
  47. userManager.modifyNickname(request);
  48. }
  49. }