41 lines
1.1 KiB
Go
41 lines
1.1 KiB
Go
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"`
|
||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"`
|
||
Auth string `gorm:"column:auth;type:varchar(100);default:'';comment:权限/路由" json:"auth"`
|
||
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序" json:"-"`
|
||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:备注信息" json:"remark"`
|
||
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{}
|
||
}
|