From 21652eb1a25bdb86b25a8ffebb113dfa13448246 Mon Sep 17 00:00:00 2001 From: whitemark Date: Sun, 4 Feb 2024 12:08:17 +0900 Subject: [PATCH] =?UTF-8?q?[feature/#225]=20=EB=88=84=EB=9D=BD=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/MemberRepositoryCustom.java | 4 +-- .../repository/MemberRepositoryImpl.java | 32 +++++++++++-------- .../usecase/MemberManageServiceImpl.java | 4 +-- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/repository/MemberRepositoryCustom.java b/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/repository/MemberRepositoryCustom.java index 867f086f..cf551c27 100644 --- a/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/repository/MemberRepositoryCustom.java +++ b/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/repository/MemberRepositoryCustom.java @@ -22,7 +22,7 @@ public interface MemberRepositoryCustom { List findAllByRolesInAndNameLike(Collection roles, String name); - List findAllGraduatedByRolesInAndStudentLike(String studentId); + List findAllGraduatedByRolesInAndStudentLike(Collection roles, String studentId); - List findAllGraduatedByRolesInAndNameLike(String name); + List findAllGraduatedByRolesInAndNameLike(Collection roles, String name); } diff --git a/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/repository/MemberRepositoryImpl.java b/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/repository/MemberRepositoryImpl.java index 23238c89..44e584a8 100644 --- a/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/repository/MemberRepositoryImpl.java +++ b/module-auth/src/main/java/com/inhabas/api/auth/domain/oauth2/member/repository/MemberRepositoryImpl.java @@ -84,10 +84,7 @@ public List findAllByRoleAndNameLike(Role role, String name) { return queryFactory .selectFrom(member) - .where( - eqRole(role) - .and(member.name.value.like("%" + name + "%")) - .and(member.schoolInformation.memberType.ne(MemberType.GRADUATED))) + .where(eqRole(role).and(member.name.value.like("%" + name + "%"))) .fetch(); } @@ -116,13 +113,20 @@ public List findAllByRolesInAndNameLike(Collection roles, String n return queryFactory .selectFrom(member) - .where(member.ibasInformation.role.in(roles).and(member.name.value.like("%" + name + "%"))) + .where( + member + .ibasInformation + .role + .in(roles) + .and(member.name.value.like("%" + name + "%")) + .and(member.schoolInformation.memberType.ne(MemberType.GRADUATED))) .orderBy(ORDER_BY_ROLE, orderByStudentId) .fetch(); } @Override - public List findAllGraduatedByRolesInAndStudentLike(String studentId) { + public List findAllGraduatedByRolesInAndStudentLike( + Collection roles, String studentId) { OrderSpecifier orderByStudentId = member.studentId.id.asc(); @@ -130,16 +134,17 @@ public List findAllGraduatedByRolesInAndStudentLike(String studentId) { .selectFrom(member) .where( member - .schoolInformation - .memberType - .eq(MemberType.GRADUATED) + .ibasInformation + .role + .in(roles) + .and(member.schoolInformation.memberType.eq(MemberType.GRADUATED)) .and(member.studentId.id.like("%" + studentId + "%"))) .orderBy(ORDER_BY_ROLE, orderByStudentId) .fetch(); } @Override - public List findAllGraduatedByRolesInAndNameLike(String name) { + public List findAllGraduatedByRolesInAndNameLike(Collection roles, String name) { OrderSpecifier orderByStudentId = member.studentId.id.asc(); @@ -147,9 +152,10 @@ public List findAllGraduatedByRolesInAndNameLike(String name) { .selectFrom(member) .where( member - .schoolInformation - .memberType - .eq(MemberType.GRADUATED) + .ibasInformation + .role + .in(roles) + .and(member.schoolInformation.memberType.eq(MemberType.GRADUATED)) .and(member.name.value.like("%" + name + "%"))) .orderBy(ORDER_BY_ROLE, orderByStudentId) .fetch(); diff --git a/resource-server/src/main/java/com/inhabas/api/domain/member/usecase/MemberManageServiceImpl.java b/resource-server/src/main/java/com/inhabas/api/domain/member/usecase/MemberManageServiceImpl.java index 7eca77e5..80a5f9fe 100644 --- a/resource-server/src/main/java/com/inhabas/api/domain/member/usecase/MemberManageServiceImpl.java +++ b/resource-server/src/main/java/com/inhabas/api/domain/member/usecase/MemberManageServiceImpl.java @@ -101,8 +101,8 @@ public List getApprovedMembersBySearchAndRole(Strin public List getGraduatedMembersBySearch(String search) { final List members = StringUtils.isNumeric(search) - ? memberRepository.findAllGraduatedByRolesInAndStudentLike(search) - : memberRepository.findAllGraduatedByRolesInAndNameLike(search); + ? memberRepository.findAllGraduatedByRolesInAndStudentLike(OLD_ROLES, search) + : memberRepository.findAllGraduatedByRolesInAndNameLike(OLD_ROLES, search); return members.stream() .map(