package predict_edb_rule_data

import "hongze/hongze_yb/global"

// GetPredictEdbRuleDataList 根据基础预测指标id集合 获取 所有的普通指标列表数据
func GetPredictEdbRuleDataList(edbInfoId, configId int, startDate, endDate string) (list []*PredictEdbRuleData, err error) {
	var pars []interface{}
	whereStr := " edb_info_id = ? AND config_id = ? "
	pars = append(pars, edbInfoId, configId)
	if startDate != "" {
		whereStr += ` AND data_time>=? `
		pars = append(pars, startDate)
	}
	if endDate != "" {
		whereStr += ` AND data_time<=? `
		pars = append(pars, endDate)
	}
	err = global.MYSQL["data"].Where(whereStr, pars...).Order("data_time ASC").Find(&list).Error
	return
}
