25 lines
720 B
Go
25 lines
720 B
Go
package model
|
|
|
|
import (
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
// Permission 权限模型
|
|
type Permission struct {
|
|
gorm.Model
|
|
BaseModel `gorm:"embedded"`
|
|
|
|
PermName string `gorm:"not null;size:50" json:"perm_name"`
|
|
PermCode string `gorm:"uniqueIndex:idx_permission_code,where:deleted_at IS NULL;not null;size:100" json:"perm_code"`
|
|
PermType int `gorm:"not null;index" json:"perm_type"` // 1=菜单, 2=按钮
|
|
URL string `gorm:"size:255" json:"url,omitempty"`
|
|
ParentID *uint `gorm:"index" json:"parent_id,omitempty"`
|
|
Sort int `gorm:"not null;default:0" json:"sort"`
|
|
Status int `gorm:"not null;default:1" json:"status"`
|
|
}
|
|
|
|
// TableName 指定表名
|
|
func (Permission) TableName() string {
|
|
return "tb_permission"
|
|
}
|