From 7bd2acccf778b424bb706c6d3a050ddc23330a70 Mon Sep 17 00:00:00 2001 From: Kim Seung-yeop Date: Mon, 12 Aug 2024 17:11:52 +0900 Subject: [PATCH] =?UTF-8?q?SCRUM-45=20feat:=20order=20=EC=97=B0=EA=B4=80?= =?UTF-8?q?=EA=B4=80=EA=B3=84=20=EB=A7=A4=ED=95=91=20=EC=99=84=EB=A3=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/kakaoteck/golagola/domain/order/entity/Order.java | 5 +++++ .../golagola/domain/orderProduct/entity/OrderProduct.java | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/src/main/java/com/kakaoteck/golagola/domain/order/entity/Order.java b/src/main/java/com/kakaoteck/golagola/domain/order/entity/Order.java index 55fafb4..1a5b297 100644 --- a/src/main/java/com/kakaoteck/golagola/domain/order/entity/Order.java +++ b/src/main/java/com/kakaoteck/golagola/domain/order/entity/Order.java @@ -1,6 +1,7 @@ package com.kakaoteck.golagola.domain.order.entity; import com.kakaoteck.golagola.domain.buyer.entity.Buyer; +import com.kakaoteck.golagola.domain.orderProduct.entity.OrderProduct; import com.kakaoteck.golagola.domain.seller.entity.Seller; import com.kakaoteck.golagola.global.common.BaseEntity; import com.kakaoteck.golagola.global.common.enums.OrderStatus; @@ -11,6 +12,7 @@ import lombok.NoArgsConstructor; import java.time.LocalDate; +import java.util.List; @Entity @NoArgsConstructor @@ -32,6 +34,9 @@ public class Order extends BaseEntity { @JoinColumn(name = "buyer_id") private Buyer buyer; + @OneToMany(mappedBy = "order", cascade = CascadeType.ALL) + private List orderProductList; + private boolean isPay; private LocalDate paymentDate; private String orderAddress; diff --git a/src/main/java/com/kakaoteck/golagola/domain/orderProduct/entity/OrderProduct.java b/src/main/java/com/kakaoteck/golagola/domain/orderProduct/entity/OrderProduct.java index 0efa3f1..43591b6 100644 --- a/src/main/java/com/kakaoteck/golagola/domain/orderProduct/entity/OrderProduct.java +++ b/src/main/java/com/kakaoteck/golagola/domain/orderProduct/entity/OrderProduct.java @@ -1,5 +1,6 @@ package com.kakaoteck.golagola.domain.orderProduct.entity; +import com.kakaoteck.golagola.domain.order.entity.Order; import com.kakaoteck.golagola.domain.product.entity.Product; import com.kakaoteck.golagola.domain.review.entity.Review; import jakarta.persistence.*; @@ -24,6 +25,10 @@ public class OrderProduct { @JoinColumn(name = "product_id") private Product product; + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "order_id") + private Order order; + @OneToOne(mappedBy = "orderProduct", cascade = CascadeType.ALL) private Review review;