edb_data_ths.go 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package data_manage
  2. //type EdbDataThs struct {
  3. // EdbDataId int `orm:"column(edb_data_id);pk" gorm:"primaryKey"`
  4. // EdbInfoId int
  5. // EdbCode string
  6. // DataTime string
  7. // Value float64
  8. // Status int
  9. // CreateTime time.Time
  10. // ModifyTime time.Time
  11. // DataTimestamp int64
  12. //}
  13. //func AddEdbDataThs(items []*EdbDataThs) (err error) {
  14. // o := global.DbMap[utils.DbNameIndex]
  15. // err = o.CreateInBatches(items, utils.MultiAddNum).Error
  16. // return
  17. //}
  18. //func ModifyEdbDataThs(edbInfoId int64, edbCode, dataTime string, value float64) (err error) {
  19. // o := global.DbMap[utils.DbNameIndex]
  20. // sql := ` UPDATE edb_data_ths SET edb_info_id=?,value=?,status=1,modify_time=NOW() WHERE edb_code=? AND data_time=? `
  21. // err = o.Exec(sql, edbInfoId, value, edbCode, dataTime).Error
  22. // return
  23. //}
  24. //func GetEdbDataThsCount(ebdCode, dataTime string) (count int, err error) {
  25. // o := global.DbMap[utils.DbNameIndex]
  26. // sql := ` SELECT COUNT(1) AS count FROM edb_data_ths WHERE edb_code=? AND data_time=? `
  27. // err = o.Raw(sql, ebdCode, dataTime).Scan(&count).Error
  28. // return
  29. //}
  30. //func GetEdbDataThsMaxOrMinDate(edbInfoId int) (min_date, max_date string, err error) {
  31. // o := global.DbMap[utils.DbNameIndex]
  32. // sql := ` SELECT MIN(data_time) AS min_date,MAX(data_time) AS max_date FROM edb_data_ths WHERE edb_info_id=? `
  33. // err = o.Raw(sql, edbInfoId).Row().Scan(&min_date, &max_date)
  34. // return
  35. //}