diff --git a/src/main/java/com/pos/app/entities/CustomerTable.java b/src/main/java/com/pos/app/entities/CustomerTable.java new file mode 100644 index 0000000..a89cc9f --- /dev/null +++ b/src/main/java/com/pos/app/entities/CustomerTable.java @@ -0,0 +1,30 @@ +package com.pos.app.entities; + + +import jakarta.persistence.*; +import lombok.*; + +@EqualsAndHashCode(callSuper = true) +@Data +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "customer_table") +public class CustomerTable extends BaseEntity { + + @Column(name = "table_number") + private Integer tableNumber; + + @Column(name = "customer_name") + private String customerName; + + @JoinColumn(name = "merchant_id") + @ManyToOne + private Merchant merchant; + + @JoinColumn(name = "client_id") + @ManyToOne + private Client client; + +} diff --git a/src/main/java/com/pos/app/entities/Merchant.java b/src/main/java/com/pos/app/entities/Merchant.java new file mode 100644 index 0000000..fe98e3a --- /dev/null +++ b/src/main/java/com/pos/app/entities/Merchant.java @@ -0,0 +1,29 @@ +package com.pos.app.entities; + +import jakarta.persistence.*; +import lombok.*; + +@EqualsAndHashCode(callSuper = true) +@Data +@Entity +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Table(name = "merchant") +public class Merchant extends BaseEntity { + + @Column(name = "name") + private String name; + @Column(name = "address") + private String address; + @Column(name = "note") + private String note; + + @JoinColumn(name = "client_id") + @ManyToOne + private Client client; + + + + +} diff --git a/src/main/java/com/pos/app/entities/Order.java b/src/main/java/com/pos/app/entities/Order.java index 48e78a0..97ffd76 100644 --- a/src/main/java/com/pos/app/entities/Order.java +++ b/src/main/java/com/pos/app/entities/Order.java @@ -48,6 +48,10 @@ public class Order { @Column(name = "is_active") private Boolean isActive; + @JoinColumn(name = "customer_table") + @ManyToOne + private CustomerTable customerTable; + @PrePersist public void prePersist() { if (this.id == null) { diff --git a/src/main/resources/db/changelog/1.7.0_add_table_merchant_and_customer_table.xml b/src/main/resources/db/changelog/1.7.0_add_table_merchant_and_customer_table.xml new file mode 100644 index 0000000..b1edddf --- /dev/null +++ b/src/main/resources/db/changelog/1.7.0_add_table_merchant_and_customer_table.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/db/changelog/changelog-master.xml b/src/main/resources/db/changelog/changelog-master.xml index 258f9dc..16716f5 100644 --- a/src/main/resources/db/changelog/changelog-master.xml +++ b/src/main/resources/db/changelog/changelog-master.xml @@ -29,4 +29,5 @@ + \ No newline at end of file