From cc55833b8abd77b6f4b66d2bfdb0885dfbd89f8b Mon Sep 17 00:00:00 2001 From: hyeonjaez Date: Sun, 22 Sep 2024 20:46:00 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A2=8B=EC=95=84=EC=9A=94=20=EC=88=98?= =?UTF-8?q?=20=EA=B5=AC=ED=95=98=EB=8A=94=20=EC=A0=88=20=EC=88=98=EC=A0=95?= =?UTF-8?q?=20Long=20->=20Integer=20=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../information/repository/InformationRepositoryImpl.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/solitour_backend/solitour/information/repository/InformationRepositoryImpl.java b/src/main/java/solitour_backend/solitour/information/repository/InformationRepositoryImpl.java index 8bdb852..49a38c4 100644 --- a/src/main/java/solitour_backend/solitour/information/repository/InformationRepositoryImpl.java +++ b/src/main/java/solitour_backend/solitour/information/repository/InformationRepositoryImpl.java @@ -249,14 +249,16 @@ private OrderSpecifier getOrderSpecifier(String sort, NumberPath inform return information.createdDate.desc(); } - private NumberExpression countGreatInformationByInformationById(NumberPath informationId) { + private NumberExpression countGreatInformationByInformationById(NumberPath informationId) { QGreatInformation greatInformationSub = QGreatInformation.greatInformation; JPQLQuery 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) {