From 36d536aa1e6bbed1aad6136ded9e2b6fd3862288 Mon Sep 17 00:00:00 2001 From: hyeonjaez Date: Mon, 23 Sep 2024 01:40:37 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20applicatns=20=EB=B6=80=EB=B6=84=20join?= =?UTF-8?q?=20->=20=EC=84=9C=EB=B8=8C=EC=BF=BC=EB=A6=AC=EB=A1=9C=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/GatheringRepositoryImpl.java | 33 ++++++++----------- 1 file changed, 13 insertions(+), 20 deletions(-) diff --git a/src/main/java/solitour_backend/solitour/gathering/repository/GatheringRepositoryImpl.java b/src/main/java/solitour_backend/solitour/gathering/repository/GatheringRepositoryImpl.java index 9080904..8d9c710 100644 --- a/src/main/java/solitour_backend/solitour/gathering/repository/GatheringRepositoryImpl.java +++ b/src/main/java/solitour_backend/solitour/gathering/repository/GatheringRepositoryImpl.java @@ -128,31 +128,24 @@ public Page getGatheringPageFilterAndOrder(Pageable page @Override public Page getPageGatheringByTag(Pageable pageable, - GatheringPageRequest gatheringPageRequest, Long userId, + GatheringPageRequest gatheringPageRequest, + Long userId, String decodedTag) { BooleanBuilder booleanBuilder = makeWhereSQL(gatheringPageRequest); + booleanBuilder.and(gatheringTag.tag.name.eq(decodedTag)); long total = from(gathering) - .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(gatheringApplicants).on(gatheringApplicants.gathering.id.eq(gathering.id)) - .leftJoin(gatheringTag) - .on(gatheringTag.gathering.id.eq(gathering.id).and(gatheringTag.tag.name.eq(decodedTag))) - .where(booleanBuilder.and(gatheringTag.tag.name.eq(decodedTag))) - .select(gathering.id.count()).fetchCount(); + .leftJoin(gatheringTag).on(gatheringTag.gathering.id.eq(gathering.id)) + .where(booleanBuilder) + .select(gathering.id.count()) + .fetchCount(); List content = from(gathering) .join(zoneCategoryChild).on(zoneCategoryChild.id.eq(gathering.zoneCategory.id)) .leftJoin(zoneCategoryParent).on(zoneCategoryParent.id.eq(zoneCategoryChild.parentZoneCategory.id)) - .leftJoin(bookMarkGathering) - .on(gatheringApplicants.gathering.id.eq(gathering.id).and(gatheringApplicants.gatheringStatus.eq(GatheringStatus.CONSENT))) - .leftJoin(gatheringApplicants).on(gatheringApplicants.gathering.id.eq(gathering.id).and(gatheringApplicants.gatheringStatus.eq(GatheringStatus.CONSENT))) - .leftJoin(gatheringTag) - .on(gatheringTag.gathering.id.eq(gathering.id).and(gatheringTag.tag.name.eq(decodedTag))) - .where(booleanBuilder.and(gatheringTag.tag.name.eq(decodedTag))) - .groupBy(gathering.id, zoneCategoryChild.id, zoneCategoryParent.id, category.id) + .leftJoin(gatheringTag).on(gatheringTag.gathering.id.eq(gathering.id)) + .where(booleanBuilder) + .groupBy(gathering.id, zoneCategoryChild.id, zoneCategoryParent.id) .orderBy(getOrderSpecifier(gatheringPageRequest.getSort(), gathering.id)) .select(Projections.constructor( GatheringBriefResponse.class, @@ -161,10 +154,10 @@ public Page getPageGatheringByTag(Pageable pageable, zoneCategoryParent.name, zoneCategoryChild.name, gathering.viewCount, - bookMarkGathering.user.id.isNotNull(), + isGatheringBookmark(userId, gathering.id), countGreatGatheringByGatheringById(gathering.id), gathering.gatheringCategory.name, - gathering.user.name, + gathering.user.nickname, gathering.scheduleStartDate, gathering.scheduleEndDate, gathering.deadline, @@ -172,7 +165,7 @@ public Page getPageGatheringByTag(Pageable pageable, gathering.startAge, gathering.endAge, gathering.personCount, - gatheringApplicants.count().coalesce(0L).intValue(), + applicantsCountNowConsent(gathering.id), isUserGreatGathering(userId) )) .offset(pageable.getOffset())