Commit 02ac331c authored by 李科's avatar 李科

fix: 完善预警规则设置列表返回

parent 2b39353a
...@@ -4,6 +4,7 @@ import "gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity" ...@@ -4,6 +4,7 @@ import "gitlab.wodcloud.com/smart-operation/so-operation-api/src/bean/entity"
type AlertRulesItem struct { type AlertRulesItem struct {
entity.AlertRules `xorm:"extends"` entity.AlertRules `xorm:"extends"`
AlertRuleType string `json:"alert_rule_type" xorm:"alert_rule_type"` // 预警规则类型 关联字典表
ClassParentName string `json:"class_parent_name" xorm:"class_parent_name"` ClassParentName string `json:"class_parent_name" xorm:"class_parent_name"`
ClassName string `json:"class_name" xorm:"class_name"` ClassName string `json:"class_name" xorm:"class_name"`
MetricConfigName string `json:"metric_config_name" xorm:"metric_config_name"` MetricConfigName string `json:"metric_config_name" xorm:"metric_config_name"`
......
...@@ -213,7 +213,7 @@ func (a *AlertRulesSvc) List(req request.ListAlertRules) (resp response.AlertRul ...@@ -213,7 +213,7 @@ func (a *AlertRulesSvc) List(req request.ListAlertRules) (resp response.AlertRul
} }
session := db.NewSession() session := db.NewSession()
defer session.Close() defer session.Close()
session.Table(new(entity.AlertRules)).Alias("r").Select("r.*,acp.class_name class_parent_name,ac.class_name,mc.metric_name metric_config_name") session.Table(new(entity.AlertRules)).Alias("r").Select("r.*,acp.class_name class_parent_name,ac.class_name,mc.metric_name metric_config_name,mc.alert_rule_type")
session.Join("LEFT", "metric_config mc", "mc.id = r.metric_config_id") session.Join("LEFT", "metric_config mc", "mc.id = r.metric_config_id")
session.Join("LEFT", "alert_class ac", "ac.class_id = r.class_id") session.Join("LEFT", "alert_class ac", "ac.class_id = r.class_id")
session.Join("LEFT", "alert_class acp", "acp.class_id = ac.parent_id") session.Join("LEFT", "alert_class acp", "acp.class_id = ac.parent_id")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment