From db3c2bd4c6fbb9a930ce1219b29a6860b0aad14f Mon Sep 17 00:00:00 2001 From: lilong Date: Tue, 16 Apr 2024 10:22:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:(REQ-2227)=20=E4=BF=AE=E6=94=B9=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E7=A7=BB=E4=BD=8D=E6=97=B6=E6=9F=A5=E8=AF=A2=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E7=9A=84=E6=8E=A5=E5=8F=A3=EF=BC=8C=E5=8E=9F=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=9C=89bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/role/SaasRoleController.java | 23 +++++++++++-------- .../service/SaasRoleGroupRelationService.java | 6 ++++- 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/controller/role/SaasRoleController.java b/tyr-server/src/main/java/cn/axzo/tyr/server/controller/role/SaasRoleController.java index 7352f439..0c899335 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/controller/role/SaasRoleController.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/controller/role/SaasRoleController.java @@ -239,7 +239,7 @@ public class SaasRoleController implements TyrSaasRoleApi { } List saasRoleGroupRelations = saasRoleGroupRelationService.list(SaasRoleGroupRelationService.ListSaasRoleGroupRelationParam.builder() - .roleId(Lists.newArrayList(saasRole.getId())) + .roleIds(Lists.newArrayList(saasRole.getId())) .build()); if (CollectionUtils.isEmpty(saasRoleGroupRelations)) { throw new ServiceException("角色分组信息不存在"); @@ -249,14 +249,19 @@ public class SaasRoleController implements TyrSaasRoleApi { throw new ServiceException("角色分组信息不唯一,请检查异常"); } - List saasRoles = roleService.query(QuerySaasRoleReq.builder() - .sassRoleGroupIds(Lists.transform(saasRoleGroupRelations, SaasRoleGroupRelation::getSaasRoleGroupId)) - .build()) + List saasRoleGroupRelationAll = saasRoleGroupRelationService.list(SaasRoleGroupRelationService.ListSaasRoleGroupRelationParam.builder() + .saasRoleGroupIds(Lists.transform(saasRoleGroupRelations, SaasRoleGroupRelation::getSaasRoleGroupId)) + .build()); + + List saasRoles = roleService.list(RoleService.ListSaasRoleParam.builder() + .roleIds(Lists.transform(saasRoleGroupRelationAll, SaasRoleGroupRelation::getRoleId)) + .build()) .stream() - .sorted(Comparator.comparing(SaasRoleVO::getSort)) + .sorted(Comparator.comparing(SaasRoleRes::getSort)) .collect(Collectors.toList()); - SaasRoleVO exchangeRole = findExchangeRole(request, saasRoles); + + SaasRoleRes exchangeRole = findExchangeRole(request, saasRoles); if (exchangeRole == null) { throw new ServiceException("未找到可以移动的位置"); } @@ -286,10 +291,10 @@ public class SaasRoleController implements TyrSaasRoleApi { * @param roles * @return */ - private SaasRoleVO findExchangeRole(UpdateRoleOffsetReq request, - List roles) { + private SaasRoleRes findExchangeRole(UpdateRoleOffsetReq request, + List roles) { List ids = roles.stream() - .map(SaasRoleVO::getId) + .map(SaasRoleRes::getId) .collect(Collectors.toList()); int currentIndex = ids.indexOf(request.getId()); // 下移一位 diff --git a/tyr-server/src/main/java/cn/axzo/tyr/server/service/SaasRoleGroupRelationService.java b/tyr-server/src/main/java/cn/axzo/tyr/server/service/SaasRoleGroupRelationService.java index 20b9f57c..4579b5ff 100644 --- a/tyr-server/src/main/java/cn/axzo/tyr/server/service/SaasRoleGroupRelationService.java +++ b/tyr-server/src/main/java/cn/axzo/tyr/server/service/SaasRoleGroupRelationService.java @@ -27,7 +27,11 @@ public interface SaasRoleGroupRelationService extends IService roleId; + private List roleIds; + + @CriteriaField(field = "saasRoleGroupId", operator = Operator.IN) + private List saasRoleGroupIds; + } @SuperBuilder