|
@@ -41,20 +41,22 @@ public class AdminUserApiImpl implements AdminUserApi {
|
|
|
|
|
|
@Override
|
|
|
public List<AdminUserRespDTO> getUserListBySubordinate(Long id) {
|
|
|
- // 1.1 获取用户负责的部门
|
|
|
- List<DeptDO> depts = deptService.getDeptListByLeaderUserId(id);
|
|
|
- if (CollUtil.isEmpty(depts)) {
|
|
|
- return Collections.emptyList();
|
|
|
- }
|
|
|
- // 1.2 获取所有子部门
|
|
|
- Set<Long> deptIds = convertSet(depts, DeptDO::getId);
|
|
|
- List<DeptDO> childDeptList = deptService.getChildDeptList(deptIds);
|
|
|
- if (CollUtil.isNotEmpty(childDeptList)) {
|
|
|
- deptIds.addAll(convertSet(childDeptList, DeptDO::getId));
|
|
|
- }
|
|
|
-
|
|
|
- // 2. 获取部门对应的用户信息
|
|
|
- List<AdminUserDO> users = userService.getUserListByDeptIds(deptIds);
|
|
|
+// // 1.1 获取用户负责的部门
|
|
|
+// List<DeptDO> depts = deptService.getDeptListByLeaderUserId(id);
|
|
|
+// if (CollUtil.isEmpty(depts)) {
|
|
|
+// return Collections.emptyList();
|
|
|
+// }
|
|
|
+// // 1.2 获取所有子部门
|
|
|
+// Set<Long> deptIds = convertSet(depts, DeptDO::getId);
|
|
|
+// List<DeptDO> childDeptList = deptService.getChildDeptList(deptIds);
|
|
|
+// if (CollUtil.isNotEmpty(childDeptList)) {
|
|
|
+// deptIds.addAll(convertSet(childDeptList, DeptDO::getId));
|
|
|
+// }
|
|
|
+//
|
|
|
+// // 2. 获取部门对应的用户信息
|
|
|
+ AdminUserDO user = userService.getUser(id);
|
|
|
+ Set<Long> childDeptIdListFromCache = deptService.getChildDeptIdListFromCache(user.getDeptId());
|
|
|
+ List<AdminUserDO> users = userService.getUserListByDeptIds(childDeptIdListFromCache);
|
|
|
users.removeIf(item -> ObjUtil.equal(item.getId(), id)); // 排除自己
|
|
|
return BeanUtils.toBean(users, AdminUserRespDTO.class);
|
|
|
}
|