From c59c3be3452cd0e1bf0a6bc82992b5f50255a37a Mon Sep 17 00:00:00 2001 From: nixj Date: Mon, 1 Jul 2024 14:06:44 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90fix=E3=80=91=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=97=A0=E8=A7=92=E8=89=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../chint/domain/service/SystemDomainService.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/chint/domain/service/SystemDomainService.java b/src/main/java/com/chint/domain/service/SystemDomainService.java index deed1cf0..561f5fe6 100644 --- a/src/main/java/com/chint/domain/service/SystemDomainService.java +++ b/src/main/java/com/chint/domain/service/SystemDomainService.java @@ -7,7 +7,9 @@ import com.chint.domain.aggregates.system.AccountCompany; import com.chint.domain.aggregates.system.SystemCode; import com.chint.domain.aggregates.system.SystemOrganization; import com.chint.domain.aggregates.system.SystemOrganizationExtension; +import com.chint.domain.aggregates.user.Role; import com.chint.domain.aggregates.user.RoleOrganization; +import com.chint.domain.aggregates.user.RoleUser; import com.chint.domain.aggregates.user.User; import com.chint.domain.exceptions.NotFoundException; import com.chint.domain.repository.*; @@ -163,12 +165,12 @@ public class SystemDomainService { @ListenTo(command = "UserRoleCommand", order = 0) public void loadUserRole(UserRoleCommand command) { User user = command.getUser(); -// List byUserId = roleUserRepository.findByUserId(user.getUserId()); -// List roleList = byUserId.stream().flatMap(it -> roleRepository -// .findById(it.getRoleId()) -// .stream()) -// .toList(); -// user.setRoleList(roleList); + List byUserId = roleUserRepository.findByUserId(user.getUserId()); + List roleList = byUserId.stream().flatMap(it -> roleRepository + .findById(it.getRoleId()) + .stream()) + .toList(); + user.setRoleList(roleList); roleRepository.loadUserRole(user); }