diff --git a/src/main/java/com/livable/server/entity/Review.java b/src/main/java/com/livable/server/entity/Review.java index eba4ef63..789b1175 100644 --- a/src/main/java/com/livable/server/entity/Review.java +++ b/src/main/java/com/livable/server/entity/Review.java @@ -29,6 +29,7 @@ classes = @ConstructorResult( targetClass = Projection.AllReviewDetailDTO.class, columns = { + @ColumnResult(name = "reviewId", type = Long.class), @ColumnResult(name = "reviewTitle", type = String.class), @ColumnResult(name = "reviewTaste", type = String.class), @ColumnResult(name = "reviewDescription", type = String.class), diff --git a/src/main/java/com/livable/server/review/dto/Projection.java b/src/main/java/com/livable/server/review/dto/Projection.java index 258dd839..d756e1e3 100644 --- a/src/main/java/com/livable/server/review/dto/Projection.java +++ b/src/main/java/com/livable/server/review/dto/Projection.java @@ -55,6 +55,7 @@ public static class RestaurantReviewList { @AllArgsConstructor public static class AllReviewDetailDTO { + private Long reviewId; private String reviewTitle; private Evaluation reviewTaste; private String reviewDescription; @@ -63,8 +64,9 @@ public static class AllReviewDetailDTO { private String images; private String reviewType; - public AllReviewDetailDTO(String reviewTitle, String reviewTaste, String reviewDescription, String reviewCreatedAt, String location, String images, String reviewType) { + public AllReviewDetailDTO(Long reviewId, String reviewTitle, String reviewTaste, String reviewDescription, String reviewCreatedAt, String location, String images, String reviewType) { + this.reviewId = reviewId; this.reviewTitle = reviewTitle; this.reviewTaste = Objects.isNull(reviewTaste) ? null : Evaluation.valueOf(reviewTaste); this.reviewDescription = reviewDescription; diff --git a/src/main/java/com/livable/server/review/dto/ReviewResponse.java b/src/main/java/com/livable/server/review/dto/ReviewResponse.java index 70d7ca71..2149826e 100644 --- a/src/main/java/com/livable/server/review/dto/ReviewResponse.java +++ b/src/main/java/com/livable/server/review/dto/ReviewResponse.java @@ -29,6 +29,7 @@ public CalendarListDTO(Long reviewId, String type, String reviewImageUrl, LocalD @Builder public static class DetailListDTO { + private Long reviewId; private String reviewTitle; private Evaluation reviewTaste; private String reviewDescription; @@ -39,6 +40,7 @@ public static class DetailListDTO { public static DetailListDTO valueOf(Projection.AllReviewDetailDTO detailDTO, ImageSeparator imageSeparator) { return DetailListDTO.builder() + .reviewId(detailDTO.getReviewId()) .reviewTitle(detailDTO.getReviewTitle()) .reviewTaste(detailDTO.getReviewTaste()) .reviewDescription(detailDTO.getReviewDescription()) diff --git a/src/main/java/com/livable/server/review/repository/ReviewProjectionRepository.java b/src/main/java/com/livable/server/review/repository/ReviewProjectionRepository.java index a8ec8721..74feb80b 100644 --- a/src/main/java/com/livable/server/review/repository/ReviewProjectionRepository.java +++ b/src/main/java/com/livable/server/review/repository/ReviewProjectionRepository.java @@ -62,6 +62,7 @@ public class ReviewProjectionRepository { FIND_ALL_REVIEW_DETAIL_BETWEEN_DATE_QUERY = "SELECT * " + "FROM (" + "SELECT " + + "review.id as reviewId, " + "review.selected_dishes as reviewTitle, " + "restaurant_review.taste as reviewTaste, " + "review.description as reviewDescription, " + @@ -77,6 +78,7 @@ public class ReviewProjectionRepository { "GROUP BY review.id, review.member_id " + "UNION " + "SELECT " + + "review.id as reviewId, " + "review.selected_dishes as reviewTitle, " + "cafeteria_review.taste as reviewTaste, " + "review.description as reviewDescription, " + @@ -92,6 +94,7 @@ public class ReviewProjectionRepository { "GROUP BY review.id, review.member_id " + "UNION " + "SELECT " + + "review.id as reviewId, " + "review.selected_dishes as reviewTitle, " + "NULL as reviewTaste, " + "review.description as reviewDescription, " +