12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package models
- import (
- "eta_gn/eta_index_lib/global"
- "time"
- )
- // PredictEdbRuleData 预测指标,动态规则的计算数据
- type PredictEdbRuleData struct {
- PredictEdbRuleDataId int `gorm:"primaryKey;autoIncrement;column:predict_edb_rule_data_id"`
- EdbInfoId int
- ConfigId int
- DataTime string
- Value string
- CreateTime time.Time
- ModifyTime time.Time
- DataTimestamp int64
- }
- // PredictEdbRuleDataItem 预测指标,动态规则的计算数据
- type PredictEdbRuleDataItem struct {
- PredictEdbRuleDataId int `gorm:"primaryKey;autoIncrement;column:predict_edb_rule_data_id"`
- 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) {
- var pars []interface{}
- sql := ` SELECT * FROM predict_edb_rule_data WHERE edb_info_id = ? AND config_id = ? `
- pars = append(pars, edbInfoId, configId)
- 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 = global.DEFAULT_DmSQL.Raw(sql, pars...).Scan(&list).Error
- return
- }
|