mirror of
https://gitcode.com/flipped-aurora/gin-vue-admin.git
synced 2026-05-18 05:07:50 +00:00
资源权限功能示例
This commit is contained in:
@@ -71,7 +71,12 @@ func (a *SysApi) GetInfoList(info modelInterface.PageInfo) (err error, list inte
|
||||
return
|
||||
} else {
|
||||
var apiList []SysApi
|
||||
err = db.Order("group", true).Where("path LIKE ?", "%"+a.Path+"%").Find(&apiList).Count(&total).Error
|
||||
err = qmsql.DEFAULTDB.Where("path LIKE ?", "%"+a.Path+"%").Find(&apiList).Count(&total).Error
|
||||
if err!=nil{
|
||||
return err, apiList, total
|
||||
}else{
|
||||
err = db.Order("group", true).Where("path LIKE ?", "%"+a.Path+"%").Find(&apiList).Error
|
||||
}
|
||||
return err, apiList, total
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,3 +74,8 @@ func (a *SysAuthority) SetDataAuthority() error {
|
||||
err := qmsql.DEFAULTDB.Model(&s).Association("DataAuthorityId").Replace(&a.DataAuthorityId).Error
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user