package com.gz.controller.system; import com.alibaba.fastjson.JSON; import com.github.pagehelper.PageInfo; import com.gz.core.annotation.TraceLog; import com.gz.dto.system.AdminDTO; import com.gz.rvo.system.AdminRVO; import com.gz.service.system.AdminService; import com.gz.vo.system.AdminVO; import org.apache.commons.lang.StringUtils; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * @author LiuchangLan * @date 2020/9/4 14:41 */ @RestController @RequestMapping("system/admin") public class AdminController { @Resource private AdminService adminService; @PostMapping("addOrUpdate") @TraceLog(module = "管理员管理",business = "新增管理员") public Integer addOrUpdate(@RequestBody AdminDTO adminDTO){ if(StringUtils.isNotBlank(adminDTO.getId())){ return adminService.update(adminDTO); }else{ return adminService.insert(adminDTO); } } // @PostMapping("insert") // @TraceLog(module = "管理员管理",business = "新增管理员") // public Integer insert(@RequestBody AdminDTO adminDTO){ // return adminService.insert(adminDTO); // } @DeleteMapping("delete") @TraceLog(module = "管理员管理",business = "删除管理员") public Integer delete(String id){ return adminService.delete(id); } // @PostMapping("update") // @TraceLog(module = "管理员管理",business = "修改管理员") // public Integer update(@RequestBody AdminDTO adminDTO){ // return adminService.update(adminDTO); // } @GetMapping("select") @TraceLog(module = "管理员管理",business = "查询管理员列表") public PageInfo select(AdminVO adminVO){ return adminService.select(adminVO); } @GetMapping("selectByPrimaryKey") @TraceLog(module = "管理员管理",business = "查询管理员详细信息") public AdminDTO selectByPrimaryKey(String id){ return adminService.selectByPrimaryKey(id); } @GetMapping("updateStatus") @TraceLog(module = "管理员管理",business = "修改管理员状态") Integer updateStatus(String id){ return adminService.updateStatus(id); } @PostMapping("resetPassword") @TraceLog(module = "管理员管理",business = "重置管理员密码") Integer resetPassword(@RequestBody String id){ return adminService.resetPassword(id); } @GetMapping("selectAll") List selectAll(){ return adminService.selectAll(); } @GetMapping("selectByPrimaryKeyDept") AdminRVO selectByPrimaryKeyDept(String id){ return adminService.selectByPrimaryKeyDept(id); } @PostMapping("synchronize") Map synchronize(@RequestBody String s){ Map mapTypes = JSON.parseObject(s); return adminService.synchronize(mapTypes); } }