AdminController.java 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. //package nju.seec.helper.controller;
  2. //
  3. //import nju.seec.helper.aspect.auth.Auth;
  4. //import nju.seec.helper.aspect.auth.LoginUser;
  5. //import nju.seec.helper.controller.response.PageResponse;
  6. //import nju.seec.helper.dto.common.LoginDTO;
  7. //import nju.seec.helper.enums.UserState;
  8. //import nju.seec.helper.enums.UserRole;
  9. //import nju.seec.helper.service.AdminService;
  10. //import nju.seec.helper.util.Consts;
  11. //import nju.seec.helper.vo.AdminVO;
  12. //import nju.seec.helper.vo.UserVO;
  13. //import org.springframework.data.domain.Pageable;
  14. //import org.springframework.data.web.PageableDefault;
  15. //import org.springframework.validation.annotation.Validated;
  16. //import org.springframework.web.bind.annotation.*;
  17. //
  18. //import javax.servlet.http.HttpSession;
  19. //
  20. ///**
  21. // * 管理员
  22. // *
  23. // * @author cst
  24. // */
  25. //@RestController
  26. //@RequestMapping("/api/admin")
  27. //public class AdminController {
  28. // private final AdminService adminService;
  29. //
  30. // public AdminController(AdminService adminService) {
  31. // this.adminService = adminService;
  32. // }
  33. //
  34. // /**
  35. // * 管理员登录
  36. // */
  37. // @PostMapping("/login")
  38. // public AdminVO login(@Validated @RequestBody LoginDTO loginDTO, HttpSession session) {
  39. // AdminVO adminVO = adminService.getAdminByUsernameAndPassword(loginDTO.getUsername(), loginDTO.getPassword());
  40. //
  41. // LoginUser user = new LoginUser()
  42. // .setId(adminVO.getId())
  43. // .setRole(UserRole.ADMIN);
  44. //
  45. // session.setAttribute(Consts.SESSION_USER_NAME, user);
  46. // // 30分钟有效期
  47. // session.setMaxInactiveInterval(30 * 60);
  48. // return adminVO;
  49. // }
  50. //
  51. // /**
  52. // * 获取注册教师列表
  53. // */
  54. // @Auth(roles = UserRole.ADMIN, message = "获取注册教师列表")
  55. // @GetMapping("/user")
  56. // public PageResponse<UserVO> getUsers(LoginUser admin, UserRole role, UserState state,
  57. // @RequestParam(required = false, defaultValue = "") String key,
  58. // @PageableDefault(size = Integer.MAX_VALUE) Pageable pageable) {
  59. // return PageResponse.of(adminService.getUsers(role, state, key, pageable));
  60. // }
  61. //
  62. // /**
  63. // * 审核通过用户
  64. // */
  65. // @Auth(roles = UserRole.ADMIN, message = "审核通过用户")
  66. // @PutMapping("/user/{userId}/pass")
  67. // public void passUser(LoginUser admin, @PathVariable Long userId) {
  68. // adminService.passUser(admin, userId);
  69. // }
  70. //
  71. // /**
  72. // * 封禁用户
  73. // */
  74. // @Auth(roles = UserRole.ADMIN, message = "封禁用户")
  75. // @PutMapping("/user/{userId}/lock")
  76. // public void lockUser(LoginUser admin, @PathVariable Long userId) {
  77. // adminService.lockUser(admin, userId);
  78. // }
  79. //
  80. // /**
  81. // * 解封用户
  82. // */
  83. // @Auth(roles = UserRole.ADMIN, message = "解封用户")
  84. // @PutMapping("/user/{userId}/unlock")
  85. // public void unlockUser(LoginUser admin, @PathVariable Long userId) {
  86. // adminService.unlockUser(admin, userId);
  87. // }
  88. //}