Skip to content

Commit

Permalink
fix: 리뷰 조회 중복 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
korECM committed Nov 13, 2022
1 parent e59efbb commit c840d60
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/kotlin/zip/cafe/repository/ReviewRepository.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import zip.cafe.service.dto.ReviewSummary
fun ReviewRepository.findOneById(id: Long) = this.findByIdOrNull(id) ?: throw NoSuchElementException()

interface ReviewRepository : JpaRepository<Review, Long>, ReviewRepositoryCustom {
@Query("select distinct r from Review r left join fetch r._foodInfos left join fetch r._images left join fetch r._cafeKeywords join fetch r.footprint where r.id = :reviewId")
@Query("select distinct r from Review r left join fetch r._images join fetch r.footprint where r.id = :reviewId")
fun getReviewDetailById(@Param("reviewId") reviewId: Long): Review?

@Query("select new zip.cafe.service.dto.ReviewSummary(COUNT(r), COALESCE(AVG(r.finalScore), 0)) from Review r join r.footprint f where f.cafe.id = :cafeId")
Expand Down

0 comments on commit c840d60

Please sign in to comment.