新增外键注释
This commit is contained in:
parent
a2bc716716
commit
251f379035
@ -1,9 +1,11 @@
|
||||
package com.example.springdemo.entities;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ -12,13 +14,18 @@ import java.util.Date;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity
|
||||
@Table(name = "Indent")
|
||||
public class Indent {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;//订单ID
|
||||
|
||||
private Float allPrice;//菜品总价
|
||||
Date createdDate;//订单创建时间
|
||||
@CreatedDate
|
||||
private Date createdDate;//订单创建时间
|
||||
private String message;//下单备注
|
||||
|
||||
@OneToOne
|
||||
private Users userID;//外键,下单用户ID
|
||||
@OneToOne
|
||||
private Merchants merchantsID;//外键,餐厅ID
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.example.springdemo.entities;
|
||||
|
||||
import jakarta.persistence.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
@ -10,13 +11,18 @@ import lombok.NoArgsConstructor;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Entity
|
||||
public class IndentItem {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;//主键,菜品ID
|
||||
private String name;//菜品名字
|
||||
@Column(name = "initialPrice")
|
||||
private Float initialPrice;//菜品原价
|
||||
private Float discount;//折扣
|
||||
@Column(name = "finalPrice")
|
||||
private Float finalPrice;//最终价格
|
||||
private String description;//菜品描述
|
||||
|
||||
@OneToOne
|
||||
private Indent indentID;//外键,订单ID
|
||||
}
|
@ -1,9 +1,6 @@
|
||||
package com.example.springdemo.entities;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Id;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.*;
|
||||
|
||||
@Data
|
||||
@ -12,18 +9,13 @@ import lombok.*;
|
||||
@AllArgsConstructor
|
||||
@Entity
|
||||
@Table(name = "Merchants")
|
||||
|
||||
public class Merchants {
|
||||
@Id
|
||||
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long id;//主键,商家编号
|
||||
|
||||
private String name;//店铺名字
|
||||
|
||||
private String address;//店铺地址
|
||||
|
||||
private String description;//店铺描述
|
||||
|
||||
@Column(name = "phoneNumber")
|
||||
private String phoneNumber;//商家联系方式
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user