xiangpei
2025-05-14 47cd9ecc0eff38ffe6b3b794b2bf197e958f4403
src/main/java/com/mindskip/xzs/controller/admin/DepartmentController.java
@@ -1,6 +1,5 @@
package com.mindskip.xzs.controller.admin;
import com.github.pagehelper.PageInfo;
import com.mindskip.xzs.base.BaseApiController;
import com.mindskip.xzs.base.RestResponse;
import com.mindskip.xzs.domain.Department;
@@ -68,8 +67,8 @@
    }
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public RestResponse add(@RequestBody @Valid String  name) {
        return RestResponse.ok(departmentService.add(name));
    public RestResponse add(@RequestBody @Valid Department  model) {
        return RestResponse.ok(departmentService.add(model));
    }
    @RequestMapping(value = "/update", method = RequestMethod.POST)
@@ -79,7 +78,7 @@
    @RequestMapping(value = "/get/{id}", method = RequestMethod.POST)
    public RestResponse update(@PathVariable Integer id) {
        return RestResponse.ok(departmentService.getById(id));
        return RestResponse.ok(departmentService.getByIdVO(id));
    }
    @RequestMapping(value = "/getUserByDepartment/{id}", method = RequestMethod.POST)
@@ -147,7 +146,7 @@
    @RequestMapping(value = "/getDeptAdmins", method = RequestMethod.GET)
    public RestResponse<List<Department>> getDeptAdmins(){
        return RestResponse.ok(userService.getDeptAdmins(isDeptAdmin() ? getCurrentUser().getId() : null));
        return RestResponse.ok(userService.getDeptAdmins(isDeptAdmin() ? getAdminDeptIds() : null));
    }
    @GetMapping("/cascader")
@@ -155,4 +154,9 @@
        return RestResponse.ok(departmentService.cascader());
    }
    @GetMapping("/getCurrentDeptId")
    public RestResponse<List<Integer>> getCurrentDeptIds(){
        return RestResponse.ok(getAdminDeptIds());
    }
}