Hotfix/bug repair

This commit is contained in:
徐文波
2020-05-01 18:03:31 +08:00
parent 1a6e7b0887
commit 52dc1a5d83
29 changed files with 500 additions and 142 deletions

View File

@ -72,6 +72,7 @@ public class DeptServiceImpl implements DeptService {
Set<DeptDTO> depts= new LinkedHashSet<>();
List<String> deptNames = deptDtos.stream().map(DeptDTO::getName).collect(Collectors.toList());
boolean isChild;
List<Dept> deptList = deptRepository.findAll();
for (DeptDTO deptDTO : deptDtos) {
isChild = false;
if ("0".equals(deptDTO.getPid().toString())) {
@ -88,8 +89,11 @@ public class DeptServiceImpl implements DeptService {
}
if(isChild) {
depts.add(deptDTO);
} else if(!deptNames.contains(deptRepository.findNameById(deptDTO.getPid()))) {
depts.add(deptDTO);
for (Dept dept : deptList) {
if(dept.getId() == deptDTO.getPid() && !deptNames.contains(dept.getName())){
depts.add(deptDTO);
}
}
}
}
@ -158,4 +162,4 @@ public class DeptServiceImpl implements DeptService {
}
return deptDtos;
}
}
}