From 454fa47e6c6c2bb76fc404b8a8062dfe4a5cb0fa Mon Sep 17 00:00:00 2001 From: marinesnow34 Date: Fri, 24 Nov 2023 22:47:46 +0900 Subject: [PATCH] =?UTF-8?q?Feat:=20coupon=20domain=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/readyvery/readyverydemo/domain/Cart.java | 1 + .../readyverydemo/domain/CouponDetail.java | 16 ++++++++++++---- .../readyverydemo/domain/CouponMenu.java | 4 ---- .../readyvery/readyverydemo/domain/Foodie.java | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/readyvery/readyverydemo/domain/Cart.java b/src/main/java/com/readyvery/readyverydemo/domain/Cart.java index d3ac2d5..e1c444b 100644 --- a/src/main/java/com/readyvery/readyverydemo/domain/Cart.java +++ b/src/main/java/com/readyvery/readyverydemo/domain/Cart.java @@ -56,6 +56,7 @@ public class Cart extends BaseTimeEntity { @Builder.Default private Boolean isDeleted = false; + @Builder.Default @OneToMany(mappedBy = "cart") private List orders = new ArrayList(); diff --git a/src/main/java/com/readyvery/readyverydemo/domain/CouponDetail.java b/src/main/java/com/readyvery/readyverydemo/domain/CouponDetail.java index 2157f16..7fad25d 100644 --- a/src/main/java/com/readyvery/readyverydemo/domain/CouponDetail.java +++ b/src/main/java/com/readyvery/readyverydemo/domain/CouponDetail.java @@ -46,7 +46,15 @@ public class CouponDetail extends BaseTimeEntity { @Column private LocalDateTime expire; - // 발행처 레디베리 발행(0) / 사장님 발행(ceo_idx) + // 쿠폰 코드 + @Column(name = "coupon_code") + private String couponCode; + + // 발급 갯수 + @Column(name = "coupon_count") + private Long couponCount; + + // 발행처 레디베리 발행(0) / 사장님 발행(store_idx) @Column private Long publisher; @@ -54,9 +62,9 @@ public class CouponDetail extends BaseTimeEntity { @JoinColumn(name = "event_idx") private Event event; - @Builder.Default - @OneToMany(mappedBy = "couponDetail", cascade = CascadeType.ALL) - private List couponMenus = new ArrayList(); + @ManyToOne(fetch = FetchType.LAZY) + @JoinColumn(name = "foodie_idx") + private Foodie foodie; @Builder.Default @OneToMany(mappedBy = "couponDetail", cascade = CascadeType.ALL) diff --git a/src/main/java/com/readyvery/readyverydemo/domain/CouponMenu.java b/src/main/java/com/readyvery/readyverydemo/domain/CouponMenu.java index 53eddbb..cb0cfc3 100644 --- a/src/main/java/com/readyvery/readyverydemo/domain/CouponMenu.java +++ b/src/main/java/com/readyvery/readyverydemo/domain/CouponMenu.java @@ -32,8 +32,4 @@ public class CouponMenu extends BaseTimeEntity { @JoinColumn(name = "coupon_detail_idx") private CouponDetail couponDetail; - @ManyToOne(fetch = FetchType.LAZY) - @JoinColumn(name = "foodie_idx") - private Foodie foodie; - } diff --git a/src/main/java/com/readyvery/readyverydemo/domain/Foodie.java b/src/main/java/com/readyvery/readyverydemo/domain/Foodie.java index bfa78d7..6436b7f 100644 --- a/src/main/java/com/readyvery/readyverydemo/domain/Foodie.java +++ b/src/main/java/com/readyvery/readyverydemo/domain/Foodie.java @@ -76,7 +76,7 @@ public class Foodie extends BaseTimeEntity { private List cartItems = new ArrayList(); @OneToMany(mappedBy = "foodie", cascade = CascadeType.ALL) - private List couponMenus = new ArrayList(); + private List couponDetails = new ArrayList(); @OneToMany(mappedBy = "foodie", cascade = CascadeType.ALL) private List orderItems = new ArrayList();