From fdaf3c38c63a66044d8849009df8b750381529a5 Mon Sep 17 00:00:00 2001 From: kimdongmin Date: Thu, 25 Jan 2024 02:38:36 +0900 Subject: [PATCH] =?UTF-8?q?[refactor]=20=EC=97=AC=ED=96=89=EC=A7=80=20?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0,=20=EC=97=AC=ED=96=89=20=ED=9B=84=EA=B8=B0?= =?UTF-8?q?=20=EB=A6=AC=EB=B7=B0=20=EC=BD=94=EB=93=9C=20import=20=EB=AC=B8?= =?UTF-8?q?=20=EC=A0=95=EB=A6=AC=20=EB=B0=8F=20=EC=BD=94=EB=93=9C=20?= =?UTF-8?q?=EC=A0=95=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PlaceReviewController.java | 3 --- .../dto/response/PlaceReviewListResponseDto.java | 1 - .../review/placereview/entity/PlaceReview.java | 2 +- .../entity/TripRecordReview.java | 2 +- .../repository/TripRecordReviewRepository.java | 16 ++++++++-------- 5 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/controller/PlaceReviewController.java b/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/controller/PlaceReviewController.java index 880bfa6a..6cabddfa 100644 --- a/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/controller/PlaceReviewController.java +++ b/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/controller/PlaceReviewController.java @@ -1,8 +1,5 @@ package com.haejwo.tripcometrue.domain.review.placereview.controller; -import static org.springframework.http.HttpStatus.CREATED; -import static org.springframework.http.HttpStatus.MULTI_STATUS; - import com.haejwo.tripcometrue.domain.review.placereview.dto.request.DeletePlaceReviewRequestDto; import com.haejwo.tripcometrue.domain.review.placereview.dto.request.PlaceReviewRequestDto; import com.haejwo.tripcometrue.domain.review.placereview.dto.response.PlaceReviewListResponseDto; diff --git a/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/dto/response/PlaceReviewListResponseDto.java b/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/dto/response/PlaceReviewListResponseDto.java index 7602abcf..df42fdaa 100644 --- a/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/dto/response/PlaceReviewListResponseDto.java +++ b/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/dto/response/PlaceReviewListResponseDto.java @@ -1,6 +1,5 @@ package com.haejwo.tripcometrue.domain.review.placereview.dto.response; -import com.fasterxml.jackson.annotation.JsonFormat; import com.haejwo.tripcometrue.domain.review.placereview.entity.PlaceReview; import org.springframework.data.domain.Page; diff --git a/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/entity/PlaceReview.java b/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/entity/PlaceReview.java index e893a3bb..b710fae5 100644 --- a/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/entity/PlaceReview.java +++ b/src/main/java/com/haejwo/tripcometrue/domain/review/placereview/entity/PlaceReview.java @@ -16,7 +16,7 @@ import static com.haejwo.tripcometrue.domain.review.global.PointType.ONLY_ONE_POINT; import static com.haejwo.tripcometrue.domain.review.global.PointType.TWO_POINTS; -import static jakarta.persistence.CascadeType.*; +import static jakarta.persistence.CascadeType.REMOVE; import static jakarta.persistence.FetchType.LAZY; @Getter diff --git a/src/main/java/com/haejwo/tripcometrue/domain/review/triprecordreview/entity/TripRecordReview.java b/src/main/java/com/haejwo/tripcometrue/domain/review/triprecordreview/entity/TripRecordReview.java index b4e67339..846ee42f 100644 --- a/src/main/java/com/haejwo/tripcometrue/domain/review/triprecordreview/entity/TripRecordReview.java +++ b/src/main/java/com/haejwo/tripcometrue/domain/review/triprecordreview/entity/TripRecordReview.java @@ -18,7 +18,7 @@ import static com.haejwo.tripcometrue.domain.review.global.PointType.ONLY_ONE_POINT; import static com.haejwo.tripcometrue.domain.review.global.PointType.TWO_POINTS; -import static jakarta.persistence.CascadeType.*; +import static jakarta.persistence.CascadeType.REMOVE; @Getter @Entity diff --git a/src/main/java/com/haejwo/tripcometrue/domain/review/triprecordreview/repository/TripRecordReviewRepository.java b/src/main/java/com/haejwo/tripcometrue/domain/review/triprecordreview/repository/TripRecordReviewRepository.java index d53fb17b..da3da156 100644 --- a/src/main/java/com/haejwo/tripcometrue/domain/review/triprecordreview/repository/TripRecordReviewRepository.java +++ b/src/main/java/com/haejwo/tripcometrue/domain/review/triprecordreview/repository/TripRecordReviewRepository.java @@ -15,16 +15,16 @@ @Repository public interface TripRecordReviewRepository extends JpaRepository, TripRecordReviewRepositoryCustom { - @Query("select trr from TripRecordReview trr join fetch trr.member m where trr.member = :member and trr.content is not null order by trr.createdAt desc") - Page findByMember(@Param("member") Member member, Pageable pageable); + @Query("select trr from TripRecordReview trr join fetch trr.member m where trr.member = :member and trr.content is not null order by trr.createdAt desc") + Page findByMember(@Param("member") Member member, Pageable pageable); - @Query("select trr.ratingScore from TripRecordReview trr where trr.member = :member and trr.tripRecord.id = :tripRecordId") - Optional findMyScoreByMemberAndTripRecordId(@Param("member") Member member, @Param("tripRecordId") Long tripRecordId); + @Query("select trr.ratingScore from TripRecordReview trr where trr.member = :member and trr.tripRecord.id = :tripRecordId") + Optional findMyScoreByMemberAndTripRecordId(@Param("member") Member member, @Param("tripRecordId") Long tripRecordId); - @Query("select trr from TripRecordReview trr where trr.tripRecord.id = :tripRecordId and trr.content is not null order by trr.createdAt desc limit 1") - Optional findTopByTripRecordIdOrderByCreatedAtDesc(@Param("tripRecordId") Long tripRecordId); + @Query("select trr from TripRecordReview trr where trr.tripRecord.id = :tripRecordId and trr.content is not null order by trr.createdAt desc limit 1") + Optional findTopByTripRecordIdOrderByCreatedAtDesc(@Param("tripRecordId") Long tripRecordId); - boolean existsByMemberAndTripRecord(Member member, TripRecord tripRecord); + boolean existsByMemberAndTripRecord(Member member, TripRecord tripRecord); - Long countByTripRecordId(Long tripRecordId); + Long countByTripRecordId(Long tripRecordId); }