query.go 696 B

1234567891011121314151617181920
  1. package predict_edb_rule_data
  2. import "hongze/hongze_yb/global"
  3. // GetPredictEdbRuleDataList 根据基础预测指标id集合 获取 所有的普通指标列表数据
  4. func GetPredictEdbRuleDataList(edbInfoId, configId int, startDate, endDate string) (list []*PredictEdbRuleData, err error) {
  5. var pars []interface{}
  6. whereStr := " edb_info_id = ? AND config_id = ? "
  7. pars = append(pars, edbInfoId, configId)
  8. if startDate != "" {
  9. whereStr += ` AND data_time>=? `
  10. pars = append(pars, startDate)
  11. }
  12. if endDate != "" {
  13. whereStr += ` AND data_time<=? `
  14. pars = append(pars, endDate)
  15. }
  16. err = global.MYSQL["data"].Where(whereStr, pars...).Order("data_time ASC").Find(&list).Error
  17. return
  18. }