Commit 9f0df678 by tyfanchz

实体类修改

1 parent 7fa826dd
...@@ -11,7 +11,7 @@ CREATE TABLE `t_platform_customer` ...@@ -11,7 +11,7 @@ CREATE TABLE `t_platform_customer`
`city` INT(11) DEFAULT NULL COMMENT '城市 sys_area的id', `city` INT(11) DEFAULT NULL COMMENT '城市 sys_area的id',
`area` INT(11) DEFAULT NULL COMMENT '区 sys_area的id', `area` INT(11) DEFAULT NULL COMMENT '区 sys_area的id',
`address` VARCHAR(128) DEFAULT NULL COMMENT '详细地址', `address` VARCHAR(128) DEFAULT NULL COMMENT '详细地址',
`status` TINYINT(2) DEFAULT NULL COMMENT '账号状态 0 停用 1 正常 2 待审核 3 审核未通过', `status` TINYINT(2) DEFAULT 2 COMMENT '账号状态 0 停用 1 正常 2 待审核 3 审核未通过',
`key_id` INT(11) DEFAULT NULL COMMENT '秘钥 t_platform_secretkey的id', `key_id` INT(11) DEFAULT NULL COMMENT '秘钥 t_platform_secretkey的id',
`channel_number` VARCHAR(32) DEFAULT NULL COMMENT '渠道号', `channel_number` VARCHAR(32) DEFAULT NULL COMMENT '渠道号',
`create_time` DATETIME DEFAULT NULL COMMENT '创建d时间', `create_time` DATETIME DEFAULT NULL COMMENT '创建d时间',
......
...@@ -5,6 +5,8 @@ import javax.persistence.ConstraintMode; ...@@ -5,6 +5,8 @@ import javax.persistence.ConstraintMode;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
import javax.persistence.ForeignKey; import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.Transient; import javax.persistence.Transient;
...@@ -21,23 +23,37 @@ import org.hibernate.annotations.Table; ...@@ -21,23 +23,37 @@ import org.hibernate.annotations.Table;
@Table(appliesTo = "t_shop_cart", comment = "购物车") @Table(appliesTo = "t_shop_cart", comment = "购物车")
@Entity(name = "t_shop_cart") @Entity(name = "t_shop_cart")
public class Cart extends ShopBaseEntity { public class Cart extends ShopBaseEntity {
@Id
@GeneratedValue
private Long id;
@Column(name = "id_user", columnDefinition = "BIGINT COMMENT '用户id'") @Column(name = "id_user", columnDefinition = "BIGINT COMMENT '用户id'")
private Long idUser; private Long idUser;
@JoinColumn(name = "id_user", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
@JoinColumn(name = "id_user", insertable = false, updatable = false,
foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
private ShopUser user; //private ShopUser user;
private PlatformUser user;
@Column(name = "id_goods", columnDefinition = "BIGINT COMMENT '商品id'") @Column(name = "id_goods", columnDefinition = "BIGINT COMMENT '商品id'")
private Long idGoods; private Long idGoods;
@JoinColumn(name = "id_goods", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
@JoinColumn(name = "id_goods", insertable = false, updatable = false,
foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
private Goods goods; private Goods goods;
@Column(name = "id_sku", columnDefinition = "BIGINT COMMENT 'skuId'") @Column(name = "id_sku", columnDefinition = "BIGINT COMMENT 'skuId'")
private Long idSku; private Long idSku;
@JoinColumn(name = "id_sku", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT)) @JoinColumn(name = "id_sku", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
private GoodsSku sku; private GoodsSku sku;
@Column(columnDefinition = "varchar(16) COMMENT '数量'") @Column(columnDefinition = "varchar(16) COMMENT '数量'")
private BigDecimal count; private BigDecimal count;
@Transient @Transient
private BigDecimal price; private BigDecimal price;
...@@ -49,6 +65,7 @@ public class Cart extends ShopBaseEntity { ...@@ -49,6 +65,7 @@ public class Cart extends ShopBaseEntity {
} }
public String getTitle() { public String getTitle() {
return idSku != null ? getGoods().getName() + " " + getSku().getCodeName() : getGoods().getName(); return idSku != null ? getGoods().getName() + " " + getSku().getCodeName() : getGoods()
.getName();
} }
} }
...@@ -23,7 +23,8 @@ public class Favorite extends ShopBaseEntity { ...@@ -23,7 +23,8 @@ public class Favorite extends ShopBaseEntity {
private Long idUser; private Long idUser;
@JoinColumn(name = "id_user", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT)) @JoinColumn(name = "id_user", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
private ShopUser user; //private ShopUser user;
private PlatformUser user;
@Column(name = "id_goods", columnDefinition = "BIGINT COMMENT '商品id'") @Column(name = "id_goods", columnDefinition = "BIGINT COMMENT '商品id'")
private Long idGoods; private Long idGoods;
@JoinColumn(name = "id_goods", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT)) @JoinColumn(name = "id_goods", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
......
...@@ -31,7 +31,8 @@ public class Order extends ShopBaseEntity { ...@@ -31,7 +31,8 @@ public class Order extends ShopBaseEntity {
private Long idUser; private Long idUser;
@JoinColumn(name = "id_user", referencedColumnName = "id", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT)) @JoinColumn(name = "id_user", referencedColumnName = "id", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
@ManyToOne(fetch = FetchType.LAZY) @ManyToOne(fetch = FetchType.LAZY)
private ShopUser user; //private ShopUser user;
private PlatformUser user;
@Column(columnDefinition = "VARCHAR(32) COMMENT '订单号'") @Column(columnDefinition = "VARCHAR(32) COMMENT '订单号'")
private String orderSn; private String orderSn;
/** /**
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!