chart_edb_mapping.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type ChartEdbMapping struct {
  7. ChartEdbMappingId int `orm:"column(chart_edb_mapping_id);pk"`
  8. ChartInfoId int `description:"图表id"`
  9. EdbInfoId int `description:"指标id"`
  10. CreateTime time.Time `description:"创建时间"`
  11. ModifyTime time.Time `description:"修改时间"`
  12. UniqueCode string `description:"唯一编码"`
  13. MaxData float64 `description:"上限"`
  14. MinData float64 `description:"下限"`
  15. IsOrder bool `description:"true:正序,false:逆序"`
  16. IsAxis int `description:"true:左轴,false:右轴"`
  17. EdbInfoType int `description:"true:标准指标,false:领先指标"`
  18. LeadValue int `description:"领先值"`
  19. LeadUnit string `description:"领先单位"`
  20. ChartStyle string `description:"图表类型"`
  21. ChartColor string `description:"颜色"`
  22. ChartWidth float64 `description:"线条大小"`
  23. Source int `description:"1:ETA图库;2:商品价格曲线"`
  24. }
  25. // GetChartEdbMappingListByEdbInfoId 根据指标id获取关联图表列表
  26. func GetChartEdbMappingListByEdbInfoId(edbInfoId int) (list []*ChartEdbMapping, err error) {
  27. o := orm.NewOrm()
  28. sql := ` SELECT *
  29. FROM chart_edb_mapping AS a
  30. WHERE edb_info_id=?
  31. ORDER BY chart_edb_mapping_id ASC `
  32. _, err = o.Raw(sql, edbInfoId).QueryRows(&list)
  33. return
  34. }
  35. // GetGroupChartEdbMappingListByEdbInfoId 根据指标id和来源分组获取关联图表列表
  36. func GetGroupChartEdbMappingListByEdbInfoId(edbInfoId, source int) (list []*ChartEdbMapping, err error) {
  37. o := orm.NewOrm()
  38. sql := ` SELECT *
  39. FROM chart_edb_mapping AS a
  40. WHERE edb_info_id=? AND source = ? GROUP BY chart_info_id `
  41. _, err = o.Raw(sql, edbInfoId, source).QueryRows(&list)
  42. return
  43. }