| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- package tables
-
- import (
- "time"
-
- "git.x2erp.com/qdy/go-db/sqldef"
- )
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- tb := sqldef.NewTable("purchase_receipt", "采购入库表").
- ID("receipt_id", 32).Comment("入库单ID,主键").End().
- String("erp_receipt_id", 64).NotNull().Comment("ERP原始入库单号").End().
- String("sku_id", 32).NotNull().Comment("商品SKU").End().
- String("channel_id", 32).NotNull().Comment("入库渠道/仓库").End().
- Int("quantity").NotNull().Default("0").Comment("入库数量").End().
- String("tenant_id", 8).NotNull().Comment("租户ID").End().
- DateTime("receipt_time").NotNull().Comment("实际入库时间").End().
- DateTime("expected_arrival_date").Comment("预计到货日期").End().
- DateTime("extracted_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("数据抽取时间").End()
- r.RegisterTable(tb.Build())
- })
- }
-
- // PurchaseReceipt 采购入库表结构体
- type PurchaseReceipt struct {
- ReceiptID string `gorm:"column:receipt_id;type:varchar(32);primaryKey;not null;comment:入库单ID,主键"`
- ErpReceiptID string `gorm:"column:erp_receipt_id;type:varchar(64);not null;comment:ERP原始入库单号;index"`
- SkuID string `gorm:"column:sku_id;type:varchar(32);not null;comment:商品SKU;index"`
- ChannelID string `gorm:"column:channel_id;type:varchar(32);not null;comment:入库渠道/仓库"`
- Quantity int `gorm:"column:quantity;not null;default:0;comment:入库数量"`
- ReceiptTime time.Time `gorm:"column:receipt_time;not null;comment:实际入库时间"`
- ExpectedArrivalDate time.Time `gorm:"column:expected_arrival_date;comment:预计到货日期"`
- ExtractedAt time.Time `gorm:"column:extracted_at;not null;default:CURRENT_TIMESTAMP;comment:数据抽取时间"`
- TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
- }
-
- func (PurchaseReceipt) TableName() string {
- return "purchase_receipt"
- }
|