설명 없음
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dim_discount_rule.go 2.7KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package tables
  2. import (
  3. "time"
  4. "git.x2erp.com/qdy/go-db/sqldef"
  5. )
  6. func init() {
  7. sqldef.AddRegistration(func(r *sqldef.Registry) {
  8. tb := sqldef.NewTable("dim_discount_rule", "折扣决策规则表").
  9. ID("rule_id", 32).Comment("规则ID,主键").End().
  10. String("category_id", 32).NotNull().Comment("品类ID").End().
  11. Int("season_month").NotNull().Comment("季节月份(3,5,7,9,11等)").End().
  12. Int("target_inventory_age").NotNull().Comment("目标库龄(天)").End().
  13. Int("recommended_discount").NotNull().Comment("推荐折扣(如70表示7折)").End().
  14. Int("expected_consumption").NotNull().Comment("预期消耗率(%)").End().
  15. Int("confidence_score").NotNull().Comment("置信度(%)").End().
  16. Date("effective_date").NotNull().Comment("生效日期").End().
  17. Date("expired_date").Comment("失效日期").End().
  18. Date("last_apply_date").Comment("最近应用日期").End().
  19. String("creator", 32).NotNull().Comment("创建人").End().
  20. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End()
  21. // 索引
  22. //tb.Index("idx_category_season", "category_id", "season_month").End().
  23. // Index("idx_effective", "effective_date", "expired_date").End()
  24. r.RegisterTable(tb.Build())
  25. })
  26. }
  27. type DimDiscountRule struct {
  28. RuleID string `gorm:"column:rule_id;type:varchar(32);primaryKey;not null;comment:规则ID,主键"`
  29. CategoryID string `gorm:"column:category_id;type:varchar(32);not null;comment:品类ID"`
  30. SeasonMonth int `gorm:"column:season_month;type:int(2);not null;comment:季节月份"`
  31. TargetInventoryAge int `gorm:"column:target_inventory_age;type:int(4);not null;comment:目标库龄"`
  32. RecommendedDiscount int `gorm:"column:recommended_discount;type:int(3);not null;comment:推荐折扣"`
  33. ExpectedConsumption int `gorm:"column:expected_consumption;type:int(3);not null;comment:预期消耗率"`
  34. ConfidenceScore int `gorm:"column:confidence_score;type:int(3);not null;comment:置信度"`
  35. EffectiveDate time.Time `gorm:"column:effective_date;type:date;not null;comment:生效日期"`
  36. ExpiredDate time.Time `gorm:"column:expired_date;type:date;comment:失效日期"`
  37. LastApplyDate time.Time `gorm:"column:last_apply_date;type:date;comment:最近应用日期"`
  38. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  39. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  40. TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
  41. }
  42. func (DimDiscountRule) TableName() string { return "dim_discount_rule" }