提交 c7f5ea3a 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

增加mysql过滤,修改角色id长度

上级 e108521f
......@@ -22,12 +22,13 @@ func Mysql() {
var gormConfig *gorm.Config
if admin.LogMode { //根据配置决定是否开启日志
gormConfig = &gorm.Config{
Logger: logger.Default.LogMode(logger.Info),
Logger: logger.Default.LogMode(logger.Info),
DisableForeignKeyConstraintWhenMigrating: true,
}
} else {
gormConfig = &gorm.Config{
Logger: logger.Default.LogMode(logger.Silent),
Logger: logger.Default.LogMode(logger.Silent),
DisableForeignKeyConstraintWhenMigrating: true,
}
}
......
......@@ -8,7 +8,7 @@ type SysAuthority struct {
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time `sql:"index"`
AuthorityId string `json:"authorityId" gorm:"not null;unique;primary_key" gorm:"comment:'角色ID'"`
AuthorityId string `json:"authorityId" gorm:"not null;unique;primary_key;comment:角色ID;type:varchar(100)"`
AuthorityName string `json:"authorityName" gorm:"comment:'角色名'"`
ParentId string `json:"parentId" gorm:"comment:'父角色ID'"`
DataAuthorityId []SysAuthority `json:"dataAuthorityId" gorm:"many2many:sys_data_authority_id"`
......@@ -22,4 +22,4 @@ func SysAuthorityData() []SysAuthority {
{CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "8881", AuthorityName: "普通用户子角色", ParentId: "888"},
{CreatedAt: time.Now(), UpdatedAt: time.Now(), AuthorityId: "9528", AuthorityName: "测试角色", ParentId: "0"},
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册