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/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 19352f8..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 boolean 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.isDel(); + this.is_del = order.getIsDel(); + this.price = order.getTotal_price(); + this.thumbnail = order.getProject().getThumbnail(); + this.description = order.getProject().getDescription(); + } } 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/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(); } } 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에서 주문 개수를 고려하여 프로젝트 별 주문 개수의 합을 구하는 쿼리