edb_data_ths.go 631 B

12345678910111213141516171819202122232425
  1. package data_manage
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type EdbDataThs struct {
  7. EdbDataId int `orm:"column(edb_data_id);pk"`
  8. EdbInfoId int
  9. EdbCode string
  10. DataTime string
  11. Value float64
  12. Status int
  13. CreateTime time.Time
  14. ModifyTime time.Time
  15. DataTimestamp int64
  16. }
  17. func GetEdbDataThsMaxOrMinDate(edbCode string) (min_date, max_date string, err error) {
  18. o := orm.NewOrmUsingDB("data")
  19. sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date FROM edb_data_ths WHERE edb_code=? `
  20. err = o.Raw(sql, edbCode).QueryRow(&min_date, &max_date)
  21. return
  22. }