From 6b1192eebd69ddd733266d8973d3dd0eac556064 Mon Sep 17 00:00:00 2001 From: sojungpp Date: Sat, 21 Oct 2023 23:35:10 +0900 Subject: [PATCH] =?UTF-8?q?#184=20fix:=20=EC=83=81=ED=92=88=20=EB=A9=94?= =?UTF-8?q?=EC=9D=B8=20=EC=A1=B0=ED=9A=8C=20=EB=A6=AC=EB=B7=B0=20=ED=8F=89?= =?UTF-8?q?=EA=B7=A0=20=EB=B3=84=EC=A0=90=20=EC=86=8C=EC=88=98=EC=A0=90=20?= =?UTF-8?q?1=EC=9E=90=EB=A6=AC=EA=B9=8C=EC=A7=80=20=EB=82=98=ED=83=80?= =?UTF-8?q?=EB=82=B4=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/psr/psr/product/repository/ProductRepositoryImpl.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/psr/psr/product/repository/ProductRepositoryImpl.kt b/src/main/kotlin/com/psr/psr/product/repository/ProductRepositoryImpl.kt index 3632b39..14444d4 100644 --- a/src/main/kotlin/com/psr/psr/product/repository/ProductRepositoryImpl.kt +++ b/src/main/kotlin/com/psr/psr/product/repository/ProductRepositoryImpl.kt @@ -13,6 +13,7 @@ import com.psr.psr.user.entity.Category import com.psr.psr.user.entity.User import com.querydsl.core.types.ExpressionUtils import com.querydsl.core.types.dsl.Expressions +import com.querydsl.core.types.dsl.MathExpressions import com.querydsl.jpa.JPAExpressions import com.querydsl.jpa.impl.JPAQueryFactory import org.springframework.data.domain.Page @@ -35,7 +36,7 @@ class ProductRepositoryImpl( product.price, ExpressionUtils.`as`(product.likeNum.size(), "numOfLike"), Expressions.asBoolean(JPAExpressions.selectFrom(productLike).where(productLike.user.eq(target).and(productLike.product.eq(product)).and(productLike.status.eq(ACTIVE_STATUS))).exists()), - ExpressionUtils.`as`(JPAExpressions.select(review.rating.avg()).from(review).where(review.product.eq(product).and(review.status.eq(ACTIVE_STATUS))), "avgOfRating"), + ExpressionUtils.`as`(JPAExpressions.select(MathExpressions.round(review.rating.avg(),1)).from(review).where(review.product.eq(product).and(review.status.eq(ACTIVE_STATUS))), "avgOfRating"), ExpressionUtils.`as`(product.reviews.size(), "numOfReview") )) .from(product)