Skip to content

Commit

Permalink
#845 图表搜索修复
Browse files Browse the repository at this point in the history
  • Loading branch information
tangjiawei committed Nov 26, 2024
1 parent 2bafe72 commit 974d7f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions monitor-server/services/db/custom_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -730,18 +730,18 @@ func getChartQueryIdsByPermission(condition models.QueryChartParam, roles []stri
if len(condition.MgmtRoles) > 0 {
var tempParams []interface{}
mgmtRoleFilterSql, mgmtRoleFilterParam := createListParams(condition.MgmtRoles, "")
sql = sql + " and (role_id in (" + mgmtRoleFilterSql + ") and permission = ?)"
sql = originSql + " and (role_id in (" + mgmtRoleFilterSql + ") and permission = ?)"
tempParams = append(append(tempParams, mgmtRoleFilterParam...), models.PermissionMgmt)
if err = x.SQL(sql, tempParams...).Find(&mgmtIds); err != nil {
return
}
}
roleFilterSql, roleFilterParam := createListParams(roles, "")
if condition.Permission == string(models.PermissionMgmt) {
sql = sql + " and dashboard_chart in (select dashboard_chart from custom_chart_permission where role_id in (" + roleFilterSql + ") and and permission = ?)"
sql = originSql + " and dashboard_chart in (select dashboard_chart from custom_chart_permission where role_id in (" + roleFilterSql + ") and and permission = ?)"
params = append(append(params, roleFilterParam...), models.PermissionMgmt)
} else {
sql = sql + " and dashboard_chart in (select dashboard_chart from custom_chart_permission where role_id in (" + roleFilterSql + "))"
sql = originSql + " and dashboard_chart in (select dashboard_chart from custom_chart_permission where role_id in (" + roleFilterSql + "))"
params = append(params, roleFilterParam...)
}
if err = x.SQL(sql, params...).Find(&ids); err != nil {
Expand Down

0 comments on commit 974d7f5

Please sign in to comment.