|
@@ -52,12 +52,10 @@ public class TmDepartmentServiceImpl extends ServiceImpl<ITmDepartmentMapper, Tm
|
|
|
if(!checkDeptNameUnique(dept.getName(),null)){
|
|
|
throw new BusinessException(ResultCode.DEPT_NAME_EXITS);
|
|
|
}
|
|
|
- if(dept.getLevel() >4){
|
|
|
- throw new BusinessException(ResultCode.DEPT_ADD_ERROR);
|
|
|
- }
|
|
|
List<TmDepartment> tmDepartments = new ArrayList<>();
|
|
|
this.getParentList(dept.getParentId(),tmDepartments);
|
|
|
- if(tmDepartments.size() >4){
|
|
|
+ List<TmDepartment> collect = tmDepartments.stream().filter(entity -> !entity.getId().equals("0")).collect(Collectors.toList());
|
|
|
+ if(collect.size() >4){
|
|
|
throw new BusinessException(ResultCode.DEPT_ADD_ERROR);
|
|
|
}
|
|
|
dept.setId(IdPreEnum.DEPARTMENT_PRE.getPre() +IdUtil.getSnowflake(1).nextId() );
|