package model import ( model2 "Medical_OAuth/common/model" coreModel "gogs.baozhida.cn/zoie/OAuth-core/model" "errors" "gorm.io/gorm" ) type SysRole struct { model2.Model coreModel.Role model2.ControlBy model2.ModelTime } func (SysRole) TableName() string { return "sys_role" } func (e *SysRole) Generate() model2.ActiveRecord { o := *e return &o } func (e *SysRole) GetId() interface{} { return e.Id } func (e *SysRole) BeforeDelete(_ *gorm.DB) (err error) { if e.RoleKey == "admin" { return errors.New("禁止删除系统角色") } return }