Skip to content

Commit

Permalink
Merge pull request #182 from TripInfoWeb/fix/gathering_home_isLike
Browse files Browse the repository at this point in the history
fix: gathering 페이지네이션 갯수 오류 , home 에서 좋아요 했는지 오류
  • Loading branch information
hyeonjaez authored Sep 19, 2024
2 parents b1c9838 + 52282a8 commit 3171f3a
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,10 @@ public Page<GatheringBriefResponse> getGatheringPageFilterAndOrder(Pageable page
.on(bookMarkGathering.gathering.id.eq(gathering.id).and(bookMarkGathering.user.id.eq(userId)))
.leftJoin(gatheringApplicants).on(gatheringApplicants.gathering.id.eq(gathering.id))
.where(booleanBuilder)
.select(gathering.id.count()).fetchCount();
.select(gathering.id.countDistinct()).fetchCount();

List<GatheringBriefResponse> content = from(gathering)
.distinct()
.join(zoneCategoryChild).on(zoneCategoryChild.id.eq(gathering.zoneCategory.id))
.leftJoin(zoneCategoryParent).on(zoneCategoryParent.id.eq(zoneCategoryChild.parentZoneCategory.id))
.leftJoin(bookMarkGathering)
Expand Down Expand Up @@ -236,10 +237,10 @@ public List<GatheringRankResponse> getGatheringRankList() {
public List<GatheringBriefResponse> getGatheringLikeCountFromCreatedIn3(Long userId) {
NumberExpression<Integer> likeCount = countGreatGatheringByGatheringById();
return from(gathering)
.distinct()
.join(zoneCategoryChild).on(zoneCategoryChild.id.eq(gathering.zoneCategory.id))
.leftJoin(zoneCategoryParent).on(zoneCategoryParent.id.eq(zoneCategoryChild.parentZoneCategory.id))
.leftJoin(bookMarkGathering)
.on(bookMarkGathering.gathering.id.eq(gathering.id).and(bookMarkGathering.user.id.eq(userId)))
.leftJoin(bookMarkGathering).on(bookMarkGathering.gathering.id.eq(gathering.id).and(bookMarkGathering.user.id.eq(userId)))
.leftJoin(category).on(category.id.eq(gathering.gatheringCategory.id))
.leftJoin(gatheringApplicants).on(gatheringApplicants.gathering.id.eq(gathering.id).and(gatheringApplicants.gatheringStatus.eq(GatheringStatus.CONSENT)))
.where(gathering.isFinish.eq(Boolean.FALSE)
Expand All @@ -261,7 +262,7 @@ public List<GatheringBriefResponse> getGatheringLikeCountFromCreatedIn3(Long use
gathering.viewCount,
bookMarkGathering.user.id.isNotNull(),
likeCount,
category.name,
gathering.gatheringCategory.name,
gathering.user.name,
gathering.scheduleStartDate,
gathering.scheduleEndDate,
Expand All @@ -280,7 +281,6 @@ private BooleanBuilder makeWhereSQL(GatheringPageRequest gatheringPageRequest) {
BooleanBuilder whereClause = new BooleanBuilder();

whereClause.and(gathering.isDeleted.eq(Boolean.FALSE));
// whereClause.and(gathering.deadline.after(LocalDateTime.now()));
if (Objects.nonNull(gatheringPageRequest.getCategory())) {
whereClause.and(gathering.gatheringCategory.id.eq(gatheringPageRequest.getCategory()));
}
Expand Down Expand Up @@ -308,6 +308,7 @@ private BooleanBuilder makeWhereSQL(GatheringPageRequest gatheringPageRequest) {

if (Objects.isNull(gatheringPageRequest.getIsExclude())) {
whereClause.and(gathering.isFinish.eq(Boolean.FALSE));
whereClause.and(gathering.deadline.after(LocalDateTime.now()));
}

if (Objects.nonNull(gatheringPageRequest.getSearch())) {
Expand Down

0 comments on commit 3171f3a

Please sign in to comment.