| | |
| | | * |
| | | * @author expert |
| | | */ |
| | | @Api(tags = "部门-业务处室") |
| | | @Api(tags = "部门管理") |
| | | @RestController |
| | | @RequestMapping("/system/dept") |
| | | public class SysDeptController |
| | |
| | | * 查询部门列表(排除节点) |
| | | */ |
| | | //@PreAuthorize("hasAnyAuthority('system:dept:list')") |
| | | @GetMapping("/list/exclude/{deptId}") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(paramType = "query", name = "deptId", dataType = "Long", required = true, value = "部门id"), |
| | | }) |
| | | @ApiOperation(value = "查询部门列表(排除节点)") |
| | | public CommonResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | { |
| | | List<SysDept> depts = deptService.getOutDeptList(new SysDept()); |
| | | depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | return CommonResult.success(depts); |
| | | } |
| | | // @GetMapping("/list/exclude/{deptId}") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(paramType = "query", name = "deptId", dataType = "Long", required = true, value = "部门id"), |
| | | // }) |
| | | // @ApiOperation(value = "查询部门列表(排除节点)") |
| | | // public CommonResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) |
| | | // { |
| | | // List<SysDept> depts = deptService.getOutDeptList(new SysDept()); |
| | | // depts.removeIf(d -> d.getDeptId().intValue() == deptId || ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")); |
| | | // return CommonResult.success(depts); |
| | | // } |
| | | |
| | | /** |
| | | * 根据部门编号获取详细信息 |
| | |
| | | */ |
| | | //@PreAuthorize("hasAnyAuthority('system:dept:remove')") |
| | | @DeleteMapping("/{deptId}") |
| | | @ApiOperation(value = "删除部门门业务处室") |
| | | @ApiOperation(value = "删除部门") |
| | | public CommonResult remove(@PathVariable Long deptId) |
| | | { |
| | | if (deptService.hasChildByDeptId(deptId)) |
| | | { |
| | | return CommonResult.failed("存在下级部门,不允许删除"); |
| | | } |
| | | if (deptService.checkDeptExistUser(deptId)) |
| | | { |
| | | return CommonResult.failed("部门存在用户,不允许删除"); |
| | | } |
| | | // if (deptService.checkDeptExistUser(deptId)) |
| | | // { |
| | | // return CommonResult.failed("部门存在用户,不允许删除"); |
| | | // } |
| | | //todo 校验专家是否申请复用 |
| | | deptService.checkDeptDataScope(deptId); |
| | | // deptService.checkDeptDataScope(deptId); |
| | | return CommonResult.success(deptService.deleteDeptById(deptId)); |
| | | } |
| | | } |