UserController.java 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. package com.fdkankan.jp.xspace.controller;
  2. import com.fdkankan.jp.xspace.common.Result;
  3. import com.fdkankan.jp.xspace.dto.LoginDTO;
  4. import com.fdkankan.jp.xspace.service.IUserRoleService;
  5. import com.fdkankan.jp.xspace.service.IUserService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.PostMapping;
  8. import org.springframework.web.bind.annotation.RequestBody;
  9. import org.springframework.web.bind.annotation.RequestMapping;
  10. import org.springframework.web.bind.annotation.RestController;
  11. /**
  12. * <p>
  13. * 用户信息表 前端控制器
  14. * </p>
  15. *
  16. * @author
  17. * @since 2022-12-23
  18. */
  19. @RestController
  20. @RequestMapping("/user")
  21. public class UserController extends BaseController {
  22. @Autowired
  23. IUserService userService;
  24. @Autowired
  25. IUserRoleService userRoleService;
  26. /**
  27. * 登录
  28. * phoneNum 用户名
  29. * password 密码
  30. */
  31. @PostMapping("/login")
  32. public Result login(@RequestBody LoginDTO param){
  33. return Result.success(userService.login(param));
  34. }
  35. @PostMapping("/logout")
  36. public Result logout() {
  37. userService.logout(getToken());
  38. return Result.success();
  39. }
  40. // /**
  41. // * 获取用户信息
  42. // */
  43. // @RequestMapping(value = "/getUserInfo", method = RequestMethod.POST)
  44. // public Result getUserInfo() {
  45. // String username = JwtUtil.getUsername(getToken());
  46. // return Result.success(userService.getUserInfo(username));
  47. // }
  48. //
  49. // /**
  50. // * 查询用户列表
  51. // */
  52. // @PostMapping("/list")
  53. // public Result list(@RequestBody UserListParam param){
  54. // return Result.success(userService.pageList(param,getUser()));
  55. // }
  56. //
  57. // @PostMapping("/updatePassword")
  58. // public Result updatePassword(@RequestBody UserParam param){
  59. // userService.updatePassword(param);
  60. // return Result.success();
  61. // }
  62. //
  63. //
  64. // @PostMapping("/allUserList")
  65. // public Result allUserList(@RequestBody User param){
  66. //
  67. // List<User> retrunList = new ArrayList<>();
  68. // List<User> list = userService.allList(param);
  69. // List<Long> userIds = list.stream().map(User::getId).collect(Collectors.toList());
  70. // HashMap<Long ,Long> roleUserMap = userRoleService.getByUserList(userIds);
  71. // for (User user : list) {
  72. // Long roleId = roleUserMap.get(user.getId());
  73. // if(roleId != null && roleId!= 8){
  74. // retrunList.add(user);
  75. // }
  76. // }
  77. //
  78. // return Result.success(retrunList);
  79. // }
  80. }