feat:(REQ-3068) 优化人员查询接口
This commit is contained in:
parent
bd0f4e83d1
commit
8870a1830d
@ -347,12 +347,14 @@ public class RoleServiceImpl extends ServiceImpl<SaasRoleMapper, SaasRole>
|
|||||||
.build());
|
.build());
|
||||||
|
|
||||||
// 原代码是入参有personId就使用personId查询,不能同时使用personId和identityId、identityType
|
// 原代码是入参有personId就使用personId查询,不能同时使用personId和identityId、identityType
|
||||||
Map<Long, Set<Long>> personRoles = saasRoleUsers.stream()
|
Map<String, Set<Long>> personRoles = saasRoleUsers.stream()
|
||||||
.collect(Collectors.groupingBy(e -> e.getSaasRoleUser().getPersonId(),
|
.collect(Collectors.groupingBy(e ->
|
||||||
|
e.getSaasRoleUser().getPersonId() + "_" + e.getSaasRoleUser().getWorkspaceId() + "_" + e.getSaasRoleUser().getOuId(),
|
||||||
Collectors.mapping(SaasRoleUserV2DTO::getRoleId, Collectors.toSet())));
|
Collectors.mapping(SaasRoleUserV2DTO::getRoleId, Collectors.toSet())));
|
||||||
|
|
||||||
Map<String, Set<Long>> identityRoles = saasRoleUsers.stream()
|
Map<String, Set<Long>> identityRoles = saasRoleUsers.stream()
|
||||||
.collect(Collectors.groupingBy(e -> e.getSaasRoleUser().getIdentityId() + "_" + e.getSaasRoleUser().getIdentityType(),
|
.collect(Collectors.groupingBy(e -> e.getSaasRoleUser().getIdentityId() + "_" + e.getSaasRoleUser().getIdentityType()
|
||||||
|
+ "_" + e.getSaasRoleUser().getWorkspaceId() + "_" + e.getSaasRoleUser().getOuId(),
|
||||||
Collectors.mapping(SaasRoleUserV2DTO::getRoleId, Collectors.toSet())));
|
Collectors.mapping(SaasRoleUserV2DTO::getRoleId, Collectors.toSet())));
|
||||||
|
|
||||||
List<Long> allRoleIds = saasRoleUsers.stream()
|
List<Long> allRoleIds = saasRoleUsers.stream()
|
||||||
@ -372,9 +374,9 @@ public class RoleServiceImpl extends ServiceImpl<SaasRoleMapper, SaasRole>
|
|||||||
// 原代码是入参有personId就使用personId查询,不能同时使用personId和identityId、identityType
|
// 原代码是入参有personId就使用personId查询,不能同时使用personId和identityId、identityType
|
||||||
Set<Long> roleIds;
|
Set<Long> roleIds;
|
||||||
if (Objects.nonNull(e.getPersonId())) {
|
if (Objects.nonNull(e.getPersonId())) {
|
||||||
roleIds = personRoles.get(e.getPersonId());
|
roleIds = personRoles.get(e.getPersonId() + "_" + e.getWorkspaceId() + "_" + e.getOuId());
|
||||||
} else {
|
} else {
|
||||||
roleIds = identityRoles.get(e.getIdentityId() + "_" + e.getIdentityType());
|
roleIds = identityRoles.get(e.getIdentityId() + "_" + e.getIdentityType() + "_" + e.getWorkspaceId() + "_" + e.getOuId());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtils.isNotEmpty(roleIds)) {
|
if (CollectionUtils.isNotEmpty(roleIds)) {
|
||||||
@ -383,35 +385,6 @@ public class RoleServiceImpl extends ServiceImpl<SaasRoleMapper, SaasRole>
|
|||||||
return result;
|
return result;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
// req.stream().distinct().forEach(e -> {
|
|
||||||
// if (e.getPersonId() != null) {
|
|
||||||
// List<Long> roleIds = roleUserRelationDao.queryByPersonId(e.getPersonId(), e.getWorkspaceId(), e.getOuId())
|
|
||||||
// .stream()
|
|
||||||
// .map(SaasRoleUserRelation::getRoleId)
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
// List<SaasRoleVO> saasRoles = getByIds(roleIds, null, null, null, false, null);
|
|
||||||
// result.add(QueryBatchByIdentityIdTypeRes.builder()
|
|
||||||
// .identityId(e.getIdentityId())
|
|
||||||
// .identityType(e.getIdentityType())
|
|
||||||
// .workspaceId(e.getWorkspaceId())
|
|
||||||
// .ouId(e.getOuId())
|
|
||||||
// .personId(e.getPersonId())
|
|
||||||
// .role(saasRoles)
|
|
||||||
// .build());
|
|
||||||
// } else {
|
|
||||||
// result.add(QueryBatchByIdentityIdTypeRes.builder()
|
|
||||||
// .identityId(e.getIdentityId())
|
|
||||||
// .identityType(e.getIdentityType())
|
|
||||||
// .workspaceId(e.getWorkspaceId())
|
|
||||||
// .ouId(e.getOuId())
|
|
||||||
// .role(queryByIdentityIdType(e.getIdentityId(), e.getIdentityType(), e.getWorkspaceId(), e.getOuId(), false))
|
|
||||||
// .build());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// });
|
|
||||||
// return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user