edb_data_mysteel_chemical.go 799 B

123456789101112131415161718192021
  1. package data_manage
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. // GetEdbDataMysteelChemicalMaxOrMinDate 根据钢联化工指标code获取最大、最小日期
  6. func GetEdbDataMysteelChemicalMaxOrMinDate(edbCode string) (minDate, maxDate string, err error) {
  7. o := orm.NewOrmUsingDB("data")
  8. sql := ` SELECT MIN(data_time) AS minDate,MAX(data_time) AS maxDate FROM edb_data_mysteel_chemical WHERE edb_code=? `
  9. err = o.Raw(sql, edbCode).QueryRow(&minDate, &maxDate)
  10. return
  11. }
  12. // 更新钢联化工指标的刷新状态
  13. func UpdateMysteelChemicalRefreshStatus(edbCode string, isStop int) (err error) {
  14. o := orm.NewOrmUsingDB("data")
  15. sql := ` UPDATE base_from_mysteel_chemical_index SET is_stop = ? WHERE index_code =? and is_stop=1`
  16. _, err = o.Raw(sql, isStop, edbCode).Exec()
  17. return
  18. }