Skip to content

Commit

Permalink
[feature/InhaBas#225] 누락 코드 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
whitem4rk committed Feb 4, 2024
1 parent a41ea58 commit 21652eb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public interface MemberRepositoryCustom {

List<Member> findAllByRolesInAndNameLike(Collection<Role> roles, String name);

List<Member> findAllGraduatedByRolesInAndStudentLike(String studentId);
List<Member> findAllGraduatedByRolesInAndStudentLike(Collection<Role> roles, String studentId);

List<Member> findAllGraduatedByRolesInAndNameLike(String name);
List<Member> findAllGraduatedByRolesInAndNameLike(Collection<Role> roles, String name);
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,7 @@ public List<Member> 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();
}

Expand Down Expand Up @@ -116,40 +113,49 @@ public List<Member> findAllByRolesInAndNameLike(Collection<Role> 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<Member> findAllGraduatedByRolesInAndStudentLike(String studentId) {
public List<Member> findAllGraduatedByRolesInAndStudentLike(
Collection<Role> roles, String studentId) {

OrderSpecifier<String> orderByStudentId = member.studentId.id.asc();

return queryFactory
.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<Member> findAllGraduatedByRolesInAndNameLike(String name) {
public List<Member> findAllGraduatedByRolesInAndNameLike(Collection<Role> roles, String name) {

OrderSpecifier<String> orderByStudentId = member.studentId.id.asc();

return queryFactory
.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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ public List<ApprovedMemberManagementDto> getApprovedMembersBySearchAndRole(Strin
public List<ApprovedMemberManagementDto> getGraduatedMembersBySearch(String search) {
final List<Member> members =
StringUtils.isNumeric(search)
? memberRepository.findAllGraduatedByRolesInAndStudentLike(search)
: memberRepository.findAllGraduatedByRolesInAndNameLike(search);
? memberRepository.findAllGraduatedByRolesInAndStudentLike(OLD_ROLES, search)
: memberRepository.findAllGraduatedByRolesInAndNameLike(OLD_ROLES, search);

return members.stream()
.map(
Expand Down

0 comments on commit 21652eb

Please sign in to comment.