剔除不需要的接口方法
This commit is contained in:
@@ -79,15 +79,6 @@ public class DeptController {
|
||||
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping(value = {"/list-simple", "/simple-dept-list"})
|
||||
@Operation(summary = "获取部门精简信息列表(不包含当前用户归属部门的上级部门)", description = "只包含被开启的部门,主要用于前端的下拉选项")
|
||||
@DeptVisitIgnore
|
||||
public CommonResult<List<DeptSimpleRespVO>> getNoParentSimpleDeptList() {
|
||||
List<DeptDO> list = deptService.getNoParentDeptList(
|
||||
new DeptListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus()));
|
||||
return success(BeanUtils.toBean(list, DeptSimpleRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得部门信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
|
||||
@@ -59,7 +59,6 @@ public interface DeptService {
|
||||
* @return 部门列表
|
||||
*/
|
||||
List<DeptDO> getDeptList(DeptListReqVO reqVO);
|
||||
List<DeptDO> getNoParentDeptList(DeptListReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获得指定编号的部门 Map
|
||||
|
||||
@@ -19,11 +19,9 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserDeptId;
|
||||
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
@@ -171,28 +169,6 @@ public class DeptServiceImpl implements DeptService {
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDO> getNoParentDeptList(DeptListReqVO reqVO){
|
||||
List<DeptDO> list = deptMapper.selectList(reqVO);
|
||||
// 循环过滤掉当前用户归属部门的所有上级部门
|
||||
Long loginUserDeptId = getLoginUserDeptId();
|
||||
Set<Long> parentIds = new HashSet<>();
|
||||
Map<Long, DeptDO> deptMap = list.stream().collect(Collectors.toMap(DeptDO::getId, d -> d));
|
||||
Long currentId = loginUserDeptId;
|
||||
while (currentId != null && !DeptDO.PARENT_ID_ROOT.equals(currentId)) {
|
||||
DeptDO dept = deptMap.get(currentId);
|
||||
if (dept == null) break;
|
||||
Long parentId = dept.getParentId();
|
||||
if (parentId == null || DeptDO.PARENT_ID_ROOT.equals(parentId)) break;
|
||||
parentIds.add(parentId);
|
||||
currentId = parentId;
|
||||
}
|
||||
// 过滤掉所有上级部门
|
||||
return list.stream()
|
||||
.filter(dept -> !parentIds.contains(dept.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptDO> getChildDeptList(Collection<Long> ids) {
|
||||
List<DeptDO> children = new LinkedList<>();
|
||||
|
||||
Reference in New Issue
Block a user