2026-07-28 08:44:54 +08:00
|
|
|
|
package models
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"git.apinb.com/bsm-sdk/core/database"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// ProductInfo 对应 product_info,保存一物一码的实体产品档案。
|
|
|
|
|
|
type ProductInfo struct {
|
2026-08-04 15:21:39 +08:00
|
|
|
|
Entity // 公共实体字段
|
|
|
|
|
|
ProductStatus int `gorm:"column:product_status;not null;default:10;index" json:"product_status"` // 产品业务状态
|
|
|
|
|
|
Code string `gorm:"column:code;type:varchar(64);not null;uniqueIndex" json:"code"` // 产品唯一标识
|
|
|
|
|
|
Name string `gorm:"column:name;type:varchar(128);not null" json:"name"` // 产品名称
|
|
|
|
|
|
ProducerAccountID uint64 `gorm:"column:producer_account_id;not null;default:0;index" json:"producer_account_id"` // 生产商自增主键;历史数据迁移前可为 0,新建和编辑必须关联有效生产商
|
|
|
|
|
|
ProductTypeID uint64 `gorm:"column:product_type_id;not null;index" json:"product_type_id"` // 产品类型自增主键
|
|
|
|
|
|
Params string `gorm:"column:params;type:text;not null;default:'{}'" json:"params"` // 产品参数 JSON 对象文本
|
|
|
|
|
|
WarehouseID uint64 `gorm:"column:warehouse_id;not null;default:0;index" json:"warehouse_id"` // 当前实际库房自增主键
|
|
|
|
|
|
GasBasicID uint64 `gorm:"column:gas_basic_id;not null;default:0;index" json:"gas_basic_id"` // 当前归属气站自增主键
|
|
|
|
|
|
DeliveryBasicID uint64 `gorm:"column:delivery_basic_id;not null;default:0;index" json:"delivery_basic_id"` // 当前归属配送站自增主键
|
|
|
|
|
|
UserAccountID uint64 `gorm:"column:user_account_id;not null;default:0;index" json:"user_account_id"` // 当前归属用户自增主键
|
|
|
|
|
|
ProducedAt time.Time `gorm:"column:produced_at;type:timestamptz;not null" json:"produced_at"` // 生产时间
|
|
|
|
|
|
EnabledAt *time.Time `gorm:"column:enabled_at;type:timestamptz" json:"enabled_at"` // 首次启用时间
|
2026-07-28 08:44:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() { database.AppendMigrate(&ProductInfo{}) }
|
|
|
|
|
|
func (table *ProductInfo) TableName() string { return "product_info" }
|