AMERICA

package com.example.quanlyquancafedemo.model;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.annotations.OnDelete;
import org.hibernate.annotations.OnDeleteAction;
import org.springframework.data.annotation.CreatedDate;

import javax.annotation.processing.Generated;
import javax.persistence.*;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = “bill”)
public class Bill {
@Id
@GeneratedValue
private Long billId;

// @ManyToOne
// @JoinColumn(name = “employeeId”, nullable = false)
@ManyToOne
@JoinColumn(name = “employeeId”,nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private Employee employee;

@ManyToOne
@JoinColumn(name = “tableId”,nullable = false)
@OnDelete(action = OnDeleteAction.CASCADE)
@JsonIgnore
private Table table;

// @Temporal(TemporalType.TIMESTAMP)
@CreatedDate
private Date createDate;

@ManyToMany
@JoinTable(
name = “bill_food”,
joinColumns = @JoinColumn(name = “billId”),
inverseJoinColumns = @JoinColumn(name = “foodId”)
)
// @JsonProperty
private List listFood;

private float total;

public Long getBillId() {
return billId;
}

public Employee getEmployee() {
return employee;
}

public Table getTable() {
return table;
}

public Date getCreateDate() {
return createDate;
}

public List getListFood() {
return listFood;
}

public float getTotal() {
return total;
}

public void setBillId(Long billId) {
this.billId = billId;
}

public void setEmployee(Employee employee) {
this.employee = employee;
}

public void setTable(Table table) {
this.table = table;
}

public void setCreateDate(Date createDate) {
this.createDate = createDate;
}

public void setListFood(List listFood) {
this.listFood = listFood;
}

public void setTotal(float total) {
this.total = total;
}
}