Skip to content

Commit

Permalink
#845 看板搜索修复&自定义业务配置编辑报错修复
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjiawei committed Nov 21, 2024
1 parent 2e5ffa9 commit dcdd9db
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions monitor-server/services/db/custom_dashboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,19 +244,20 @@ func getQueryIdsByPermission(condition models.CustomDashboardQueryParam, roles [
var useIds, mgmtIds []int
originSql := sql
if len(condition.UseRoles) > 0 {
var tempParams []interface{}
useRoleFilterSql, useRoleFilterParam := createListParams(condition.UseRoles, "")
sql = originSql + " and (role_id in (" + useRoleFilterSql + ") and permission = ?)"
params = append(append(params, useRoleFilterParam...), models.PermissionUse)
if err = x.SQL(sql, params...).Find(&useIds); err != nil {
tempParams = append(append(tempParams, useRoleFilterParam...), models.PermissionUse)
if err = x.SQL(sql, tempParams...).Find(&useIds); err != nil {
return
}
}
if len(condition.MgmtRoles) > 0 {
params = []interface{}{}
var tempParams []interface{}
mgmtRoleFilterSql, mgmtRoleFilterParam := createListParams(condition.MgmtRoles, "")
sql = originSql + " and (role_id in (" + mgmtRoleFilterSql + ") and permission = ?)"
params = append(append(params, mgmtRoleFilterParam...), models.PermissionMgmt)
if err = x.SQL(sql, params...).Find(&mgmtIds); err != nil {
tempParams = append(append(tempParams, mgmtRoleFilterParam...), models.PermissionMgmt)
if err = x.SQL(sql, tempParams...).Find(&mgmtIds); err != nil {
return
}
}
Expand Down

0 comments on commit dcdd9db

Please sign in to comment.