Skip to content

Commit

Permalink
[refactor] 여행지 리뷰, 여행 후기 리뷰 코드 import 문 정리 및 코드 정리
Browse files Browse the repository at this point in the history
  • Loading branch information
meena2003 committed Jan 25, 2024
1 parent 73728bd commit fdaf3c3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
@Repository
public interface TripRecordReviewRepository extends JpaRepository<TripRecordReview, Long>, 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<TripRecordReview> 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<TripRecordReview> findByMember(@Param("member") Member member, Pageable pageable);

@Query("select trr.ratingScore from TripRecordReview trr where trr.member = :member and trr.tripRecord.id = :tripRecordId")
Optional<Float> 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<Float> 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<TripRecordReview> 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<TripRecordReview> 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);
}

0 comments on commit fdaf3c3

Please sign in to comment.