|
@@ -63,6 +63,16 @@ public class TmDepartmentServiceImpl extends ServiceImpl<ITmDepartmentMapper, Tm
|
|
|
if(!checkDeptNameUnique(dept.getName(),dept.getId())){
|
|
|
throw new BusinessException(ResultCode.DEPT_NAME_EXITS);
|
|
|
}
|
|
|
+ if(!dept.getId().equals(dept.getParentId())){
|
|
|
+ throw new BusinessException(ResultCode.DEPT_EDIT_ERROR);
|
|
|
+ }
|
|
|
+ List<TmDepartment> sonByDeptId = this.getSonByDeptId(dept.getId());
|
|
|
+ if(sonByDeptId.size() >0){
|
|
|
+ List<String> collect = sonByDeptId.stream().map(TmDepartment::getId).collect(Collectors.toList());
|
|
|
+ if(collect.contains(dept.getParentId())){
|
|
|
+ throw new BusinessException(ResultCode.DEPT_EDIT_ERROR);
|
|
|
+ }
|
|
|
+ }
|
|
|
dept.setCreateTime(null);
|
|
|
dept.setUpdateTime(null);
|
|
|
this.updateById(dept);
|