-
Notifications
You must be signed in to change notification settings - Fork 199
/
Copy pathMenu.java
112 lines (88 loc) · 2.51 KB
/
Menu.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
package kitchenpos.menu.domain;
import jakarta.persistence.CascadeType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.ForeignKey;
import jakarta.persistence.Id;
import jakarta.persistence.JoinColumn;
import jakarta.persistence.ManyToOne;
import jakarta.persistence.OneToMany;
import jakarta.persistence.Table;
import jakarta.persistence.Transient;
import java.math.BigDecimal;
import java.util.List;
import java.util.UUID;
@Table(name = "menu")
@Entity
public class Menu {
@Column(name = "id", columnDefinition = "binary(16)")
@Id
private UUID id;
@Column(name = "name", nullable = false)
private String name;
@Column(name = "price", nullable = false)
private BigDecimal price;
@ManyToOne(optional = false)
@JoinColumn(
name = "menu_group_id",
columnDefinition = "binary(16)",
foreignKey = @ForeignKey(name = "fk_menu_to_menu_group")
)
private MenuGroup menuGroup;
@Column(name = "displayed", nullable = false)
private boolean displayed;
@OneToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE})
@JoinColumn(
name = "menu_id",
nullable = false,
columnDefinition = "binary(16)",
foreignKey = @ForeignKey(name = "fk_menu_product_to_menu")
)
private List<MenuProduct> menuProducts;
@Transient
private UUID menuGroupId;
public Menu() {
}
public UUID getId() {
return id;
}
public void setId(final UUID id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(final String name) {
this.name = name;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(final BigDecimal price) {
this.price = price;
}
public MenuGroup getMenuGroup() {
return menuGroup;
}
public void setMenuGroup(final MenuGroup menuGroup) {
this.menuGroup = menuGroup;
}
public boolean isDisplayed() {
return displayed;
}
public void setDisplayed(final boolean displayed) {
this.displayed = displayed;
}
public List<MenuProduct> getMenuProducts() {
return menuProducts;
}
public void setMenuProducts(final List<MenuProduct> menuProducts) {
this.menuProducts = menuProducts;
}
public UUID getMenuGroupId() {
return menuGroupId;
}
public void setMenuGroupId(final UUID menuGroupId) {
this.menuGroupId = menuGroupId;
}
}