AdminController.java 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. package com.gz.controller.system;
  2. import com.alibaba.fastjson.JSON;
  3. import com.github.pagehelper.PageInfo;
  4. import com.gz.core.annotation.TraceLog;
  5. import com.gz.dto.system.AdminDTO;
  6. import com.gz.rvo.system.AdminRVO;
  7. import com.gz.service.system.AdminService;
  8. import com.gz.vo.system.AdminVO;
  9. import org.apache.commons.lang.StringUtils;
  10. import org.springframework.web.bind.annotation.*;
  11. import javax.annotation.Resource;
  12. import java.util.List;
  13. import java.util.Map;
  14. /**
  15. * @author LiuchangLan
  16. * @date 2020/9/4 14:41
  17. */
  18. @RestController
  19. @RequestMapping("system/admin")
  20. public class AdminController {
  21. @Resource
  22. private AdminService adminService;
  23. @PostMapping("addOrUpdate")
  24. @TraceLog(module = "管理员管理",business = "新增管理员")
  25. public Integer addOrUpdate(@RequestBody AdminDTO adminDTO){
  26. if(StringUtils.isNotBlank(adminDTO.getId())){
  27. return adminService.update(adminDTO);
  28. }else{
  29. return adminService.insert(adminDTO);
  30. }
  31. }
  32. // @PostMapping("insert")
  33. // @TraceLog(module = "管理员管理",business = "新增管理员")
  34. // public Integer insert(@RequestBody AdminDTO adminDTO){
  35. // return adminService.insert(adminDTO);
  36. // }
  37. @DeleteMapping("delete")
  38. @TraceLog(module = "管理员管理",business = "删除管理员")
  39. public Integer delete(String id){
  40. return adminService.delete(id);
  41. }
  42. // @PostMapping("update")
  43. // @TraceLog(module = "管理员管理",business = "修改管理员")
  44. // public Integer update(@RequestBody AdminDTO adminDTO){
  45. // return adminService.update(adminDTO);
  46. // }
  47. @GetMapping("select")
  48. @TraceLog(module = "管理员管理",business = "查询管理员列表")
  49. public PageInfo<AdminDTO> select(AdminVO adminVO){
  50. return adminService.select(adminVO);
  51. }
  52. @GetMapping("selectByPrimaryKey")
  53. @TraceLog(module = "管理员管理",business = "查询管理员详细信息")
  54. public AdminDTO selectByPrimaryKey(String id){
  55. return adminService.selectByPrimaryKey(id);
  56. }
  57. @GetMapping("updateStatus")
  58. @TraceLog(module = "管理员管理",business = "修改管理员状态")
  59. Integer updateStatus(String id){
  60. return adminService.updateStatus(id);
  61. }
  62. @PostMapping("resetPassword")
  63. @TraceLog(module = "管理员管理",business = "重置管理员密码")
  64. Integer resetPassword(@RequestBody String id){
  65. return adminService.resetPassword(id);
  66. }
  67. @GetMapping("selectAll")
  68. List<AdminDTO> selectAll(){
  69. return adminService.selectAll();
  70. }
  71. @GetMapping("selectByPrimaryKeyDept")
  72. AdminRVO selectByPrimaryKeyDept(String id){
  73. return adminService.selectByPrimaryKeyDept(id);
  74. }
  75. @PostMapping("synchronize")
  76. Map<String,Object> synchronize(@RequestBody String s){
  77. Map mapTypes = JSON.parseObject(s);
  78. return adminService.synchronize(mapTypes);
  79. }
  80. }