|
@@ -104,19 +104,19 @@ public class TmDepartmentServiceImpl extends ServiceImpl<ITmDepartmentMapper, Tm
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
if("0".equals(dept.getId())){
|
|
|
- return this.getDeptListByParentId(deptId);
|
|
|
+ return this.getDeptListByParentId(dept);
|
|
|
}
|
|
|
- dept.setChildren(this.getDeptListByParentId(deptId));
|
|
|
+ dept.setChildren(this.getDeptListByParentId(dept));
|
|
|
return Arrays.asList(dept);
|
|
|
}
|
|
|
|
|
|
|
|
|
- public List<TmDepartment> getDeptListByParentId(String parentId) {
|
|
|
+ public List<TmDepartment> getDeptListByParentId(TmDepartment department) {
|
|
|
LambdaQueryWrapper<TmDepartment> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
- if(parentId == null){
|
|
|
+ if(department.getParentId() == null){
|
|
|
queryWrapper.isNull(TmDepartment::getParentId);
|
|
|
}else {
|
|
|
- queryWrapper.eq(TmDepartment::getParentId,parentId);
|
|
|
+ queryWrapper.eq(TmDepartment::getParentId,department.getParentId());
|
|
|
}
|
|
|
queryWrapper.orderByDesc(TmDepartment::getCreateTime);
|
|
|
List<TmDepartment> list = this.list(queryWrapper);
|
|
@@ -124,7 +124,8 @@ public class TmDepartmentServiceImpl extends ServiceImpl<ITmDepartmentMapper, Tm
|
|
|
return list;
|
|
|
}
|
|
|
for (TmDepartment deptVo : list) {
|
|
|
- deptVo.setChildren(getDeptListByParentId(deptVo.getId()));
|
|
|
+ deptVo.setChildren(getDeptListByParentId(deptVo));
|
|
|
+ deptVo.setParentName(department.getName());
|
|
|
}
|
|
|
return list;
|
|
|
}
|