| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package tables
-
- import (
- "time"
-
- "git.x2erp.com/qdy/go-db/sqldef"
- )
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- tb := sqldef.NewTable("dwa_discount_daily", "折扣快速监控表").
- ID("stat_id", 32).Comment("统计ID,主键").End().
- Date("stat_date").NotNull().Comment("统计日期").End().
- String("store_id", 32).NotNull().Comment("店铺ID").End().
- String("category_id", 32).NotNull().Comment("品类ID").End().
- String("discount_range", 10).NotNull().Comment("折扣档位(全价,9折,8折,7折,6折,5折)").End().
- Int("inventory_age").NotNull().Comment("平均库龄(天)").End().
- Int("sale_quantity").NotNull().Default("0").Comment("销量").End().
- Int("sale_amount").NotNull().Default("0").Comment("销售额(单位:分)").End().
- Int("current_stock").NotNull().Default("0").Comment("当前库存").End().
- DateTime("update_time").NotNull().Default("CURRENT_TIMESTAMP").Comment("更新时间").End()
-
- // 索引
- //tb.Index("idx_date_store", "stat_date", "store_id").End().
- // Index("idx_category_date", "category_id", "stat_date").End()
-
- r.RegisterTable(tb.Build())
- })
- }
-
- type DwaDiscountDaily struct {
- StatID string `gorm:"column:stat_id;type:varchar(32);primaryKey;not null;comment:统计ID,主键"`
- StatDate time.Time `gorm:"column:stat_date;type:date;not null;comment:统计日期"`
- StoreID string `gorm:"column:store_id;type:varchar(32);not null;comment:店铺ID"`
- CategoryID string `gorm:"column:category_id;type:varchar(32);not null;comment:品类ID"`
- DiscountRange string `gorm:"column:discount_range;type:varchar(10);not null;comment:折扣档位"`
- InventoryAge int `gorm:"column:inventory_age;type:int(4);not null;comment:平均库龄"`
- SaleQuantity int `gorm:"column:sale_quantity;type:int(11);not null;default:0;comment:销量"`
- SaleAmount int `gorm:"column:sale_amount;type:int(11);not null;default:0;comment:销售额"`
- CurrentStock int `gorm:"column:current_stock;type:int(11);not null;default:0;comment:当前库存"`
- UpdateTime time.Time `gorm:"column:update_time;not null;default:CURRENT_TIMESTAMP;comment:更新时间"`
- TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
- }
-
- func (DwaDiscountDaily) TableName() string { return "dwa_discount_daily" }
|