From 41dcd081452a46c0974389c41b730e634b169926 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Thu, 28 Dec 2023 19:28:41 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[feat]order=20isDel=20boolean->int=EB=A1=9C?= =?UTF-8?q?=20=EB=B3=80=EA=B2=BD#137?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/wowmarket/wow_server/domain/Orders.java | 5 +++-- .../mypage/myorder/controller/MyOrderController.java | 3 +++ .../mypage/myorder/dto/MyOrderFormResponseDto.java | 4 ++-- .../wow_server/mypage/myorder/service/MyOrderService.java | 4 ++-- .../myproject/MySalesOrder/service/MySalesOrderService.java | 4 ++-- .../java/wowmarket/wow_server/repository/ItemRepository.java | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/java/wowmarket/wow_server/domain/Orders.java b/src/main/java/wowmarket/wow_server/domain/Orders.java index 429f81f..60a4467 100644 --- a/src/main/java/wowmarket/wow_server/domain/Orders.java +++ b/src/main/java/wowmarket/wow_server/domain/Orders.java @@ -2,6 +2,7 @@ import jakarta.persistence.*; import lombok.*; +import org.hibernate.annotations.ColumnDefault; import java.time.LocalDateTime; @@ -35,9 +36,9 @@ public class Orders extends BaseEntity { @Setter private int order_status; - @Column(columnDefinition="tinyint(0) default 0") + @ColumnDefault("0") @Setter - private boolean isDel; + private int isDel; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "buyer_id", referencedColumnName = "user_id") diff --git a/src/main/java/wowmarket/wow_server/mypage/myorder/controller/MyOrderController.java b/src/main/java/wowmarket/wow_server/mypage/myorder/controller/MyOrderController.java index f0af824..c4f330e 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myorder/controller/MyOrderController.java +++ b/src/main/java/wowmarket/wow_server/mypage/myorder/controller/MyOrderController.java @@ -19,17 +19,20 @@ public class MyOrderController { private final MyOrderService myOrderService; + //나의 주문폼 목록 불러오기 @GetMapping() public MyOrderFormListResponseDto getMyOrderList(@RequestParam(value = "page", defaultValue = "1", required = false)int page, @AuthenticationPrincipal User user){ Pageable pageable = PageRequest.of(page - 1, 10); return myOrderService.findAllMyOrderForm(pageable, user); } + //나의 주문폼 상세 보기 @GetMapping("/detail/{order_id}") public MyOrderFormDetailResponseDto getMyDetailOrder(@PathVariable Long order_id){ return myOrderService.findMyOrderFormDetail(order_id); } + //나의 주문폼 취소하기 @DeleteMapping("/detail/{order_id}") public ResponseEntity deleteMyOrder(@PathVariable Long order_id){ return myOrderService.deleteMyOrderFormDetail(order_id); diff --git a/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormResponseDto.java b/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormResponseDto.java index 19352f8..26074b9 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormResponseDto.java +++ b/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormResponseDto.java @@ -14,13 +14,13 @@ public class MyOrderFormResponseDto { private String name; private LocalDateTime createdtime; private int status; - private boolean isdel; + private int isdel; public MyOrderFormResponseDto(Orders order){ this.orderId = order.getId(); this.name = order.getProject().getName(); this.createdtime = order.getCreated_time(); this.status = order.getOrder_status(); - this.isdel = order.isDel(); + this.isdel = order.getIsDel(); } } diff --git a/src/main/java/wowmarket/wow_server/mypage/myorder/service/MyOrderService.java b/src/main/java/wowmarket/wow_server/mypage/myorder/service/MyOrderService.java index 30c47fc..787b0c6 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myorder/service/MyOrderService.java +++ b/src/main/java/wowmarket/wow_server/mypage/myorder/service/MyOrderService.java @@ -54,8 +54,8 @@ public MyOrderFormDetailResponseDto findMyOrderFormDetail(Long order_id){ public ResponseEntity deleteMyOrderFormDetail(Long order_id){ Orders orders = orderRepository.findById(order_id) .orElseThrow(()->new ResponseStatusException(HttpStatus.BAD_REQUEST)); - if (orders.isDel() == false) - orders.setDel(true); + if (orders.getIsDel() == 0) + orders.setIsDel(1); return new ResponseEntity(HttpStatus.OK); } } diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesOrder/service/MySalesOrderService.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesOrder/service/MySalesOrderService.java index 243c7cb..d4e200a 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesOrder/service/MySalesOrderService.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesOrder/service/MySalesOrderService.java @@ -74,8 +74,8 @@ public MySalesOrderDetailResponseDto findMySalesOrderDetail(Long order_id){ public ResponseEntity deleteMySalesOrder(Long order_id){ Orders orders = orderRepository.findById(order_id) .orElseThrow(()->new ResponseStatusException(HttpStatus.BAD_REQUEST));; - if (orders.isDel() == false) - orders.setDel(true); + if (orders.getIsDel() == 0) + orders.setIsDel(1); return new ResponseEntity(HttpStatus.OK); } } diff --git a/src/main/java/wowmarket/wow_server/repository/ItemRepository.java b/src/main/java/wowmarket/wow_server/repository/ItemRepository.java index 3b165b4..e9c3260 100644 --- a/src/main/java/wowmarket/wow_server/repository/ItemRepository.java +++ b/src/main/java/wowmarket/wow_server/repository/ItemRepository.java @@ -17,7 +17,7 @@ public interface ItemRepository extends JpaRepository { @Query("SELECT COALESCE(SUM(od.count), 0) FROM OrderDetail od " + "WHERE od.item.project = :project " + - "AND od.orders.isDel = false") + "AND od.orders.isDel = 0") int getTotalOrderCountByProject(@Param("project") Project project); //OrderDetail이 아닌 Item에서 주문 개수를 고려하여 프로젝트 별 주문 개수의 합을 구하는 쿼리 From 12110b18270b7f6bde7e571d6aad52e9247a4ee7 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Thu, 28 Dec 2023 20:14:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[feat]=EB=82=98=EC=9D=98=20=EC=A3=BC?= =?UTF-8?q?=EB=AC=B8=ED=8F=BC=20=EC=83=81=EC=84=B8=EB=B3=B4=EA=B8=B0=20#13?= =?UTF-8?q?7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../myorder/dto/MyOrderFormDetailResponseDto.java | 14 ++++++++++++++ .../mypage/myorder/dto/MyOrderFormResponseDto.java | 11 +++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormDetailResponseDto.java b/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormDetailResponseDto.java index af261c1..b7a3499 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormDetailResponseDto.java +++ b/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormDetailResponseDto.java @@ -27,6 +27,13 @@ public class MyOrderFormDetailResponseDto { private String buyer_account; private String buyer_account_name; private String deposittime; + private String project_name; + private String description; + private int total_price; + private String thumbnail; + private int status; + private int is_del; + private Long order_id; public MyOrderFormDetailResponseDto(List itemList, Orders orders, String address){ this.itemList = itemList; @@ -43,6 +50,13 @@ public MyOrderFormDetailResponseDto(List itemList, Orders this.buyer_account = orders.getAccount(); this.buyer_account_name = orders.getDepositor(); this.deposittime = orders.getDepositTime(); + this.project_name = orders.getProject().getName(); + this.description = orders.getProject().getDescription(); + this.total_price = orders.getTotal_price(); + this.thumbnail = orders.getProject().getThumbnail(); + this.status = orders.getOrder_status(); + this.is_del = orders.getIsDel(); + this.order_id = orders.getId(); } } diff --git a/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormResponseDto.java b/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormResponseDto.java index 26074b9..f0ed5ca 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormResponseDto.java +++ b/src/main/java/wowmarket/wow_server/mypage/myorder/dto/MyOrderFormResponseDto.java @@ -14,13 +14,20 @@ public class MyOrderFormResponseDto { private String name; private LocalDateTime createdtime; private int status; - private int isdel; + private int is_del; + private int price; + private String description; + private String thumbnail; public MyOrderFormResponseDto(Orders order){ this.orderId = order.getId(); this.name = order.getProject().getName(); this.createdtime = order.getCreated_time(); this.status = order.getOrder_status(); - this.isdel = order.getIsDel(); + this.is_del = order.getIsDel(); + this.price = order.getTotal_price(); + this.thumbnail = order.getProject().getThumbnail(); + this.description = order.getProject().getDescription(); + } } From dd37c72330dec68a2b719131b934ca1dd36657f8 Mon Sep 17 00:00:00 2001 From: yunji118 Date: Thu, 28 Dec 2023 20:43:38 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[feat]=EB=82=98=EC=9D=98=20=EC=A3=BC?= =?UTF-8?q?=EB=AC=B8=ED=8F=BC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MySalesProject/controller/MySalesProjectController.java | 2 ++ .../MySalesProject/dto/MySalesDetailResponseDto.java | 5 +++++ .../mypage/myproject/MySalesProject/dto/MySalesFormDto.java | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/controller/MySalesProjectController.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/controller/MySalesProjectController.java index 54515b3..0521778 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/controller/MySalesProjectController.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/controller/MySalesProjectController.java @@ -18,6 +18,7 @@ public class MySalesProjectController { private final MySalesProjectService mySalesProjectService; + //판매 등록폼 전체보기 @GetMapping() public MySalesListResponseDto getMySalesList(@RequestParam(value = "page", defaultValue = "1", required = false)int page, @AuthenticationPrincipal User user){ Pageable pageable = PageRequest.of(page - 1, 10); @@ -29,6 +30,7 @@ public ResponseEntity finishMySales(@PathVariable Long project_id){ return mySalesProjectService.finishMySalesForm(project_id); } + //판매 등록폼 상세보기 @GetMapping("/detail/{project_id}") public MySalesDetailResponseDto getMySalesDetail(@PathVariable Long project_id){ return mySalesProjectService.findMySalesDetail(project_id); diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java index d762ea6..8fa8e62 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesDetailResponseDto.java @@ -26,6 +26,11 @@ public class MySalesDetailResponseDto { private String seller_account; private String seller_account_name; private String seller_nickname; + private Long delivery_fee; + private String seller_phone_number; + private String seller_email; + private String seller_etc; + public MySalesDetailResponseDto(Project project, List itemDtos){ this.projectId = project.getId(); diff --git a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesFormDto.java b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesFormDto.java index 01b939a..33cf86b 100644 --- a/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesFormDto.java +++ b/src/main/java/wowmarket/wow_server/mypage/myproject/MySalesProject/dto/MySalesFormDto.java @@ -14,11 +14,15 @@ public class MySalesFormDto { private String name; private LocalDateTime createdtime; private int status; + private String description; + private String thumbnail; public MySalesFormDto(Project project){ this.id = project.getId(); this.name = project.getName(); this.createdtime = project.getCreated_time(); this.status = (project.isEnd() == false? 0 : 1); + this.description = project.getDescription(); + this.thumbnail = project.getThumbnail(); } }