Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: bookMark 했는지 구하는 절 수정 #200

Merged
merged 1 commit into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading