add dao testing cases
This commit is contained in:
@@ -40,7 +40,7 @@ func (m *Migration20230131_165509CreateSysRole) table() interface{} {
|
||||
type SysRole struct {
|
||||
gorm.Model
|
||||
|
||||
Alias string `gorm:"not null;unique;primary_key;comment:角色Alias;size:90"` // 角色ID
|
||||
UUID string `gorm:"not null;unique;primary_key;comment:角色Alias;size:90"` // 角色UUID
|
||||
Name string `gorm:"comment:角色名"` // 角色名
|
||||
ParentId *uint `gorm:"comment:父角色ID"` // 父角色ID
|
||||
DefaultRouter string `gorm:"comment:默认菜单;default:dashboard"` // 默认菜单(默认dashboard)
|
||||
|
||||
@@ -18,7 +18,7 @@ type SysRole 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"`
|
||||
Alias_ string `gorm:"column:alias;type:varchar(90);primaryKey" json:"alias"` // 角色Alias
|
||||
UUID string `gorm:"column:uuid;type:varchar(90);primaryKey" json:"uuid"` // 角色Alias
|
||||
Name string `gorm:"column:name;type:varchar(191)" json:"name"` // 角色名
|
||||
ParentID uint64 `gorm:"column:parent_id;type:bigint(20) unsigned" json:"parent_id"` // 父角色ID
|
||||
DefaultRouter string `gorm:"column:default_router;type:varchar(191);default:dashboard" json:"default_router"` // 默认菜单
|
||||
|
||||
@@ -31,7 +31,7 @@ func newSysRole(db *gorm.DB, opts ...gen.DOOption) sysRole {
|
||||
_sysRole.CreatedAt = field.NewTime(tableName, "created_at")
|
||||
_sysRole.UpdatedAt = field.NewTime(tableName, "updated_at")
|
||||
_sysRole.DeletedAt = field.NewField(tableName, "deleted_at")
|
||||
_sysRole.Alias_ = field.NewString(tableName, "alias")
|
||||
_sysRole.UUID = field.NewString(tableName, "uuid")
|
||||
_sysRole.Name = field.NewString(tableName, "name")
|
||||
_sysRole.ParentID = field.NewUint64(tableName, "parent_id")
|
||||
_sysRole.DefaultRouter = field.NewString(tableName, "default_router")
|
||||
@@ -49,7 +49,7 @@ type sysRole struct {
|
||||
CreatedAt field.Time
|
||||
UpdatedAt field.Time
|
||||
DeletedAt field.Field
|
||||
Alias_ field.String // 角色Alias
|
||||
UUID field.String // 角色Alias
|
||||
Name field.String // 角色名
|
||||
ParentID field.Uint64 // 父角色ID
|
||||
DefaultRouter field.String // 默认菜单
|
||||
@@ -73,7 +73,7 @@ func (s *sysRole) updateTableName(table string) *sysRole {
|
||||
s.CreatedAt = field.NewTime(table, "created_at")
|
||||
s.UpdatedAt = field.NewTime(table, "updated_at")
|
||||
s.DeletedAt = field.NewField(table, "deleted_at")
|
||||
s.Alias_ = field.NewString(table, "alias")
|
||||
s.UUID = field.NewString(table, "uuid")
|
||||
s.Name = field.NewString(table, "name")
|
||||
s.ParentID = field.NewUint64(table, "parent_id")
|
||||
s.DefaultRouter = field.NewString(table, "default_router")
|
||||
@@ -104,7 +104,7 @@ func (s *sysRole) fillFieldMap() {
|
||||
s.fieldMap["created_at"] = s.CreatedAt
|
||||
s.fieldMap["updated_at"] = s.UpdatedAt
|
||||
s.fieldMap["deleted_at"] = s.DeletedAt
|
||||
s.fieldMap["alias"] = s.Alias_
|
||||
s.fieldMap["uuid"] = s.UUID
|
||||
s.fieldMap["name"] = s.Name
|
||||
s.fieldMap["parent_id"] = s.ParentID
|
||||
s.fieldMap["default_router"] = s.DefaultRouter
|
||||
|
||||
Reference in New Issue
Block a user