fix select

This commit is contained in:
TanJ 2024-04-26 16:00:08 +08:00
parent 50690903c9
commit d8145ba979

View File

@ -63,9 +63,7 @@ public class PermissionGroupImpl implements PermissionGroupService {
List<SaasPgroupRoleRelation> relationList = null;
if (CollectionUtils.isNotEmpty(req.getRoleIds())) {
relationList = pgroupRoleRelationDao.lambdaQuery()
.select(SaasPgroupRoleRelation::getGroupId)
.select(SaasPgroupRoleRelation::getRoleId)
.select(SaasPgroupRoleRelation::getId)
.select(SaasPgroupRoleRelation::getGroupId,SaasPgroupRoleRelation::getRoleId,SaasPgroupRoleRelation::getId)
.in(SaasPgroupRoleRelation::getRoleId, req.getRoleIds())
.eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL.value)
.list();
@ -108,9 +106,7 @@ public class PermissionGroupImpl implements PermissionGroupService {
if (CollectionUtils.isEmpty(relationList)) {
relationList = pgroupRoleRelationDao.lambdaQuery()
.select(SaasPgroupRoleRelation::getGroupId)
.select(SaasPgroupRoleRelation::getRoleId)
.select(SaasPgroupRoleRelation::getId)
.select(SaasPgroupRoleRelation::getGroupId,SaasPgroupRoleRelation::getRoleId,SaasPgroupRoleRelation::getId)
.in(SaasPgroupRoleRelation::getGroupId, groupIds)
.eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL.value)
.list();
@ -120,8 +116,7 @@ public class PermissionGroupImpl implements PermissionGroupService {
// 查询权限集关联的权限
List<SaasPgroupPermissionRelation> permissionList = permissionRelationDao.lambdaQuery()
.select(SaasPgroupPermissionRelation::getGroupId)
.select(SaasPgroupPermissionRelation::getFeatureId)
.select(SaasPgroupPermissionRelation::getFeatureId,SaasPgroupPermissionRelation::getGroupId)
.in(SaasPgroupPermissionRelation::getGroupId, groupIds)
.eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL.value)
.list();
@ -131,16 +126,12 @@ public class PermissionGroupImpl implements PermissionGroupService {
features = featureService.listNodesByIds(permissionList.stream().map(SaasPgroupPermissionRelation::getFeatureId).distinct().collect(Collectors.toList()));
}
Map<Long, PermissionPointTreeNode> featureMap = features.stream().collect(Collectors.toMap(PermissionPointTreeNode::getPermissionPointId, Function.identity(), (e1, e2) -> e2));
Map<Long, List<PermissionPointTreeNode>> pgroupPermissionMap = permissionList.stream()
Map<Long, Set<PermissionPointTreeNode>> pgroupPermissionMap = permissionList.stream()
.collect(Collectors.groupingBy(SaasPgroupPermissionRelation::getGroupId,
Collectors.mapping(releation -> featureMap.get(releation.getFeatureId()), Collectors.toList())));
pgroupPermissionMap.forEach((k, v) -> v.removeIf(Objects::isNull));
Collectors.mapping(releation -> featureMap.get(releation.getFeatureId()), Collectors.toSet())));
List<SaasPermissionGroupScope> saasPermissionGroupScopesSource = saasPermissionGroupScopeDao.lambdaQuery()
.select(SaasPermissionGroupScope::getId)
.select(SaasPermissionGroupScope::getScopeId)
.select(SaasPermissionGroupScope::getPgroupId)
.select(SaasPermissionGroupScope::getType)
.select(SaasPermissionGroupScope::getScopeType)
.select(SaasPermissionGroupScope::getId,SaasPermissionGroupScope::getScopeId,SaasPermissionGroupScope::getPgroupId,SaasPermissionGroupScope::getType
,SaasPermissionGroupScope::getScopeType)
.in(SaasPermissionGroupScope::getPgroupId, groupIds)
.eq(BaseEntity::getIsDelete, TableIsDeleteEnum.NORMAL.value)
.list();