Files
2021-12-03 14:18:06 +08:00

41 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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{}
}