From 7bb305b3e006968392018dcfb90ff29b6e2cf4b3 Mon Sep 17 00:00:00 2001 From: like Date: Fri, 7 Jul 2023 14:00:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=A2=84=E8=AD=A6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bean/entity/alert_list.go | 49 ++++++++++++++++++----------------- src/service/alert_list.go | 3 +++ 2 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/bean/entity/alert_list.go b/src/bean/entity/alert_list.go index 6b5d9c6..73a8e89 100644 --- a/src/bean/entity/alert_list.go +++ b/src/bean/entity/alert_list.go @@ -5,30 +5,31 @@ import ( ) type AlertList struct { - Id int `json:"id"` // 预警列表ID,主键,自增长 - AlertPoint string `json:"alert_point"` // 预警点 - AlertRulesId string `json:"alert_rules_id"` // 告警规则id - RiskLevel int `json:"risk_level"` // 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险 - AlertTime jsontime.Time `json:"alert_time"` // 预警时间 - ClassId int `json:"class_id" xorm:"'class_id'"` // 预警对象id(级联:预警分类/预警对象) - ClassParentName string `json:"class_parent_name" xorm:"class_parent_name"` // 预警分类名称 TODO 该字段做关联存储或查询 - ClassName string `json:"class_name" xorm:"class_name"` // 预警对象名称 TODO 该字段做关联存储或查询 - MetricConfigId string `json:"metric_config_id"` // 预警指标id // 预警指标 - MetricConfigName string `json:"metric_config_name" xorm:"metric_config_name"` // 预警指标名称 - AlertRuleType string `json:"alert_rule_type" xorm:"alert_rule_type"` // 预警规则类型 TODO 该字段做关联存储或查询 - CurrentValue float64 `json:"current_value"` // 当前报警值 - AlertCondition string `json:"alert_condition" xorm:"'alert_condition'"` // 预警规则(预警阈值) 字典值 - NotificationCount int `json:"notification_count"` // 通知人数 - PushCount int `json:"push_count"` // 推送次数 - LastPushTime jsontime.Time `json:"last_push_time"` // 最近推送时间 - Status int `json:"status"` // 状态,1:已恢复 2:未恢复 3:已关闭 - IsDisposed int `json:"is_disposed"` // 是否处置(工单管理),1:已处置,2:未处置 - DisposalContent string `json:"disposal_content"` // 处置内容(工单管理,结果反馈) - CloseRemark string `json:"close_remark"` // 关闭备注,预警关闭提醒 - CreatedBy string `json:"created_by" xorm:"'created_by'"` // 创建人 - CreatedAt jsontime.Time `json:"created_at" xorm:"'created_at'"` // 创建时间 - UpdatedBy string `json:"updated_by" xorm:"'updated_by'"` // 更新人 - UpdatedAt jsontime.Time `json:"updated_at" xorm:"'updated_at'"` // 更新时间 + Id int `json:"id"` // 预警列表ID,主键,自增长 + AlertPoint string `json:"alert_point"` // 预警点 + AlertRulesId string `json:"alert_rules_id"` // 告警规则id + RiskLevel int `json:"risk_level"` // 风险等级,1:低风险,2:一般风险,3:较大风险,4:重大风险 + AlertTime jsontime.Time `json:"alert_time"` // 预警时间 + ClassId int `json:"class_id" xorm:"'class_id'"` // 预警对象id(级联:预警分类/预警对象) + ClassParentName string `json:"class_parent_name" xorm:"class_parent_name"` // 预警分类名称 TODO 该字段做关联存储或查询 + ClassName string `json:"class_name" xorm:"class_name"` // 预警对象名称 TODO 该字段做关联存储或查询 + MetricConfigId string `json:"metric_config_id"` // 预警指标id // 预警指标 + MetricConfigName string `json:"metric_config_name" xorm:"metric_config_name"` // 预警指标名称 + AlertRuleType string `json:"alert_rule_type" xorm:"alert_rule_type"` // 预警规则类型id TODO 该字段做关联存储或查询 + AlertRuleTypeName string `json:"alert_rule_type_name" xorm:"alert_rule_type_name"` // 预警规则类型名称 TODO 该字段做关联存储或查询 + CurrentValue float64 `json:"current_value"` // 当前报警值 + AlertCondition string `json:"alert_condition" xorm:"'alert_condition'"` // 预警规则(预警阈值) 字典值 + NotificationCount int `json:"notification_count"` // 通知人数 + PushCount int `json:"push_count"` // 推送次数 + LastPushTime jsontime.Time `json:"last_push_time"` // 最近推送时间 + Status int `json:"status"` // 状态,1:已恢复 2:未恢复 3:已关闭 + IsDisposed int `json:"is_disposed"` // 是否处置(工单管理),1:已处置,2:未处置 + DisposalContent string `json:"disposal_content"` // 处置内容(工单管理,结果反馈) + CloseRemark string `json:"close_remark"` // 关闭备注,预警关闭提醒 + CreatedBy string `json:"created_by" xorm:"'created_by'"` // 创建人 + CreatedAt jsontime.Time `json:"created_at" xorm:"'created_at'"` // 创建时间 + UpdatedBy string `json:"updated_by" xorm:"'updated_by'"` // 更新人 + UpdatedAt jsontime.Time `json:"updated_at" xorm:"'updated_at'"` // 更新时间 } func (a *AlertList) TableName() string { diff --git a/src/service/alert_list.go b/src/service/alert_list.go index a1b5ae6..d10c120 100644 --- a/src/service/alert_list.go +++ b/src/service/alert_list.go @@ -60,6 +60,7 @@ func (a *AlertListSvc) GetDataById(req request.DetailAlertList) (resp response.A MetricConfigId: "d773b37b-dbb4-4a7b-be11-ab40f8acc00e", MetricConfigName: "CPU负载过高", AlertRuleType: "51a2cc1e-eb24-4b16-b106-3dc9db963a49", + AlertRuleTypeName: "%", CurrentValue: 85, NotificationCount: 3, PushCount: 3, @@ -97,6 +98,7 @@ func (a *AlertListSvc) List(req request.ListAlertList) (resp response.AlertListL MetricConfigId: "d773b37b-dbb4-4a7b-be11-ab40f8acc00e", MetricConfigName: "磁盘空间不足", AlertRuleType: "51a2cc1e-eb24-4b16-b106-3dc9db963a49", + AlertRuleTypeName: "%", CurrentValue: 85, NotificationCount: 3, PushCount: 3, @@ -128,6 +130,7 @@ func (a *AlertListSvc) List(req request.ListAlertList) (resp response.AlertListL MetricConfigId: "d773b37b-dbb4-4a7b-be11-ab40f8acc00e", MetricConfigName: "响应时间超时", AlertRuleType: "51a2cc1e-eb24-4b16-b106-3dc9db963a49", + AlertRuleTypeName: "%", CurrentValue: 85, NotificationCount: 1, PushCount: 1, -- 2.26.0