package model import ( "gorm.io/gorm" ) // Permission 权限模型 type Permission struct { gorm.Model BaseModel `gorm:"embedded"` PermName string `gorm:"column:perm_name;not null;size:50;comment:权限名称" json:"perm_name"` PermCode string `gorm:"column:perm_code;uniqueIndex:idx_permission_code,where:deleted_at IS NULL;not null;size:100;comment:权限编码" json:"perm_code"` PermType int `gorm:"column:perm_type;not null;index;comment:权限类型 1=菜单 2=按钮" json:"perm_type"` Platform string `gorm:"column:platform;type:varchar(20);default:'all';comment:适用端口 all=全部 web=Web后台 h5=H5端" json:"platform"` URL string `gorm:"column:url;size:255;comment:URL路径" json:"url,omitempty"` ParentID *uint `gorm:"column:parent_id;index;comment:上级权限ID" json:"parent_id,omitempty"` Sort int `gorm:"column:sort;not null;default:0;comment:排序" json:"sort"` Status int `gorm:"column:status;not null;default:1;comment:状态 0=禁用 1=启用" json:"status"` } // TableName 指定表名 func (Permission) TableName() string { return "tb_permission" }