|
@@ -132,13 +132,20 @@ public class SysDeptController extends BaseController
|
|
{
|
|
{
|
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
|
return error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
|
}
|
|
}
|
|
|
|
+ if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptCodeUnique(dept)))
|
|
|
|
+ {
|
|
|
|
+ return error("新增部门'" + dept.getDeptName() + "'失败,部门编码已存在");
|
|
|
|
+ }
|
|
dept.setCreateBy(getUsername());
|
|
dept.setCreateBy(getUsername());
|
|
return toAjax(deptService.insertDept(dept));
|
|
return toAjax(deptService.insertDept(dept));
|
|
}else {
|
|
}else {
|
|
deptService.checkDeptDataScope(deptId);
|
|
deptService.checkDeptDataScope(deptId);
|
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
|
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
|
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
|
return error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
|
- } else if (dept.getParentId().equals(deptId)) {
|
|
|
|
|
|
+ }else if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptCodeUnique(dept))) {
|
|
|
|
+ return error("修改部门'" + dept.getDeptName() + "'失败,部门编码已存在");
|
|
|
|
+ }
|
|
|
|
+ else if (dept.getParentId().equals(deptId)) {
|
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
|
return error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
|
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
|
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus()) && deptService.selectNormalChildrenDeptById(deptId) > 0) {
|
|
return error("该部门包含未停用的子部门!");
|
|
return error("该部门包含未停用的子部门!");
|