package models import "gorm.io/datatypes" // Product 商品表 type Product struct { ID int64 `json:"id" gorm:"primarykey;comment:商品ID"` AboutId int64 `json:"about_id" gorm:"not null;default:0;index;comment:租户ID"` WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:仓库ID"` WarehouseName string `json:"warehouse_name" gorm:"size:100;not null;default:'';comment:仓库名称"` LocationID int64 `json:"location_id" gorm:"not null;default:0;index;comment:库位ID"` LocationName string `json:"location_name" gorm:"size:100;not null;default:'';comment:库位名称"` CategoryID int64 `json:"category_id" gorm:"not null;default:0;comment:分类ID"` StandardProductID int64 `json:"standard_product_id" gorm:"not null;default:0;index;comment:关联标品ID"` Name string `json:"name" gorm:"size:255;not null;default:'';comment:商品名称"` Appearance int64 `json:"appearance" gorm:"not null;default:0;comment:品相"` Barcode string `json:"barcode" gorm:"size:100;not null;default:'';index;comment:条码(可唯一,视业务而定)"` Price int64 `json:"price" gorm:"not null;default:0;comment:价格"` SalePrice int64 `json:"sale_price" gorm:"not null;default:0;comment:书价"` Cost int64 `json:"cost" gorm:"not null;default:0;comment:最低运费"` Stock int64 `json:"stock" gorm:"not null;default:0;comment:库存"` LiveImage datatypes.JSON `json:"live_image" gorm:"type:json;not null;comment:实拍图json"` IsBatchManaged int8 `json:"is_batch_managed" gorm:"type:tinyint(1);not null;default:0;comment:是否批次管理(0:否,1:是)"` IsShelfLifeManaged int8 `json:"is_shelf_life_managed" gorm:"type:tinyint(1);not null;default:0;comment:是否效期管理(0:否,1:是)"` Status int8 `json:"status" gorm:"type:tinyint(1);not null;default:1;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:"not null;default:0;index:idx_product_del;comment:逻辑删除"` } func (Product) TableName() string { return "product" } func (Product) TableOptions() string { return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='商品表'" }