Files
platforms/backend/api/internal/models/gasorder_item.go

20 lines
1.9 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import "git.apinb.com/bsm-sdk/core/database"
// GasorderItem 对应 gasorder_item保存订单气瓶与规格价格快照。
type GasorderItem struct {
Entity // 公共实体字段
GasorderBasicID uint64 `gorm:"column:gasorder_basic_id;not null;index" json:"gasorder_basic_id"` // 订单自增主键
GasorderContractProductID uint64 `gorm:"column:gasorder_contract_product_id;not null;index" json:"gasorder_contract_product_id"` // 合同气瓶绑定自增主键
ProductInfoID uint64 `gorm:"column:product_info_id;not null;index;uniqueIndex:idx_active_gasorder_product,where:active = true" json:"product_info_id"` // 实体气瓶自增主键
Active bool `gorm:"column:active;not null;default:true;index" json:"active"` // 是否仍占用该气瓶
ProductCode string `gorm:"column:product_code;type:varchar(64);not null" json:"product_code"` // 产品标识快照
ProductTypeName string `gorm:"column:product_type_name;type:varchar(128);not null" json:"product_type_name"` // 产品类型名称快照
ProductParams string `gorm:"column:product_params;type:text;not null;default:'{}'" json:"product_params"` // 产品规格参数快照
UnitPrice int64 `gorm:"column:unit_price;not null;check:unit_price >= 0" json:"unit_price"` // 成交单价,单位分
}
func init() { database.AppendMigrate(&GasorderItem{}) }
func (table *GasorderItem) TableName() string { return "gasorder_item" }