From 4bf16e76f1e56a01ad13a010bffd7dbdfef39b88 Mon Sep 17 00:00:00 2001 From: yang Date: Wed, 3 Apr 2024 03:33:20 +0900 Subject: [PATCH 1/2] =?UTF-8?q?RAC-326=20HotFix=20:=20=EC=9D=B8=EC=A6=9D?= =?UTF-8?q?=EC=95=88=EB=90=9C=20=EC=84=A0=EB=B0=B0=20=EC=9E=90=EC=8B=A0?= =?UTF-8?q?=EC=9D=98=20=EA=B0=80=EB=8A=A5=EC=8B=9C=EA=B0=84=20=EC=A1=B0?= =?UTF-8?q?=ED=9A=8C=20=EA=B0=80=EB=8A=A5=ED=95=98=EB=8F=84=EB=A1=9D=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../domain/repository/AvailableDslRepository.java | 1 + .../domain/repository/AvailableDslRepositoryImpl.java | 8 ++++++++ .../available/domain/service/AvailableGetService.java | 4 ++++ .../senior/application/usecase/SeniorInfoUseCase.java | 2 +- .../senior/application/usecase/SeniorMyPageUseCase.java | 2 +- .../application/usecase/SeniorMyPageUseCaseTest.java | 2 +- 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/postgraduate/domain/available/domain/repository/AvailableDslRepository.java b/src/main/java/com/postgraduate/domain/available/domain/repository/AvailableDslRepository.java index 973cc926..8749f8bd 100644 --- a/src/main/java/com/postgraduate/domain/available/domain/repository/AvailableDslRepository.java +++ b/src/main/java/com/postgraduate/domain/available/domain/repository/AvailableDslRepository.java @@ -7,4 +7,5 @@ public interface AvailableDslRepository { List findAllBySenior(Senior senior); + List findAllByMine(Senior senior); } diff --git a/src/main/java/com/postgraduate/domain/available/domain/repository/AvailableDslRepositoryImpl.java b/src/main/java/com/postgraduate/domain/available/domain/repository/AvailableDslRepositoryImpl.java index 85c8415c..9a59ec4d 100644 --- a/src/main/java/com/postgraduate/domain/available/domain/repository/AvailableDslRepositoryImpl.java +++ b/src/main/java/com/postgraduate/domain/available/domain/repository/AvailableDslRepositoryImpl.java @@ -22,4 +22,12 @@ public List findAllBySenior(Senior senior) { .where(available.senior.eq(senior), available.senior.status.eq(APPROVE)) .fetch(); } + + @Override + public List findAllByMine(Senior senior) { + return queryFactory.selectFrom(available) + .distinct() + .where(available.senior.eq(senior)) + .fetch(); + } } diff --git a/src/main/java/com/postgraduate/domain/available/domain/service/AvailableGetService.java b/src/main/java/com/postgraduate/domain/available/domain/service/AvailableGetService.java index 4afd3303..eb312e53 100644 --- a/src/main/java/com/postgraduate/domain/available/domain/service/AvailableGetService.java +++ b/src/main/java/com/postgraduate/domain/available/domain/service/AvailableGetService.java @@ -16,4 +16,8 @@ public class AvailableGetService { public List bySenior(Senior senior) { return availableRepository.findAllBySenior(senior); } + + public List byMine(Senior senior) { + return availableRepository.findAllByMine(senior); + } } diff --git a/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCase.java b/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCase.java index bff50863..16db8af5 100644 --- a/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCase.java +++ b/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorInfoUseCase.java @@ -54,7 +54,7 @@ private SeniorDetailResponse getResponse(Long seniorId, boolean isMine) { } private SeniorDetailResponse getResponseMine(Senior senior, boolean isMine) { - List availables = availableGetService.bySenior(senior); + List availables = availableGetService.byMine(senior); List times = availables.stream() .map(AvailableMapper::mapToAvailableTimes) .toList(); diff --git a/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCase.java b/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCase.java index d9e27483..d69ca5c5 100644 --- a/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCase.java +++ b/src/main/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCase.java @@ -53,7 +53,7 @@ public SeniorMyPageProfileResponse getSeniorMyPageProfile(User user) { if (senior.getProfile() == null) { throw new NoneProfileException(); } - List availables = availableGetService.bySenior(senior); + List availables = availableGetService.byMine(senior); List times = availables.stream() .map(AvailableMapper::mapToAvailableTimes) .toList(); diff --git a/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCaseTest.java b/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCaseTest.java index 4c6d9dac..699be66e 100644 --- a/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCaseTest.java +++ b/src/test/java/com/postgraduate/domain/senior/application/usecase/SeniorMyPageUseCaseTest.java @@ -109,7 +109,7 @@ void getSeniorMyPageProfile() { given(seniorGetService.byUser(user)) .willReturn(senior); - given(availableGetService.bySenior(senior)) + given(availableGetService.byMine(senior)) .willReturn(availables); SeniorMyPageProfileResponse myPageProfile = seniorMyPageUseCase.getSeniorMyPageProfile(user); From 1c4e9e91677f1fe5a5e706ee10769a5d7ced7d97 Mon Sep 17 00:00:00 2001 From: yang Date: Wed, 3 Apr 2024 03:33:36 +0900 Subject: [PATCH 2/2] =?UTF-8?q?RAC-326=20refactor=20:=20=EC=BF=BC=EB=A6=AC?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../repository/MentoringDslRepositoryImpl.java | 10 ++++++---- .../repository/PaymentDslRepositoryImpl.java | 2 +- .../repository/SalaryDslRepositoryImpl.java | 15 ++++++++------- .../repository/SeniorDslRepositoryImpl.java | 2 +- .../domain/repository/WishDslRepositoryImpl.java | 4 ++-- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/postgraduate/domain/mentoring/domain/repository/MentoringDslRepositoryImpl.java b/src/main/java/com/postgraduate/domain/mentoring/domain/repository/MentoringDslRepositoryImpl.java index a863b112..9b104897 100644 --- a/src/main/java/com/postgraduate/domain/mentoring/domain/repository/MentoringDslRepositoryImpl.java +++ b/src/main/java/com/postgraduate/domain/mentoring/domain/repository/MentoringDslRepositoryImpl.java @@ -96,6 +96,7 @@ public Optional findByMentoringId(Long mentoringId) { @Override public List findAllBySeniorAndSalaryStatus(Senior senior, Boolean status) { return queryFactory.selectFrom(mentoring) + .distinct() .where( mentoring.senior.eq(senior), mentoring.status.eq(Status.DONE), @@ -112,13 +113,14 @@ public List findAllBySeniorAndSalaryStatus(Senior senior, Boolean sta @Override public Page findAllBySearchPayment(String search, Pageable pageable) { List mentorings = queryFactory.selectFrom(mentoring) + .distinct() .where( searchLike(search), mentoring.user.isDelete.eq(FALSE) ) - .join(mentoring.user, user) + .leftJoin(mentoring.user, user) .fetchJoin() - .join(mentoring.payment, payment) + .leftJoin(mentoring.payment, payment) .fetchJoin() .orderBy(mentoring.payment.paidAt.desc()) .offset(pageable.getOffset()) @@ -150,9 +152,9 @@ private BooleanExpression searchLike(String search) { public List findAllByStatusAndCreatedAtIsBefore(Status status, LocalDateTime now) { return queryFactory.selectFrom(mentoring) .distinct() - .join(mentoring.user, user) + .leftJoin(mentoring.user, user) .fetchJoin() - .join(mentoring.payment, payment) + .leftJoin(mentoring.payment, payment) .fetchJoin() .where(mentoring.status.eq(status), mentoring.createdAt.before(now)) .fetch(); diff --git a/src/main/java/com/postgraduate/domain/payment/domain/repository/PaymentDslRepositoryImpl.java b/src/main/java/com/postgraduate/domain/payment/domain/repository/PaymentDslRepositoryImpl.java index 9e54ffac..c7919446 100644 --- a/src/main/java/com/postgraduate/domain/payment/domain/repository/PaymentDslRepositoryImpl.java +++ b/src/main/java/com/postgraduate/domain/payment/domain/repository/PaymentDslRepositoryImpl.java @@ -19,7 +19,7 @@ public class PaymentDslRepositoryImpl implements PaymentDslRepository { public List findAllPayment() { return queryFactory.selectFrom(payment) .distinct() - .join(payment.user, user) + .leftJoin(payment.user, user) .fetchJoin() .fetch(); } diff --git a/src/main/java/com/postgraduate/domain/salary/domain/repository/SalaryDslRepositoryImpl.java b/src/main/java/com/postgraduate/domain/salary/domain/repository/SalaryDslRepositoryImpl.java index 2badfa1f..28574ea8 100644 --- a/src/main/java/com/postgraduate/domain/salary/domain/repository/SalaryDslRepositoryImpl.java +++ b/src/main/java/com/postgraduate/domain/salary/domain/repository/SalaryDslRepositoryImpl.java @@ -39,6 +39,7 @@ public Page findDistinctBySearchSenior(String search, Pageable pag ) ) .from(salary) + .distinct() .where( searchLike(search), salary.senior.user.isDelete.eq(FALSE) @@ -86,9 +87,9 @@ public List findAllLastSalary(LocalDate salaryDate) { return queryFactory.selectFrom(salary) .distinct() .where(salary.salaryDate.eq(salaryDate)) - .join(salary.senior, senior) + .leftJoin(salary.senior, senior) .fetchJoin() - .join(salary.senior.user, user) + .leftJoin(salary.senior.user, user) .fetchJoin() .fetch(); } @@ -102,9 +103,9 @@ public List findAllByNotDoneFromLast(LocalDate salaryDate) { salary.salaryDate.lt(salaryDate), salary.totalAmount.gt(0) ) - .join(salary.senior, senior) + .leftJoin(salary.senior, senior) .fetchJoin() - .join(senior.user, user) + .leftJoin(senior.user, user) .fetchJoin() .orderBy(salary.salaryDate.asc()) .fetch(); @@ -115,9 +116,9 @@ public List findAllByDone() { return queryFactory.selectFrom(salary) .distinct() .where(salary.status.isTrue()) - .join(salary.senior, senior) + .leftJoin(salary.senior, senior) .fetchJoin() - .join(senior.user, user) + .leftJoin(senior.user, user) .fetchJoin() .where(salary.totalAmount.gt(0)) .orderBy(salary.salaryDoneDate.desc()) @@ -139,7 +140,7 @@ public List findAllBySalaryNoneAccount(LocalDate salaryDate, Senior sear salary.senior.eq(searchSenior) .and(salary.account.isNull()) ) - .join(salary.senior, senior) + .leftJoin(salary.senior, senior) .fetchJoin() .fetch(); } diff --git a/src/main/java/com/postgraduate/domain/senior/domain/repository/SeniorDslRepositoryImpl.java b/src/main/java/com/postgraduate/domain/senior/domain/repository/SeniorDslRepositoryImpl.java index 641fddda..c965f01e 100644 --- a/src/main/java/com/postgraduate/domain/senior/domain/repository/SeniorDslRepositoryImpl.java +++ b/src/main/java/com/postgraduate/domain/senior/domain/repository/SeniorDslRepositoryImpl.java @@ -229,7 +229,7 @@ public List findAllSeniorAndAccount() { public List findAllSenior() { return queryFactory.selectFrom(senior) .distinct() - .join(senior.user, user) + .leftJoin(senior.user, user) .fetchJoin() .where(senior.user.isDelete.eq(FALSE)) .orderBy(senior.user.nickName.asc()) diff --git a/src/main/java/com/postgraduate/domain/wish/domain/repository/WishDslRepositoryImpl.java b/src/main/java/com/postgraduate/domain/wish/domain/repository/WishDslRepositoryImpl.java index 324a8a08..44d5c7d6 100644 --- a/src/main/java/com/postgraduate/domain/wish/domain/repository/WishDslRepositoryImpl.java +++ b/src/main/java/com/postgraduate/domain/wish/domain/repository/WishDslRepositoryImpl.java @@ -25,7 +25,7 @@ public class WishDslRepositoryImpl implements WishDslRepository { public Page findAllBySearchWish(String search, Pageable pageable) { List wishes = queryFactory.selectFrom(wish) .distinct() - .join(wish.user, user) + .leftJoin(wish.user, user) .fetchJoin() .where( searchLike(search), @@ -58,7 +58,7 @@ private BooleanExpression searchLike(String search) { public List findAllWish() { return queryFactory.selectFrom(wish) .distinct() - .join(wish.user, user) + .leftJoin(wish.user, user) .fetchJoin() .where(wish.user.isDelete.isFalse()) .fetch();