-
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.
* feat: order, ticket 엔티티 정의 * feat: ticket 패키지 수정 * fix: order orphanRemoval 옵션 제거 * style: 포매터 적용
- Loading branch information
Showing
4 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
core/core-domain/src/main/java/com/pgms/coredomain/domain/event/Ticket.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,25 @@ | ||
package com.pgms.coredomain.domain.event; | ||
|
||
import com.pgms.coredomain.domain.common.BaseEntity; | ||
import com.pgms.coredomain.domain.order.Order; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Entity | ||
@Table(name = "ticket") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Ticket extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id") | ||
private Long id; | ||
|
||
@ManyToOne(fetch = FetchType.LAZY) | ||
@JoinColumn(name = "order_id", nullable = false, foreignKey = @ForeignKey(ConstraintMode.NO_CONSTRAINT)) | ||
private Order order; | ||
|
||
//TODO: 공연 좌석 매핑 | ||
} |
56 changes: 56 additions & 0 deletions
56
core/core-domain/src/main/java/com/pgms/coredomain/domain/order/Order.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,56 @@ | ||
package com.pgms.coredomain.domain.order; | ||
|
||
import com.pgms.coredomain.domain.event.Ticket; | ||
import com.pgms.coredomain.domain.common.BaseEntity; | ||
|
||
import jakarta.persistence.*; | ||
import lombok.AccessLevel; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
@Entity | ||
@Table(name = "order") | ||
@NoArgsConstructor(access = AccessLevel.PROTECTED) | ||
public class Order extends BaseEntity { | ||
|
||
@Id | ||
@GeneratedValue(strategy = GenerationType.IDENTITY) | ||
@Column(name = "id", nullable = false) | ||
private Long id; | ||
|
||
@Column(name = "order_name", nullable = false) | ||
private String orderName; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "status", nullable = false) | ||
private OrderStatus status; | ||
|
||
@Enumerated(EnumType.STRING) | ||
@Column(name = "receipt_type", nullable = false) | ||
private ReceiptType receiptType; | ||
|
||
@Column(name = "buyer_name", nullable = false) | ||
private String buyerName; | ||
|
||
@Column(name = "buyer_phone_number", nullable = false) | ||
private String buyerPhoneNumber; | ||
|
||
@Column(name = "street_address") | ||
private String streetAddress; | ||
|
||
@Column(name = "detail_address") | ||
private String detailAddress; | ||
|
||
@Column(name = "zip_code") | ||
private String zipCode; | ||
|
||
@Column(name = "amount", nullable = false) | ||
private int amount; | ||
|
||
@OneToMany(mappedBy = "order", cascade = CascadeType.ALL) | ||
private List<Ticket> tickets = new ArrayList<>(); | ||
|
||
//TODO: 회원 매핑 | ||
} |
14 changes: 14 additions & 0 deletions
14
core/core-domain/src/main/java/com/pgms/coredomain/domain/order/OrderStatus.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,14 @@ | ||
package com.pgms.coredomain.domain.order; | ||
|
||
public enum OrderStatus { | ||
|
||
WAITING_FOR_DEPOSIT("입금대기"), | ||
PAYMENT_COMPLETED("결제완료"), | ||
CANCELLED("취소"); | ||
|
||
private final String description; | ||
|
||
OrderStatus(String description) { | ||
this.description = description; | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
core/core-domain/src/main/java/com/pgms/coredomain/domain/order/ReceiptType.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,12 @@ | ||
package com.pgms.coredomain.domain.order; | ||
|
||
public enum ReceiptType { | ||
PICK_UP("현장수령"), | ||
DELIVERY("배송"); | ||
|
||
private final String description; | ||
|
||
ReceiptType(String description) { | ||
this.description = description; | ||
} | ||
} |