| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- //package nju.seec.helper.controller;
- //
- //import nju.seec.helper.aspect.auth.Auth;
- //import nju.seec.helper.aspect.auth.LoginUser;
- //import nju.seec.helper.controller.response.PageResponse;
- //import nju.seec.helper.dto.common.LoginDTO;
- //import nju.seec.helper.enums.UserState;
- //import nju.seec.helper.enums.UserRole;
- //import nju.seec.helper.service.AdminService;
- //import nju.seec.helper.util.Consts;
- //import nju.seec.helper.vo.AdminVO;
- //import nju.seec.helper.vo.UserVO;
- //import org.springframework.data.domain.Pageable;
- //import org.springframework.data.web.PageableDefault;
- //import org.springframework.validation.annotation.Validated;
- //import org.springframework.web.bind.annotation.*;
- //
- //import javax.servlet.http.HttpSession;
- //
- ///**
- // * 管理员
- // *
- // * @author cst
- // */
- //@RestController
- //@RequestMapping("/api/admin")
- //public class AdminController {
- // private final AdminService adminService;
- //
- // public AdminController(AdminService adminService) {
- // this.adminService = adminService;
- // }
- //
- // /**
- // * 管理员登录
- // */
- // @PostMapping("/login")
- // public AdminVO login(@Validated @RequestBody LoginDTO loginDTO, HttpSession session) {
- // AdminVO adminVO = adminService.getAdminByUsernameAndPassword(loginDTO.getUsername(), loginDTO.getPassword());
- //
- // LoginUser user = new LoginUser()
- // .setId(adminVO.getId())
- // .setRole(UserRole.ADMIN);
- //
- // session.setAttribute(Consts.SESSION_USER_NAME, user);
- // // 30分钟有效期
- // session.setMaxInactiveInterval(30 * 60);
- // return adminVO;
- // }
- //
- // /**
- // * 获取注册教师列表
- // */
- // @Auth(roles = UserRole.ADMIN, message = "获取注册教师列表")
- // @GetMapping("/user")
- // public PageResponse<UserVO> getUsers(LoginUser admin, UserRole role, UserState state,
- // @RequestParam(required = false, defaultValue = "") String key,
- // @PageableDefault(size = Integer.MAX_VALUE) Pageable pageable) {
- // return PageResponse.of(adminService.getUsers(role, state, key, pageable));
- // }
- //
- // /**
- // * 审核通过用户
- // */
- // @Auth(roles = UserRole.ADMIN, message = "审核通过用户")
- // @PutMapping("/user/{userId}/pass")
- // public void passUser(LoginUser admin, @PathVariable Long userId) {
- // adminService.passUser(admin, userId);
- // }
- //
- // /**
- // * 封禁用户
- // */
- // @Auth(roles = UserRole.ADMIN, message = "封禁用户")
- // @PutMapping("/user/{userId}/lock")
- // public void lockUser(LoginUser admin, @PathVariable Long userId) {
- // adminService.lockUser(admin, userId);
- // }
- //
- // /**
- // * 解封用户
- // */
- // @Auth(roles = UserRole.ADMIN, message = "解封用户")
- // @PutMapping("/user/{userId}/unlock")
- // public void unlockUser(LoginUser admin, @PathVariable Long userId) {
- // adminService.unlockUser(admin, userId);
- // }
- //}
|