Aucune description
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

dic_table_field_alias.go 3.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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("dic_table_field_alias", "数据库字段别名字典表 - 管理数据库字段别名字典,比如采购入库单里的结算数量(字段),又会叫采购数量,生产数量").
  9. ID("id", 32).NotNull().Comment("主键").End().
  10. String("field_id", 128).NotNull().Comment("字段ID").End().
  11. String("table_id", 64).NotNull().Comment("表ID").End().
  12. String("field_name", 64).NotNull().Comment("字段名称").End().
  13. String("field_alias", 32).NotNull().Comment("字段别名").End().
  14. String("description", 500).NotNull().Default("''").Comment("字段别名描述").End().
  15. String("where", 500).NotNull().Default("''").Comment("此别名获取数据的查询条件描述").End().
  16. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  17. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End().
  18. DateTime("deleted_at").Comment("删除时间").End()
  19. tb.AddIndex("idx_table_id", "table_id")
  20. tb.AddIndex("idx_field_name", "field_name")
  21. tb.AddIndex("idx_field_alias", "field_alias")
  22. tb.AddUniqueIndex("uk_field_alias", "field_alias")
  23. r.RegisterTable(tb.Build())
  24. })
  25. }
  26. type DicTableFieldAlias struct {
  27. FieldID string `gorm:"column:field_id;type:varchar(128);not null;comment:字段ID"`
  28. TableID string `gorm:"column:table_id;type:varchar(64);not null;comment:表ID"`
  29. FieldName string `gorm:"column:field_name;type:varchar(64);not null;comment:字段名称"`
  30. FieldAlias string `gorm:"column:field_alias;type:varchar(32);not null;primaryKey;comment:字段别名"`
  31. Description string `gorm:"column:description;type:varchar(500);not null;default:'';comment:字段别名描述"`
  32. WhereCondition string `gorm:"column:where;type:varchar(500);not null;default:'';comment:此别名获取数据的查询条件描述"`
  33. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  34. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  35. DeletedAt *time.Time `gorm:"column:deleted_at;comment:删除时间"`
  36. }
  37. type DicTableFieldAliasDB struct {
  38. ID string `db:"id" json:"id"`
  39. FieldID string `db:"field_id" json:"fieldID"`
  40. TableID string `db:"table_id" json:"tableID"`
  41. FieldName string `db:"field_name" json:"fieldName"`
  42. FieldAlias string `db:"field_alias" json:"fieldAlias"`
  43. Description string `db:"description" json:"description"`
  44. WhereCondition string `db:"where" json:"whereCondition"`
  45. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  46. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  47. DeletedAt *time.Time `db:"deleted_at" json:"deletedAt"`
  48. }
  49. func (DicTableFieldAlias) TableName() string {
  50. return "dic_table_field_alias"
  51. }