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 ff24e95 commit 9652af2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 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

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9652af2

Please sign in to comment.