support user role attachment

This commit is contained in:
yanghao05
2023-02-05 13:30:43 +08:00
parent 285e1f1c51
commit ee631b9714
17 changed files with 518 additions and 50 deletions

View File

@@ -40,10 +40,10 @@ func (m *Migration20230131_165134CreateSysDictionary) table() interface{} {
type SysDictionary struct {
gorm.Model
Name string `gorm:"column:name;comment:字典名(中)"` // 字典名(中)
Type string `gorm:"column:type;comment:字典名(英)"` // 字典名(英)
Status *bool `gorm:"column:status;comment:状态"` // 状态
Desc string `gorm:"column:desc;comment:描述"` // 描述
Name string `gorm:"comment:字典名(中)"` // 字典名(中)
Alias string `gorm:"comment:字典名(英)"` // 字典名(英)
Status bool `gorm:"comment:状态"` // 状态
Description string `gorm:"comment:描述"` // 描述
}
return SysDictionary{}

View File

@@ -40,11 +40,11 @@ func (m *Migration20230131_165218CreateSysDictionaryDetail) table() interface{}
type SysDictionaryDetail struct {
gorm.Model
Label string `gorm:"column:label;comment:展示值"` // 展示值
Value int `gorm:"column:value;comment:字典值"` // 字典值
Status *bool `gorm:"column:status;comment:启用状态"` // 启用状态
Sort int `gorm:"column:sort;comment:排序标记"` // 排序标记
SysDictionaryID int `gorm:"column:sys_dictionary_id;comment:关联标记"` // 关联标记
SysDictionaryID int `gorm:"comment:关联标记"`
Label string `gorm:"comment:展示值"`
Value string `gorm:"comment:字典值"`
Status bool `gorm:"comment:启用状态"`
Weight int `gorm:"comment:排序权重"`
}
return SysDictionaryDetail{}

View File

@@ -14,14 +14,14 @@ const TableNameSysDictionary = "sys_dictionaries"
// SysDictionary mapped from table <sys_dictionaries>
type SysDictionary struct {
ID uint64 `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true" json:"id"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime(3)" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime(3)" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3)" json:"deleted_at"`
Name string `gorm:"column:name;type:varchar(191)" json:"name"` // 字典名(中)
Type string `gorm:"column:type;type:varchar(191)" json:"type"` // 字典名(英)
Status bool `gorm:"column:status;type:tinyint(1)" json:"status"` // 状态
Desc string `gorm:"column:desc;type:varchar(191)" json:"desc"` // 描述
ID uint64 `gorm:"column:id;type:bigint(20) unsigned;primaryKey;autoIncrement:true" json:"id"`
CreatedAt time.Time `gorm:"column:created_at;type:datetime(3)" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime(3)" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3)" json:"deleted_at"`
Name string `gorm:"column:name;type:varchar(191)" json:"name"` // 字典名(中)
Alias_ string `gorm:"column:alias;type:varchar(191)" json:"alias"` // 字典名(英)
Status bool `gorm:"column:status;type:tinyint(1)" json:"status"` // 状态
Description string `gorm:"column:description;type:varchar(191)" json:"description"` // 描述
}
// TableName SysDictionary's table name

View File

@@ -18,11 +18,11 @@ type SysDictionaryDetail struct {
CreatedAt time.Time `gorm:"column:created_at;type:datetime(3)" json:"created_at"`
UpdatedAt time.Time `gorm:"column:updated_at;type:datetime(3)" json:"updated_at"`
DeletedAt gorm.DeletedAt `gorm:"column:deleted_at;type:datetime(3)" json:"deleted_at"`
Label string `gorm:"column:label;type:varchar(191)" json:"label"` // 展示值
Value int64 `gorm:"column:value;type:bigint(20)" json:"value"` // 字典值
Status bool `gorm:"column:status;type:tinyint(1)" json:"status"` // 启用状态
Sort int64 `gorm:"column:sort;type:bigint(20)" json:"sort"` // 排序标记
SysDictionaryID int64 `gorm:"column:sys_dictionary_id;type:bigint(20)" json:"sys_dictionary_id"` // 关联标记
Label string `gorm:"column:label;type:varchar(191)" json:"label"` // 展示值
Value string `gorm:"column:value;type:varchar(191)" json:"value"` // 字典值
Status bool `gorm:"column:status;type:tinyint(1)" json:"status"` // 启用状态
Weight int64 `gorm:"column:weight;type:bigint(20)" json:"weight"` // 排序权重
}
// TableName SysDictionaryDetail's table name

View File

@@ -32,9 +32,9 @@ func newSysDictionary(db *gorm.DB, opts ...gen.DOOption) sysDictionary {
_sysDictionary.UpdatedAt = field.NewTime(tableName, "updated_at")
_sysDictionary.DeletedAt = field.NewField(tableName, "deleted_at")
_sysDictionary.Name = field.NewString(tableName, "name")
_sysDictionary.Type = field.NewString(tableName, "type")
_sysDictionary.Alias_ = field.NewString(tableName, "alias")
_sysDictionary.Status = field.NewBool(tableName, "status")
_sysDictionary.Desc = field.NewString(tableName, "desc")
_sysDictionary.Description = field.NewString(tableName, "description")
_sysDictionary.fillFieldMap()
@@ -44,15 +44,15 @@ func newSysDictionary(db *gorm.DB, opts ...gen.DOOption) sysDictionary {
type sysDictionary struct {
sysDictionaryDo sysDictionaryDo
ALL field.Asterisk
ID field.Uint64
CreatedAt field.Time
UpdatedAt field.Time
DeletedAt field.Field
Name field.String // 字典名(中)
Type field.String // 字典名(英)
Status field.Bool // 状态
Desc field.String // 描述
ALL field.Asterisk
ID field.Uint64
CreatedAt field.Time
UpdatedAt field.Time
DeletedAt field.Field
Name field.String // 字典名(中)
Alias_ field.String // 字典名(英)
Status field.Bool // 状态
Description field.String // 描述
fieldMap map[string]field.Expr
}
@@ -74,9 +74,9 @@ func (s *sysDictionary) updateTableName(table string) *sysDictionary {
s.UpdatedAt = field.NewTime(table, "updated_at")
s.DeletedAt = field.NewField(table, "deleted_at")
s.Name = field.NewString(table, "name")
s.Type = field.NewString(table, "type")
s.Alias_ = field.NewString(table, "alias")
s.Status = field.NewBool(table, "status")
s.Desc = field.NewString(table, "desc")
s.Description = field.NewString(table, "description")
s.fillFieldMap()
@@ -107,9 +107,9 @@ func (s *sysDictionary) fillFieldMap() {
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["deleted_at"] = s.DeletedAt
s.fieldMap["name"] = s.Name
s.fieldMap["type"] = s.Type
s.fieldMap["alias"] = s.Alias_
s.fieldMap["status"] = s.Status
s.fieldMap["desc"] = s.Desc
s.fieldMap["description"] = s.Description
}
func (s sysDictionary) clone(db *gorm.DB) sysDictionary {

View File

@@ -31,11 +31,11 @@ func newSysDictionaryDetail(db *gorm.DB, opts ...gen.DOOption) sysDictionaryDeta
_sysDictionaryDetail.CreatedAt = field.NewTime(tableName, "created_at")
_sysDictionaryDetail.UpdatedAt = field.NewTime(tableName, "updated_at")
_sysDictionaryDetail.DeletedAt = field.NewField(tableName, "deleted_at")
_sysDictionaryDetail.Label = field.NewString(tableName, "label")
_sysDictionaryDetail.Value = field.NewInt64(tableName, "value")
_sysDictionaryDetail.Status = field.NewBool(tableName, "status")
_sysDictionaryDetail.Sort = field.NewInt64(tableName, "sort")
_sysDictionaryDetail.SysDictionaryID = field.NewInt64(tableName, "sys_dictionary_id")
_sysDictionaryDetail.Label = field.NewString(tableName, "label")
_sysDictionaryDetail.Value = field.NewString(tableName, "value")
_sysDictionaryDetail.Status = field.NewBool(tableName, "status")
_sysDictionaryDetail.Weight = field.NewInt64(tableName, "weight")
_sysDictionaryDetail.fillFieldMap()
@@ -50,11 +50,11 @@ type sysDictionaryDetail struct {
CreatedAt field.Time
UpdatedAt field.Time
DeletedAt field.Field
Label field.String // 展示值
Value field.Int64 // 字典值
Status field.Bool // 启用状态
Sort field.Int64 // 排序标记
SysDictionaryID field.Int64 // 关联标记
Label field.String // 展示值
Value field.String // 字典值
Status field.Bool // 启用状态
Weight field.Int64 // 排序权重
fieldMap map[string]field.Expr
}
@@ -75,11 +75,11 @@ func (s *sysDictionaryDetail) updateTableName(table string) *sysDictionaryDetail
s.CreatedAt = field.NewTime(table, "created_at")
s.UpdatedAt = field.NewTime(table, "updated_at")
s.DeletedAt = field.NewField(table, "deleted_at")
s.Label = field.NewString(table, "label")
s.Value = field.NewInt64(table, "value")
s.Status = field.NewBool(table, "status")
s.Sort = field.NewInt64(table, "sort")
s.SysDictionaryID = field.NewInt64(table, "sys_dictionary_id")
s.Label = field.NewString(table, "label")
s.Value = field.NewString(table, "value")
s.Status = field.NewBool(table, "status")
s.Weight = field.NewInt64(table, "weight")
s.fillFieldMap()
@@ -109,11 +109,11 @@ func (s *sysDictionaryDetail) fillFieldMap() {
s.fieldMap["created_at"] = s.CreatedAt
s.fieldMap["updated_at"] = s.UpdatedAt
s.fieldMap["deleted_at"] = s.DeletedAt
s.fieldMap["sys_dictionary_id"] = s.SysDictionaryID
s.fieldMap["label"] = s.Label
s.fieldMap["value"] = s.Value
s.fieldMap["status"] = s.Status
s.fieldMap["sort"] = s.Sort
s.fieldMap["sys_dictionary_id"] = s.SysDictionaryID
s.fieldMap["weight"] = s.Weight
}
func (s sysDictionaryDetail) clone(db *gorm.DB) sysDictionaryDetail {