| | |
| | | public R<Void> add(@Validated @RequestBody SysDeptBo dept) { |
| | | if (!deptService.checkDeptNameUnique(dept)) { |
| | | return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } else if (StringUtils.isNotBlank(dept.getDeptCategory()) && !deptService.checkDeptCategoryUnique(dept)) { |
| | | return R.fail("新增部门'" + dept.getDeptName() + "'失败,部门类别编码已存在"); |
| | | } |
| | | return toAjax(deptService.insertDept(dept)); |
| | | } |
| | |
| | | deptService.checkDeptDataScope(deptId); |
| | | if (!deptService.checkDeptNameUnique(dept)) { |
| | | return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在"); |
| | | } else if (StringUtils.isNotBlank(dept.getDeptCategory()) && !deptService.checkDeptCategoryUnique(dept)) { |
| | | return R.fail("修改部门'" + dept.getDeptName() + "'失败,部门类别编码已存在"); |
| | | } else if (dept.getParentId().equals(deptId)) { |
| | | return R.fail("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己"); |
| | | } else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())) { |
| | |
| | | @SaCheckPermission("system:dept:query") |
| | | @GetMapping("/optionselect") |
| | | public R<List<SysDeptVo>> optionselect(@RequestParam(required = false) Long[] deptIds) { |
| | | return R.ok(deptService.selectDeptByIds(List.of(deptIds))); |
| | | return R.ok(deptService.selectDeptByIds(deptIds == null ? null : List.of(deptIds))); |
| | | } |
| | | |
| | | } |