From b8d4f55d564a4c5a9b384ddf479ce934302ad217 Mon Sep 17 00:00:00 2001 From: haroya01 Date: Sun, 24 Sep 2023 19:24:43 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20?= =?UTF-8?q?=EA=B2=80=EC=83=89=ED=9B=84=20=EB=B0=98=ED=99=98=20dto=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AuctionItemSearchController.java | 22 +++++++++---------- .../AuctionItemRepositoryCustomImpl.java | 6 ++--- .../auctionItem/dto/AuctionItemFirstView.java | 7 ++++-- .../SearchAuctionItemSortedRequest.java | 4 ++-- src/main/resources/application-postgresql.yml | 2 +- 5 files changed, 22 insertions(+), 19 deletions(-) diff --git a/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/controller/AuctionItemSearchController.java b/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/controller/AuctionItemSearchController.java index 6f48543..fc1845c 100644 --- a/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/controller/AuctionItemSearchController.java +++ b/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/controller/AuctionItemSearchController.java @@ -20,16 +20,16 @@ @RequiredArgsConstructor public class AuctionItemSearchController { - private final AuctionItemService auctionItemService; - private final AuctionItemRepository AuctionItemRepository; - private final AuctionItemSearchService auctionItemSearchService; + private final AuctionItemService auctionItemService; + private final AuctionItemRepository AuctionItemRepository; + private final AuctionItemSearchService auctionItemSearchService; - @Operation(summary = "Search AuctionItem", description = "경매품 검색하기") - @GetMapping("") - public ResponseEntity findItemCategory( - @ModelAttribute SearchAuctionItemSortedRequest searchAuctionItemSortedRequest) { - AuctionItemSearchResponse result = - this.auctionItemSearchService.findAuctionItemByRequest(searchAuctionItemSortedRequest); - return ResponseEntity.ok(result); - } + @Operation(summary = "Search AuctionItem", description = "경매품 검색하기") + @GetMapping("") + public ResponseEntity findItemCategory( + @ModelAttribute SearchAuctionItemSortedRequest searchAuctionItemSortedRequest) { + AuctionItemSearchResponse result = + this.auctionItemSearchService.findAuctionItemByRequest(searchAuctionItemSortedRequest); + return ResponseEntity.ok(result); + } } diff --git a/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/domain/repostiory/AuctionItemRepositoryCustomImpl.java b/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/domain/repostiory/AuctionItemRepositoryCustomImpl.java index 7500e31..c24031d 100644 --- a/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/domain/repostiory/AuctionItemRepositoryCustomImpl.java +++ b/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/domain/repostiory/AuctionItemRepositoryCustomImpl.java @@ -61,9 +61,9 @@ public AuctionItemSearchResponse searchAuctionItemPage(SearchAuctionItemSortedRe keywordStatus, sellBuilder); - if (searchAuctionItemSortedRequest.getNick_name() != null) { - query.where(auctionItem.user.nickname.in(searchAuctionItemSortedRequest.getNick_name())); - } +// if (searchAuctionItemSortedRequest.getNick_name() != null) { +// query.where(auctionItem.user.nickname.in(searchAuctionItemSortedRequest.getNick_name())); +// } Long page = searchAuctionItemSortedRequest.getPage(); int itemsPerPage = 10; diff --git a/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/dto/AuctionItemFirstView.java b/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/dto/AuctionItemFirstView.java index 90f86c1..0f16562 100644 --- a/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/dto/AuctionItemFirstView.java +++ b/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/dto/AuctionItemFirstView.java @@ -20,7 +20,7 @@ public class AuctionItemFirstView { private Long id; - private String nickname; +// private String nickname; private String name; @@ -42,17 +42,20 @@ public class AuctionItemFirstView { private String image_url; + private Long comment_count; + @Builder public static AuctionItemFirstView of(AuctionItem auctionItem, Image image) { return AuctionItemFirstView.builder() .id(auctionItem.getId()) - .nickname(auctionItem.getUser().getNickname()) +// .nickname(auctionItem.getUser().getNickname()) .name(auctionItem.getName()) .address(auctionItem.getUser().getAddress()) .like_count(auctionItem.getLike_count()) .view_count(auctionItem.getView_count()) .price(auctionItem.getPrice()) .closedTime(auctionItem.getClosedTime()) + .comment_count(auctionItem.getComment_count()) // .auctionItemStatus(auctionItem.getItemStatus()) .status(auctionItem.getStatus()) .now_price(20000L) diff --git a/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/dto/SearchItem/SearchAuctionItemSortedRequest.java b/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/dto/SearchItem/SearchAuctionItemSortedRequest.java index 0435626..29449e0 100644 --- a/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/dto/SearchItem/SearchAuctionItemSortedRequest.java +++ b/src/main/java/megabrain/gyeongnamgyeongmae/domain/auctionItem/dto/SearchItem/SearchAuctionItemSortedRequest.java @@ -68,9 +68,9 @@ public void applySearchCategory(BooleanBuilder status, QAuctionItem item) { public void applySearchPrice(List> order, QAuctionItem item) { if (this.search_price) { - order.add(item.price.desc()); - } else { order.add(item.price.asc()); + } else { + order.add(item.price.desc()); } } diff --git a/src/main/resources/application-postgresql.yml b/src/main/resources/application-postgresql.yml index 0049141..781bbe0 100644 --- a/src/main/resources/application-postgresql.yml +++ b/src/main/resources/application-postgresql.yml @@ -9,7 +9,7 @@ spring: database: postgresql generate-ddl: true hibernate: - ddlAuto: create + ddlAuto: update properties: hibernate.jdbc.batch_size: 20 hibernate.cache.use_query_cache: false