[4d7e387] | 1 | package com.example.salonbella.entity;
|
---|
| 2 |
|
---|
| 3 | import com.example.salonbella.service.order.OrderDetail;
|
---|
| 4 |
|
---|
| 5 | import javax.persistence.*;
|
---|
| 6 | import java.time.LocalDate;
|
---|
| 7 | import java.util.ArrayList;
|
---|
| 8 | import java.util.List;
|
---|
| 9 |
|
---|
| 10 | @Entity
|
---|
| 11 | @Table(name = "orders")
|
---|
| 12 | public class OrderEntity {
|
---|
| 13 |
|
---|
| 14 | @Id
|
---|
| 15 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
| 16 | private Long id;
|
---|
| 17 |
|
---|
| 18 | @OneToMany(cascade = CascadeType.ALL)
|
---|
| 19 | private List<CartDetailEntity> cartDetailEntities = new ArrayList<>();
|
---|
| 20 |
|
---|
| 21 | @Column(name = "status", nullable = false, length = 30)
|
---|
| 22 | private String status;
|
---|
| 23 |
|
---|
| 24 | @Column(name = "date", nullable = false, length = 30)
|
---|
| 25 | private LocalDate localDate;
|
---|
| 26 |
|
---|
| 27 | @Column(name = "total_price", nullable = false)
|
---|
| 28 | private double total;
|
---|
| 29 |
|
---|
| 30 | @ManyToOne
|
---|
| 31 | @JoinColumn(name = "user_id", nullable = false)
|
---|
| 32 | private UserEntity user;
|
---|
| 33 |
|
---|
| 34 | @Transient
|
---|
| 35 | private List<OrderDetail> orderDetails = new ArrayList<>();
|
---|
| 36 |
|
---|
| 37 | public Long getId() {
|
---|
| 38 | return id;
|
---|
| 39 | }
|
---|
| 40 |
|
---|
| 41 | public void setId(Long id) {
|
---|
| 42 | this.id = id;
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | public List<CartDetailEntity> getCartDetails() {
|
---|
| 46 | return cartDetailEntities;
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | public List<OrderDetail> getOrderDetails() {
|
---|
| 50 | return orderDetails;
|
---|
| 51 | }
|
---|
| 52 |
|
---|
| 53 | public void setOrderDetails(List<OrderDetail> orderDetails) {
|
---|
| 54 | this.orderDetails = orderDetails;
|
---|
| 55 | }
|
---|
| 56 |
|
---|
| 57 | public void setCartDetails(List<CartDetailEntity> cartDetailEntities) {
|
---|
| 58 | this.cartDetailEntities = cartDetailEntities;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | public String getStatus() {
|
---|
| 62 | return status;
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | public void setStatus(String status) {
|
---|
| 66 | this.status = status;
|
---|
| 67 | }
|
---|
| 68 |
|
---|
| 69 | public LocalDate getLocalDate() {
|
---|
| 70 | return localDate;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 | public void setLocalDate(LocalDate localDate) {
|
---|
| 74 | this.localDate = localDate;
|
---|
| 75 | }
|
---|
| 76 |
|
---|
| 77 | public double getTotal() {
|
---|
| 78 | return total;
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | public void setTotal(double total) {
|
---|
| 82 | this.total = total;
|
---|
| 83 | }
|
---|
| 84 |
|
---|
| 85 | public UserEntity getUser() {
|
---|
| 86 | return user;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | public void setUser(UserEntity user) {
|
---|
| 90 | this.user = user;
|
---|
| 91 | }
|
---|
| 92 | }
|
---|