|
@ -27,7 +27,7 @@ func (a *SysAuthority) CreateAuthority() (err error, authority *SysAuthority) { |
|
|
func (a *SysAuthority) DeleteAuthority() (err error) { |
|
|
func (a *SysAuthority) DeleteAuthority() (err error) { |
|
|
err = qmsql.DEFAULTDB.Where("authority_id = ?", a.AuthorityId).Find(&SysUser{}).Error |
|
|
err = qmsql.DEFAULTDB.Where("authority_id = ?", a.AuthorityId).Find(&SysUser{}).Error |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
err = qmsql.DEFAULTDB.Where("parentId = ?", a.AuthorityId).Find(&SysAuthority{}).Error |
|
|
|
|
|
|
|
|
err = qmsql.DEFAULTDB.Where("parent_id = ?", a.AuthorityId).Find(&SysAuthority{}).Error |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
err = qmsql.DEFAULTDB.Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Error |
|
|
err = qmsql.DEFAULTDB.Where("authority_id = ?", a.AuthorityId).First(a).Unscoped().Delete(a).Error |
|
|
new(CasbinModel).clearCasbin(0, a.AuthorityId) |
|
|
new(CasbinModel).clearCasbin(0, a.AuthorityId) |
|
@ -75,7 +75,7 @@ func (a *SysAuthority) SetDataAuthority() error { |
|
|
return err |
|
|
return err |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (a *SysAuthority) GetAuthorityInfo() (err error,sa SysAuthority) { |
|
|
|
|
|
err = qmsql.DEFAULTDB.Preload("DataAuthorityId").Where("authority_id = ?",a.AuthorityId).First(&sa).Error |
|
|
|
|
|
return err,sa |
|
|
|
|
|
|
|
|
func (a *SysAuthority) GetAuthorityInfo() (err error, sa SysAuthority) { |
|
|
|
|
|
err = qmsql.DEFAULTDB.Preload("DataAuthorityId").Where("authority_id = ?", a.AuthorityId).First(&sa).Error |
|
|
|
|
|
return err, sa |
|
|
} |
|
|
} |