Skip to content

Commit

Permalink
Merge pull request #199 from TripInfoWeb/fix/information_gathering_li…
Browse files Browse the repository at this point in the history
…keCount

fix: 좋아요 수 구하는 절 수정 Long -> Integer 로 수정
  • Loading branch information
hyeonjaez authored Sep 22, 2024
2 parents d283fe7 + cc55833 commit 5d5d889
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,16 @@ private OrderSpecifier<?> getOrderSpecifier(String sort, NumberPath<Long> inform
return information.createdDate.desc();
}

private NumberExpression<Long> countGreatInformationByInformationById(NumberPath<Long> informationId) {
private NumberExpression<Integer> countGreatInformationByInformationById(NumberPath<Long> informationId) {
QGreatInformation greatInformationSub = QGreatInformation.greatInformation;
JPQLQuery<Long> likeCountSubQuery = JPAExpressions
.select(greatInformationSub.count())
.from(greatInformationSub)
.where(greatInformationSub.information.id.eq(informationId)); // 파라미터로 받은 NumberPath와 비교

return Expressions.asNumber(likeCountSubQuery).longValue(); // 명확하게 Long 타입 반환
return Expressions.numberTemplate(Long.class, "{0}", likeCountSubQuery)
.coalesce(0L)
.intValue();
}

private BooleanExpression isUserGreatInformation(Long userId) {
Expand Down

0 comments on commit 5d5d889

Please sign in to comment.