From f2d7762dae165629b3b367068a66fbba12d3e27d Mon Sep 17 00:00:00 2001 From: nohy6630 Date: Thu, 23 May 2024 15:46:34 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20=EB=B0=B0=EC=9B=80=EB=82=98=EB=88=84?= =?UTF-8?q?=EA=B8=B0=20=ED=8E=98=EC=9D=B4=EC=A7=95=20=EB=B2=84=EA=B7=B8=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 --- .../repository/custom/ExperienceRepositoryCustom.java | 2 +- .../experience/repository/custom/ExperienceRepositoryImpl.java | 3 ++- .../backend/domain/experience/service/ExperienceService.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/meetup/teame/backend/domain/experience/repository/custom/ExperienceRepositoryCustom.java b/src/main/java/com/meetup/teame/backend/domain/experience/repository/custom/ExperienceRepositoryCustom.java index 59c2051..97e956e 100644 --- a/src/main/java/com/meetup/teame/backend/domain/experience/repository/custom/ExperienceRepositoryCustom.java +++ b/src/main/java/com/meetup/teame/backend/domain/experience/repository/custom/ExperienceRepositoryCustom.java @@ -9,7 +9,7 @@ public interface ExperienceRepositoryCustom { List findExperiencesOrderByLatest(long offset,long limit, String category, User user); List findExperiencesOrderByReview(long offset,long limit, String category, User user); - Long countExperiences(String category); + Long countExperiences(String category, User user); List findExperiencesForMain(); } diff --git a/src/main/java/com/meetup/teame/backend/domain/experience/repository/custom/ExperienceRepositoryImpl.java b/src/main/java/com/meetup/teame/backend/domain/experience/repository/custom/ExperienceRepositoryImpl.java index 7de966d..af7be57 100644 --- a/src/main/java/com/meetup/teame/backend/domain/experience/repository/custom/ExperienceRepositoryImpl.java +++ b/src/main/java/com/meetup/teame/backend/domain/experience/repository/custom/ExperienceRepositoryImpl.java @@ -54,8 +54,9 @@ public List findExperiencesOrderByReview(long offset, long limit, St } @Override - public Long countExperiences(String category) { + public Long countExperiences(String category, User me) { BooleanBuilder builder = new BooleanBuilder(); + builder.and(experience.user.ne(me)); if (category != null) builder.and(experience.type.eq(ExperienceType.of(category))); return jpaQueryFactory diff --git a/src/main/java/com/meetup/teame/backend/domain/experience/service/ExperienceService.java b/src/main/java/com/meetup/teame/backend/domain/experience/service/ExperienceService.java index 447786e..6b6282f 100644 --- a/src/main/java/com/meetup/teame/backend/domain/experience/service/ExperienceService.java +++ b/src/main/java/com/meetup/teame/backend/domain/experience/service/ExperienceService.java @@ -37,7 +37,7 @@ public ReadExperiencesRes readExperiences(ReadExperiencesReq readExperiencesReq) long limit = EXPERIENCE_PAGE_SIZE; if (category.equals("전체")) category = null; - long pageCount = (experienceRepository.countExperiences(category) + EXPERIENCE_PAGE_SIZE - 1) / EXPERIENCE_PAGE_SIZE; + long pageCount = (experienceRepository.countExperiences(category, user) + EXPERIENCE_PAGE_SIZE - 1) / EXPERIENCE_PAGE_SIZE; if (sort.equals("latest")) return ReadExperiencesRes.of(page, pageCount, experienceRepository.findExperiencesOrderByLatest(offset, limit, category, user)); else if (sort.equals("review"))