2021-09-28 11:47:19 +08:00
|
|
|
|
package model
|
|
|
|
|
|
|
|
|
|
type SysAuth struct {
|
|
|
|
|
Model
|
|
|
|
|
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"-"`
|
|
|
|
|
Kind SysAuthKind `gorm:"column:kind;type:tinyint(1);default:1;comment:类型(1:模块,2:权限)" json:"kind"`
|
2021-12-03 14:18:06 +08:00
|
|
|
|
Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"`
|
|
|
|
|
Auth string `gorm:"column:auth;type:varchar(100);default:'';comment:权限/路由" json:"auth"`
|
2021-09-28 11:47:19 +08:00
|
|
|
|
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序" json:"-"`
|
2021-12-03 14:18:06 +08:00
|
|
|
|
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"`
|
2021-09-28 11:47:19 +08:00
|
|
|
|
ModelDeleted
|
|
|
|
|
ModelAt
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// SysAuthKind 权限分类
|
|
|
|
|
type SysAuthKind int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// SysAuthKindForModule 模块
|
|
|
|
|
SysAuthKindForModule SysAuthKind = iota + 1
|
|
|
|
|
// SysAuthKindForAuth 权限
|
|
|
|
|
SysAuthKindForAuth
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func (m *SysAuth) TableName() string {
|
|
|
|
|
return "sys_auth"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *SysAuth) KindTitle() string {
|
|
|
|
|
if m.Kind == SysAuthKindForModule {
|
|
|
|
|
return "模块"
|
|
|
|
|
} else if m.Kind == SysAuthKindForAuth {
|
|
|
|
|
return "权限"
|
|
|
|
|
}
|
|
|
|
|
return "-"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func NewSysAuth() *SysAuth {
|
|
|
|
|
return &SysAuth{}
|
|
|
|
|
}
|