123456789101112131415161718192021222324252627282930313233343536373839404142 |
- package future_good_edb_data
- import (
- "hongze/hongze_yb/global"
- )
- func GetFutureGoodEdbDataListByDate(futureGoodEdbInfoId int, startDate, endDate string) (list []*FutureGoodEdbData, err error) {
- var pars []interface{}
- sql := `SELECT * FROM future_good_edb_data WHERE 1=1 AND future_good_edb_info_id = ? `
- pars = append(pars, futureGoodEdbInfoId)
- 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.MYSQL["data"].Raw(sql, pars...).Scan(&list).Error
- return
- }
- func GetFutureGoodEdbDataListByIdsAndDate(futureGoodEdbInfoIds []int, startDate, endDate string) (list []*FutureGoodEdbData, err error) {
- var pars []interface{}
- sql := `SELECT * FROM future_good_edb_data WHERE 1=1 AND future_good_edb_info_id in (?) `
- pars = append(pars, futureGoodEdbInfoIds)
- 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.MYSQL["data"].Raw(sql, pars...).Scan(&list).Error
- return
- }
|