feat:完善项目
This commit is contained in:
40
app/common/model/sys_auth.go
Normal file
40
app/common/model/sys_auth.go
Normal file
@ -0,0 +1,40 @@
|
||||
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:null;comment:名称" json:"name"`
|
||||
Auth string `gorm:"column:auth;type:varchar(100);default:null;comment:权限/路由" json:"auth"`
|
||||
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序" json:"-"`
|
||||
Remark string `gorm:"column:remark;type:varchar(255);default:null;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{}
|
||||
}
|
Reference in New Issue
Block a user