package models // SalesOrderItem 销售订单明细表 type SalesOrderItem struct { ID int64 `json:"id" gorm:"primarykey;comment:明细ID"` // 明细ID SalesOrderID int64 `json:"sales_order_id" gorm:"not null;default:0;index;comment:销售单ID"` // 销售单 ProductID int64 `json:"product_id" gorm:"not null;default:0;index;comment:商品ID"` // 商品 Quantity int64 `json:"quantity" gorm:"not null;default:0;comment:订购数量(最小单位)"` // 订购数量 AllocatedQuantity int64 `json:"allocated_quantity" gorm:"not null;default:0;comment:已分配数量"` // 已分配数量 ShippedQuantity int64 `json:"shipped_quantity" gorm:"not null;default:0;comment:已发货数量"` // 已发货数量 UnitPrice int64 `json:"unit_price" gorm:"not null;default:0;comment:单价(分/基本单位)"` // 单价 Amount int64 `json:"amount" gorm:"->;comment:金额(分)"` // 金额 ReceiverName string `json:"receiver_name" gorm:"size:100;not null;default:'';comment:收货人姓名"` // 收货人姓名 ReceiverPhone string `json:"receiver_phone" gorm:"size:20;not null;default:'';comment:收货人电话"` // 收货人电话 ReceiverAddress string `json:"receiver_address" gorm:"size:200;not null;default:'';comment:收货地址"` // 收货地址 LogisticsCompany string `json:"logistics_company" gorm:"size:100;not null;default:'';comment:物流公司"` // 物流公司 LogisticsNo string `json:"logistics_no" gorm:"size:100;not null;default:'';comment:物流运单号"` // 物流运单号 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:逻辑删除标记(0:未删除,1:已删除)"` // 逻辑删除标记(0:未删除,1:已删除) } func (SalesOrderItem) TableName() string { return "sales_order_item" } func (SalesOrderItem) TableOptions() string { return "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='销售订单明细表'" }