123456789101112131415161718192021222324252627282930313233343536 |
- package data_manage
- 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 float64
- CreateTime time.Time
- ModifyTime time.Time
- DataTimestamp int64
- }
- // GetPredictEdbRuleDataList 根据基础预测指标id集合 获取 所有的普通指标列表数据
- func GetPredictEdbRuleDataList(edbInfoId, configId int, startDate, endDate string) (list []*PredictEdbRuleData, err error) {
- o := orm.NewOrmUsingDB("data")
- 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
- }
|