提交 eeabaabf 编写于 作者: Mr.奇淼('s avatar Mr.奇淼(

前端页面布局修改,后台数据库结构变化,需要重新导入数据库才可使用

上级 4bf71091
......@@ -10,7 +10,7 @@ import (
type SysAuthority struct {
gorm.Model
AuthorityId string `json:"authorityId" gorm:"not null;unique"`
AuthorityId string `json:"authorityId" gorm:"not null;unique"`
AuthorityName string `json:"authorityName"`
}
......@@ -24,16 +24,14 @@ func (a *SysAuthority) CreateAuthority() (err error, authority *SysAuthority) {
func (a *SysAuthority) DeleteAuthority() (err error) {
err = qmsql.DEFAULTDB.Where("authority_id = ?", a.AuthorityId).Find(&SysUser{}).Error
if err != nil {
err = qmsql.DEFAULTDB.Where("authority_id = ?", a.AuthorityId).First(a).Delete(a).Error
new(CasbinModel).clearCasbin(0,a.AuthorityId)
err = qmsql.DEFAULTDB.Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Error
new(CasbinModel).clearCasbin(0, a.AuthorityId)
} else {
err = errors.New("此角色有用户正在使用禁止删除")
}
return err
}
// 分页获取数据 需要分页实现这个接口即可
func (a *SysAuthority) GetInfoList(info modelInterface.PageInfo) (err error, list interface{}, total int) {
// 封装分页方法 调用即可 传入 当前的结构体和分页信息
......@@ -45,4 +43,4 @@ func (a *SysAuthority) GetInfoList(info modelInterface.PageInfo) (err error, lis
err = db.Find(&authority).Error
return err, authority, total
}
}
\ No newline at end of file
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册