| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- package tables
-
- import (
- "time"
-
- "git.x2erp.com/qdy/go-db/sqldef"
- )
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- tb := sqldef.NewTable("dic_table_field_alias_flow", "数据库字段别名字典流水表 - 管理数据库字段别名字典审批流程").
- ID("id", 32).NotNull().Comment("主键").End().
- String("field_id", 128).NotNull().Comment("字段ID").End().
- String("table_id", 64).NotNull().Comment("表ID").End().
- String("field_name", 64).NotNull().Comment("字段名称").End().
- String("field_alias", 32).NotNull().Comment("字段别名").End().
- String("description", 500).NotNull().Default("''").Comment("字段别名描述").End().
- String("where_condition", 500).NotNull().Default("''").Comment("此别名获取数据的查询条件描述").End().
- String("tenant_id", 128).NotNull().Comment("租户ID").End().
- TinyInt("approval_status").NotNull().Default("0").Comment("审批状态:0待审批,1通过,2拒绝").End().
- String("approver", 32).NotNull().Default("''").Comment("审批人").End().
- DateTime("approved_at").Comment("审批时间").End().
- DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
- DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End().
- DateTime("deleted_at").Comment("删除时间").End()
-
- tb.AddIndex("idx_table_id", "table_id")
- tb.AddIndex("idx_field_name", "field_name")
- tb.AddIndex("idx_field_alias", "field_alias")
- tb.AddIndex("idx_tenant_id", "tenant_id")
- tb.AddIndex("idx_approval_status", "approval_status")
-
- r.RegisterTable(tb.Build())
- })
- }
-
- type DicTableFieldAliasFlow struct {
- ID string `gorm:"column:id;type:varchar(32);not null;primaryKey;comment:主键"`
- FieldID string `gorm:"column:field_id;type:varchar(128);not null;comment:字段ID"`
- TableID string `gorm:"column:table_id;type:varchar(64);not null;comment:表ID"`
- FieldName string `gorm:"column:field_name;type:varchar(64);not null;comment:字段名称"`
- FieldAlias string `gorm:"column:field_alias;type:varchar(32);not null;comment:字段别名"`
- Description string `gorm:"column:description;type:varchar(500);not null;default:'';comment:字段别名描述"`
- WhereCondition string `gorm:"column:where_condition;type:varchar(500);not null;default:'';comment:此别名获取数据的查询条件描述"`
- TenantID string `gorm:"column:tenant_id;type:varchar(128);not null;comment:租户ID"`
- ApprovalStatus int8 `gorm:"column:approval_status;type:tinyint;not null;default:0;comment:审批状态:0待审批,1通过,2拒绝"`
- Approver string `gorm:"column:approver;type:varchar(32);not null;default:'';comment:审批人"`
- ApprovedAt *time.Time `gorm:"column:approved_at;comment:审批时间"`
- CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
- UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
- DeletedAt *time.Time `gorm:"column:deleted_at;comment:删除时间"`
- }
-
- type DicTableFieldAliasFlowDB struct {
- ID string `db:"id" json:"id"`
- FieldID string `db:"field_id" json:"fieldID"`
- TableID string `db:"table_id" json:"tableID"`
- FieldName string `db:"field_name" json:"fieldName"`
- FieldAlias string `db:"field_alias" json:"fieldAlias"`
- Description string `db:"description" json:"description"`
- WhereCondition string `db:"where_condition" json:"whereCondition"`
- TenantID string `db:"tenant_id" json:"tenantID"`
- ApprovalStatus int8 `db:"approval_status" json:"approvalStatus"`
- Approver string `db:"approver" json:"approver"`
- ApprovedAt *time.Time `db:"approved_at" json:"approvedAt"`
- CreatedAt time.Time `db:"created_at" json:"createdAt"`
- UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
- DeletedAt *time.Time `db:"deleted_at" json:"deletedAt"`
- }
-
- func (DicTableFieldAliasFlow) TableName() string {
- return "dic_table_field_alias_flow"
- }
|