package models import "gorm.io/datatypes" // ProductDestroyLog 商品销毁日志表 type ProductDestroyLog struct { ID int64 `json:"id" gorm:"primarykey;comment:日志ID"` ProductID int64 `json:"product_id" gorm:"not null;default:0;index;comment:商品ID"` Barcode string `json:"barcode" gorm:"size:100;not null;default:'';index;comment:条码"` ProductSnapshot datatypes.JSON `json:"product_snapshot" gorm:"type:json;not null;comment:商品快照(完整product表数据)"` ProductBookSnapshot datatypes.JSON `json:"product_book_snapshot" gorm:"type:json;comment:书籍快照(product_book表数据)"` InventorySnapshot datatypes.JSON `json:"inventory_snapshot" gorm:"type:json;comment:库存汇总快照"` InventoryDetailSnapshot datatypes.JSON `json:"inventory_detail_snapshot" gorm:"type:json;comment:库存明细快照"` DestroyedBy string `json:"destroyed_by" gorm:"size:100;not null;default:'';comment:销毁人"` DestroyedByID int64 `json:"destroyed_by_id" gorm:"not null;default:0;comment:销毁人ID"` DestroyedAt int64 `json:"destroyed_at" gorm:"type:bigint;not null;default:0;comment:销毁时间戳"` RestoredBy string `json:"restored_by" gorm:"size:100;not null;default:'';comment:还原人"` RestoredByID int64 `json:"restored_by_id" gorm:"not null;default:0;comment:还原人ID"` RestoredAt int64 `json:"restored_at" gorm:"type:bigint;not null;default:0;comment:还原时间戳"` Status int8 `json:"status" gorm:"type:tinyint(1);not null;default:0;comment:状态(0:已销毁,1:已还原)"` CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳"` UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳"` IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除"` } func (ProductDestroyLog) TableName() string { return "product_destroy_log" } func (ProductDestroyLog) TableOptions() string { return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品销毁日志表'" }