12345678910111213141516171819202122232425262728293031323334353637383940 |
- package data_manage
- import (
- "eta/eta_chart_lib/global"
- "eta/eta_chart_lib/utils"
- "time"
- )
- // PredictEdbRuleData 预测指标,动态规则的计算数据
- type PredictEdbRuleData struct {
- //PredictEdbRuleDataId int `orm:"column(predict_edb_rule_data_id);pk"`
- PredictEdbRuleDataId int `gorm:"column:predict_edb_rule_data_id;primaryKey"`
- 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)
- pars = utils.ForwardPars(pars, []int{edbInfoId, configId})
- err = global.DbMap[utils.DbNameIndex].Raw(sql, pars...).Find(&list).Error
- return
- }
|