package models // ProductSerial 商品序列号表 type ProductSerial struct { ID int64 `json:"id" gorm:"primarykey;comment:自增ID"` ProductID int64 `json:"product_id" gorm:"not null;default:0;index;comment:商品ID"` SerialNumber string `json:"serial_number" gorm:"size:100;not null;default:'';uniqueIndex:uk_serial;comment:序列号"` Status int8 `json:"status" gorm:"not null;default:1;comment:状态(1:在库/in_stock,2:已售/sold,3:已退货/returned,4:已报废/scrapped)"` InboundDate int64 `json:"inbound_date" gorm:"not null;default:0;comment:入库时间戳(秒)"` OutboundDate int64 `json:"outbound_date" gorm:"not null;default:0;comment:出库时间戳(秒)"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` IsDel int8 `json:"is_del" gorm:"not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` } func (ProductSerial) TableName() string { return "product_serial" } func (ProductSerial) TableOptions() string { return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品序列号表'" }