Skip to content

Commit 2e6f99e

Browse files
authored
修改获取角色列表没有检查err,优化查询逻辑 (#1238)
Co-authored-by: wangxd01 <[email protected]>
1 parent 9307d08 commit 2e6f99e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/service/system/sys_authority.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ func (authorityService *AuthorityService) GetAuthorityInfoList(info request.Page
148148
limit := info.PageSize
149149
offset := info.PageSize * (info.Page - 1)
150150
db := global.GVA_DB.Model(&system.SysAuthority{})
151-
err = db.Where("parent_id = ?", "0").Count(&total).Error
151+
if err = db.Where("parent_id = ?", "0").Count(&total).Error; total == 0 || err != nil {
152+
return
153+
}
152154
var authority []system.SysAuthority
153155
err = db.Limit(limit).Offset(offset).Preload("DataAuthorityId").Where("parent_id = ?", "0").Find(&authority).Error
154156
if len(authority) > 0 {

0 commit comments

Comments
 (0)