修改用户部分
Some checks are pending
Java CI with Maven / build (11) (push) Waiting to run
Java CI with Maven / build (17) (push) Waiting to run
Java CI with Maven / build (8) (push) Waiting to run
yudao-ui-admin CI / build (14.x) (push) Waiting to run
yudao-ui-admin CI / build (16.x) (push) Waiting to run

This commit is contained in:
Flow 2025-05-28 10:18:22 +08:00
parent 165a67f949
commit 07e9a19135
3 changed files with 35 additions and 0 deletions

View File

@ -82,5 +82,12 @@ public class DeptController {
return success(BeanUtils.toBean(dept, DeptRespVO.class));
}
@GetMapping("/listByDeptId")
@Operation(summary = "根据部门ID查询部门列表")
@Parameter(name = "deptId", description = "部门编号", required = true, example = "1024")
public CommonResult<List<DeptRespVO>> getDeptListByDeptId(@RequestParam("deptId") Long deptId) {
List<DeptDO> list = deptService.getDeptListByDeptId(deptId);
return success(BeanUtils.toBean(list, DeptRespVO.class));
}
}

View File

@ -118,4 +118,12 @@ public interface DeptService {
*/
void validateDeptList(Collection<Long> ids);
/**
* 根据部门ID查询部门列表
*
* @param deptId 部门编号
* @return 部门列表
*/
List<DeptDO> getDeptListByDeptId(Long deptId);
}

View File

@ -235,4 +235,24 @@ public class DeptServiceImpl implements DeptService {
});
}
@Override
public List<DeptDO> getDeptListByDeptId(Long deptId) {
// 如果部门ID为1或1001返回所有部门列表
if (deptId == 100L || deptId == 1001L) {
return deptMapper.selectList(new DeptListReqVO());
}
// 获取当前部门
DeptDO dept = getDept(deptId);
if (dept == null) {
return Collections.emptyList();
}
// 获取所有子部门
List<DeptDO> childDepts = getChildDeptList(deptId);
// 将当前部门添加到列表中
List<DeptDO> result = new ArrayList<>();
result.add(dept);
result.addAll(childDepts);
return result;
}
}