60 lines
1.9 KiB
Go
60 lines
1.9 KiB
Go
package model
|
||
|
||
type SysMenu struct {
|
||
Model
|
||
SysMenuBasic
|
||
Auth SysMenuAuth `gorm:"column:auth;type:tinyint(1);default:0;comment:查看权限(0:通用,1:超管)" json:"auth"`
|
||
Sort int `gorm:"column:sort;type:tinyint(3);default:0;comment:排序,数值越大,优先排序" json:"sort"`
|
||
Remark string `gorm:"column:remark;type:varchar(255);default:'';comment:菜单备注" json:"remark"`
|
||
Status SysMenuStatus `gorm:"column:status;type:tinyint(1);default:1;comment:状态" json:"status"`
|
||
ModelDeleted
|
||
ModelAt
|
||
}
|
||
|
||
type SysMenuBasic struct {
|
||
ParentID uint64 `gorm:"column:parent_id;type:int;default:0;comment:父级ID" json:"parent_id"`
|
||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:菜单名" json:"name"`
|
||
Kind SysMenuKind `gorm:"column:kind;type:tinyint(1);default:1;comment:类型(1:目录,2:菜单)" json:"kind"`
|
||
Link string `gorm:"column:link;type:varchar(80);default:'';comment:菜单链接" json:"link"`
|
||
Component string `gorm:"column:component;type:varchar(80);default:'';comment:组件标识" json:"component"`
|
||
Icon string `gorm:"column:icon;type:varchar(50);default:'';comment:菜单图标" json:"icon"`
|
||
}
|
||
|
||
// SysMenuKind 菜单类型
|
||
type SysMenuKind int
|
||
|
||
const (
|
||
// SysMenuKindForCatalogue 目录
|
||
SysMenuKindForCatalogue SysMenuKind = iota + 1
|
||
// SysMenuKindForMenu 菜单
|
||
SysMenuKindForMenu
|
||
)
|
||
|
||
// SysMenuAuth 菜单权限
|
||
type SysMenuAuth int
|
||
|
||
const (
|
||
// SysMenuAuthForOrdinary 普通权限
|
||
SysMenuAuthForOrdinary SysMenuAuth = iota
|
||
// SysMenuAuthForSystem 系统权限
|
||
SysMenuAuthForSystem
|
||
)
|
||
|
||
// SysMenuStatus 菜单状态
|
||
type SysMenuStatus int
|
||
|
||
const (
|
||
// SysMenuStatusForNormal 正常
|
||
SysMenuStatusForNormal SysMenuStatus = iota + 1
|
||
// SysMenuStatusForDisable 禁用
|
||
SysMenuStatusForDisable
|
||
)
|
||
|
||
func (m *SysMenu) TableName() string {
|
||
return "sys_menu"
|
||
}
|
||
|
||
func NewSysMenu() *SysMenu {
|
||
return &SysMenu{}
|
||
}
|