增加查找区域监控对象相关结果API

This commit is contained in:
刘祥超
2021-09-15 17:53:34 +08:00
parent 15156b68e3
commit 89bd70819f

View File

@@ -99,7 +99,6 @@ func (this *ReportResultDAO) ListResults(tx *dbs.Tx, reportNodeId int64, okState
query.Attr("level", level)
}
_, err = query.
Attr("reportNodeId", reportNodeId).
Gt("updatedAt", time.Now().Unix()-600).
Offset(offset).
Limit(size).
@@ -109,6 +108,19 @@ func (this *ReportResultDAO) ListResults(tx *dbs.Tx, reportNodeId int64, okState
return
}
// FindAllResults 列出所有结果
func (this *ReportResultDAO) FindAllResults(tx *dbs.Tx, taskType string, targetId int64) (result []*ReportResult, err error) {
_, err = this.Query(tx).
Attr("type", taskType).
Attr("targetId", targetId).
Gt("updatedAt", time.Now().Unix()-600).
Desc("isOk").
Asc("costMs").
Slice(&result).
FindAll()
return
}
// FindAvgCostMsWithTarget 获取某个对象的平均耗时
func (this *ReportResultDAO) FindAvgCostMsWithTarget(tx *dbs.Tx, taskType reporterconfigs.TaskType, targetId int64) (float64, error) {
return this.Query(tx).