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"))