17 lines
1.0 KiB
Go
17 lines
1.0 KiB
Go
package models
|
||
|
||
import "git.apinb.com/bsm-sdk/core/database"
|
||
|
||
// EcOrderItem 对应 ec_order_item,保存订单商品快照。
|
||
type EcOrderItem struct {
|
||
Entity // 公共实体字段
|
||
EcOrderID uint64 `gorm:"column:ec_order_id;not null;index" json:"ec_order_id"` // ec_order_id 业务字段
|
||
EcProductID uint64 `gorm:"column:ec_product_id;not null;index" json:"ec_product_id"` // ec_product_id 业务字段
|
||
ProductSnapshot string `gorm:"column:product_snapshot;type:text;not null;default:''" json:"product_snapshot"` // product_snapshot 业务字段
|
||
Quantity int `gorm:"column:quantity;not null;default:1;check:quantity > 0" json:"quantity"` // quantity 业务字段
|
||
SaleAmount int64 `gorm:"column:sale_amount;not null;default:0;check:sale_amount >= 0" json:"sale_amount"` // sale_amount 业务字段
|
||
}
|
||
|
||
func init() { database.AppendMigrate(&EcOrderItem{}) }
|
||
func (table *EcOrderItem) TableName() string { return "ec_order_item" }
|