package models import ( "github.com/beego/beego/v2/client/orm" "time" ) // PredictEdbRuleData 预测指标,动态规则的计算数据 type PredictEdbRuleData struct { PredictEdbRuleDataId int `orm:"column(predict_edb_rule_data_id);pk"` EdbInfoId int ConfigId int DataTime string Value string CreateTime time.Time ModifyTime time.Time DataTimestamp int64 } // PredictEdbRuleDataItem 预测指标,动态规则的计算数据 type PredictEdbRuleDataItem struct { PredictEdbRuleDataId int `orm:"column(predict_edb_rule_data_id);pk"` EdbInfoId int ConfigId int DataTime string Value float64 CreateTime time.Time ModifyTime time.Time DataTimestamp int64 } // GetPredictEdbRuleDataItemList 根据基础预测指标id集合 获取 所有的普通指标列表数据 func GetPredictEdbRuleDataItemList(edbInfoId, configId int, startDate, endDate string) (list []*PredictEdbRuleDataItem, err error) { o := orm.NewOrm() var pars []interface{} sql := ` SELECT * FROM predict_edb_rule_data WHERE edb_info_id = ? AND config_id = ? ` if startDate != "" { sql += ` AND data_time>=? ` pars = append(pars, startDate) } if endDate != "" { sql += ` AND data_time<=? ` pars = append(pars, endDate) } sql += ` ORDER BY data_time ASC ` _, err = o.Raw(sql, edbInfoId, configId, pars).QueryRows(&list) return }