edb_data_calculate_zjpj.go 964 B

12345678910111213141516171819202122232425262728293031323334
  1. package data_manage
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // EdbDataCalculateZjpj 直接拼接数据结构体
  7. type EdbDataCalculateZjpj struct {
  8. EdbDataId int `orm:"column(edb_data_id);pk"`
  9. EdbInfoId int
  10. EdbCode string
  11. DataTime string
  12. Value float64
  13. Status int
  14. CreateTime time.Time
  15. ModifyTime time.Time
  16. DataTimestamp int64
  17. }
  18. // GetAllEdbDataCalculateZjpjByEdbInfoId 根据指标id获取全部的数据
  19. func GetAllEdbDataCalculateZjpjByEdbInfoId(edbInfoId int) (items []*EdbDataCalculateZjpj, err error) {
  20. o := orm.NewOrmUsingDB("data")
  21. sql := ` SELECT * FROM edb_data_calculate_zjpj WHERE edb_info_id=? ORDER BY data_time DESC `
  22. _, err = o.Raw(sql, edbInfoId).QueryRows(&items)
  23. return
  24. }
  25. type EdbDataFromZjpj struct {
  26. Date map[string]int64 `json:"date"`
  27. Ticker map[string]string `json:"ticker"`
  28. Field map[string]string `json:"field"`
  29. Value map[string]float64 `json:"value"`
  30. }