-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from 1223v/test
Feat: 쿠폰 및 쿠폰 메뉴, 이벤트 엔티티 추가
- Loading branch information
Showing
6 changed files
with
206 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
src/main/java/com/readyvery/readyverydemo/domain/Coupon.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Table(name = "COUPON") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Slf4j | ||
public class Coupon extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "coupon_idx") | ||
private Long id; | ||
|
||
// 사용 여부 | ||
@Column(name = "used") | ||
private boolean isUsed; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "coupon_detail_idx") | ||
private CouponDetail couponDetail; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "user_idx") | ||
private UserInfo userInfo; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "store_idx") | ||
private Store store; | ||
|
||
// @OneToOne(mappedBy = "coupon", fetch = LAZY) | ||
// private Order order; | ||
|
||
} |
65 changes: 65 additions & 0 deletions
65
src/main/java/com/readyvery/readyverydemo/domain/CouponDetail.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import java.time.LocalDateTime; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import jakarta.persistence.CascadeType; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Table(name = "COUPONDETAIL") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Slf4j | ||
public class CouponDetail extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "coupon_detail_idx") | ||
private Long id; | ||
|
||
// 할인 가격 | ||
@Column | ||
private Long salePrice; | ||
|
||
// 쿠폰 이름 | ||
@Column | ||
private String name; | ||
|
||
// 만료일 | ||
@Column | ||
private LocalDateTime expire; | ||
|
||
// 발행처 레디베리 발행(0) / 사장님 발행(ceo_idx) | ||
@Column | ||
private Long publisher; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "event_idx") | ||
private Event event; | ||
|
||
@Builder.Default | ||
@OneToMany(mappedBy = "couponDetail", cascade = CascadeType.ALL) | ||
private List<CouponMenu> couponMenus = new ArrayList<CouponMenu>(); | ||
|
||
@Builder.Default | ||
@OneToMany(mappedBy = "couponDetail", cascade = CascadeType.ALL) | ||
private List<Coupon> coupons = new ArrayList<Coupon>(); | ||
|
||
} |
39 changes: 39 additions & 0 deletions
39
src/main/java/com/readyvery/readyverydemo/domain/CouponMenu.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.FetchType; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.JoinColumn; | ||
import jakarta.persistence.ManyToOne; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Table(name = "COUPONMENU") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Slf4j | ||
public class CouponMenu extends BaseTimeEntity { | ||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "coupon_menu_idx") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "coupon_detail_idx") | ||
private CouponDetail couponDetail; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "foodie_idx") | ||
private Foodie foodie; | ||
|
||
} |
46 changes: 46 additions & 0 deletions
46
src/main/java/com/readyvery/readyverydemo/domain/Event.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.readyvery.readyverydemo.domain; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import jakarta.persistence.CascadeType; | ||
import jakarta.persistence.Column; | ||
import jakarta.persistence.Entity; | ||
import jakarta.persistence.GeneratedValue; | ||
import jakarta.persistence.GenerationType; | ||
import jakarta.persistence.Id; | ||
import jakarta.persistence.OneToMany; | ||
import jakarta.persistence.Table; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Getter | ||
@Entity | ||
@Builder | ||
@Table(name = "EVENT") | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Slf4j | ||
public class Event extends BaseTimeEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "event_idx") | ||
private Long id; | ||
|
||
// 이벤트 베너 이미지 url | ||
@Column(name = "banner_img") | ||
private String bannerImg; | ||
|
||
// 이벤트 메인 이미지 url | ||
@Column(name = "main_img") | ||
private String mainImg; | ||
|
||
@Builder.Default | ||
@OneToMany(mappedBy = "event", cascade = CascadeType.ALL) | ||
private List<CouponDetail> coupons = new ArrayList<CouponDetail>(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters