|
|
|
@ -1,5 +1,6 @@ |
|
|
|
package com.project.ding.domain.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
|
import cn.hutool.core.util.BooleanUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
@ -81,11 +82,13 @@ public class SearchUserDomainServiceImpl implements SearchUserDomainService { |
|
|
|
DepartmentDTO departmentDTO = departmentBaseService.getById(singleDeptId).toDTO(DepartmentDTO::new); |
|
|
|
List<DepartmentDTO> departmentDTOPathList = departmentBaseService.lambdaQuery().in(DepartmentEntity::getId, departmentDTO.getDeptIdPath()).list() |
|
|
|
.stream().map(departmentEntity -> departmentEntity.toDTO(DepartmentDTO::new)).toList(); |
|
|
|
departmentDTOPathList.forEach(depDTO -> |
|
|
|
depDTO.setDeptNamePath(new ArrayList<>(Collections.singletonList(depDTO.getName())))); |
|
|
|
departmentDTOPathList.forEach(depDTO -> depDTO.setDeptNamePath(new ArrayList<>(Collections.singletonList(depDTO.getName()))) |
|
|
|
); |
|
|
|
departmentDTOPathList = TreeUtils.buildLongTree(departmentDTOPathList , DepartmentDTO::getId , DepartmentDTO::getParentId , (parentDTO , childrenList) -> { |
|
|
|
parentDTO.setChildrenList(childrenList); |
|
|
|
if (CollUtil.isNotEmpty(childrenList)) { |
|
|
|
parentDTO.setLeaf(Boolean.FALSE); |
|
|
|
} |
|
|
|
childrenList.forEach(childDTO -> childDTO.getDeptNamePath().addAll(0, parentDTO.getDeptNamePath())); |
|
|
|
}); |
|
|
|
departmentDTOPathList = TreeUtils.tree2List(departmentDTOPathList, DepartmentDTO::getChildrenList); |
|
|
|
|