Skip to content

Commit

Permalink
fix: bookMark 했는지 구하는 절 수정 (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
hyeonjaez authored Sep 22, 2024
1 parent 0da5cb5 commit f756a4d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public List<GatheringBriefResponse> getGatheringRecommend(Long gatheringId, Long
zoneCategoryParent.name,
zoneCategoryChild.name,
gathering.viewCount,
isGatheringBookmark(userId),
isGatheringBookmark(userId, gathering.id),
countGreatGatheringByGatheringById(gathering.id),
gathering.gatheringCategory.name,
gathering.user.nickname,
Expand Down Expand Up @@ -113,7 +113,7 @@ public Page<GatheringBriefResponse> getGatheringPageFilterAndOrder(Pageable page
zoneCategoryParent.name,
zoneCategoryChild.name,
gathering.viewCount,
isGatheringBookmark(userId),
isGatheringBookmark(userId, gathering.id),
countGreatGatheringByGatheringById(gathering.id),
gathering.gatheringCategory.name,
gathering.user.nickname,
Expand Down Expand Up @@ -229,7 +229,7 @@ public List<GatheringBriefResponse> getGatheringLikeCountFromCreatedIn3(Long use
zoneCategoryParent.name,
zoneCategoryChild.name,
gathering.viewCount,
isGatheringBookmark(userId),
isGatheringBookmark(userId, gathering.id),
countGreatGatheringByGatheringById(gathering.id),
gathering.gatheringCategory.name,
gathering.user.nickname,
Expand Down Expand Up @@ -327,11 +327,11 @@ private BooleanExpression isUserGreatGathering(Long userId) {
.otherwise(false);
}

private BooleanExpression isGatheringBookmark(Long userId) {
private BooleanExpression isGatheringBookmark(Long userId, NumberPath<Long> gatheringId) {
return new CaseBuilder()
.when(JPAExpressions.selectOne()
.from(bookMarkGathering)
.where(bookMarkGathering.gathering.id.eq(gathering.id)
.where(bookMarkGathering.gathering.id.eq(gatheringId)
.and(bookMarkGathering.user.id.eq(userId)))
.exists())
.then(true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public Page<InformationBriefResponse> getInformationPageFilterAndOrder(Pageable
zoneCategoryChild.name,
information.category.name,
information.viewCount,
isInformationBookmark(userId),
isInformationBookmark(userId, information.id),
image.address,
countGreatInformationByInformationById(information.id),
isUserGreatInformation(userId)
Expand Down Expand Up @@ -122,7 +122,7 @@ public List<InformationMainResponse> getInformationLikeCountFromCreatedIn3(Long
zoneCategoryChild.name,
category.parentCategory.name,
information.viewCount,
isInformationBookmark(userId),
isInformationBookmark(userId, information.id),
image.address,
countGreatInformationByInformationById(information.id), // 파라미터 전달
isUserGreatInformation(userId)
Expand All @@ -148,7 +148,7 @@ public List<InformationBriefResponse> getInformationRecommend(Long informationId
zoneCategoryChild.name,
information.category.name,
information.viewCount,
isInformationBookmark(userId),
isInformationBookmark(userId, information.id),
image.address,
countGreatInformationByInformationById(information.id),
isUserGreatInformation(userId)
Expand Down Expand Up @@ -272,11 +272,11 @@ private BooleanExpression isUserGreatInformation(Long userId) {
.otherwise(false);
}

private BooleanExpression isInformationBookmark(Long userId) {
private BooleanExpression isInformationBookmark(Long userId, NumberPath<Long> informationId) {
return new CaseBuilder()
.when(JPAExpressions.selectOne()
.from(bookMarkInformation)
.where(bookMarkInformation.information.id.eq(information.id)
.where(bookMarkInformation.information.id.eq(informationId)
.and(bookMarkInformation.user.id.eq(userId)))
.exists())
.then(true)
Expand Down

0 comments on commit f756a4d

Please sign in to comment.