chart_edb_mapping.go 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package data_manage
  2. import (
  3. "eta/eta_hub/utils"
  4. "github.com/beego/beego/v2/client/orm"
  5. )
  6. type ChartEdbInfoMapping struct {
  7. EdbInfoId int `description:"指标id"`
  8. SourceName string `description:"来源名称"`
  9. Source int `description:"来源id"`
  10. EdbCode string `description:"指标编码"`
  11. EdbName string `description:"指标名称"`
  12. EdbAliasName string `description:"指标名称(别名)"`
  13. EdbNameEn string `description:"英文指标名称"`
  14. EdbAliasNameEn string `description:"英文指标名称(别名)"`
  15. EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
  16. Frequency string `description:"频率"`
  17. FrequencyEn string `description:"英文频率"`
  18. Unit string `description:"单位"`
  19. UnitEn string `description:"英文单位"`
  20. StartDate string `description:"起始日期"`
  21. EndDate string `description:"终止日期"`
  22. ModifyTime string `description:"指标最后更新时间"`
  23. ChartEdbMappingId int `description:"图表指标id"`
  24. ChartInfoId int `description:"图表id"`
  25. MaxData float64 `description:"上限"`
  26. MinData float64 `description:"下限"`
  27. IsOrder bool `description:"true:正序,false:逆序"`
  28. IsAxis int `description:"1:左轴,0:右轴"`
  29. EdbInfoType int `description:"1:标准指标,0:领先指标"`
  30. EdbInfoCategoryType int `description:"0:普通指标,1:预测指标"`
  31. LeadValue int `description:"领先值"`
  32. LeadUnit string `description:"领先单位"`
  33. LeadUnitEn string `description:"领先英文单位"`
  34. ChartStyle string `description:"图表类型"`
  35. ChartColor string `description:"颜色"`
  36. PredictChartColor string `description:"预测数据的颜色"`
  37. ChartWidth float64 `description:"线条大小"`
  38. ChartType int `description:"生成样式:1:曲线图,2:季节性图,3:面积图,4:柱状图,5:散点图,6:组合图,7:柱方图,8:商品价格曲线图,9:相关性图"`
  39. LatestDate string `description:"数据最新日期"`
  40. LatestValue float64 `description:"数据最新值"`
  41. MoveLatestDate string `description:"移动后的数据最新日期"`
  42. UniqueCode string `description:"指标唯一编码"`
  43. MinValue float64 `json:"-" description:"最小值"`
  44. MaxValue float64 `json:"-" description:"最大值"`
  45. DataList interface{}
  46. IsNullData bool `json:"-" description:"是否空数据"`
  47. MappingSource int `description:"1:ETA图库;2:商品价格曲线"`
  48. RegionType string `description:"交易所来源,海外还是国内" json:"-"`
  49. ClassifyId int `description:"分类id"`
  50. ChartScale float64 `description:"参考刻度线"`
  51. IsConvert int `description:"是否数据转换 0不转 1转"`
  52. ConvertType int `description:"数据转换类型 1乘 2除 3对数"`
  53. ConvertValue float64 `description:"数据转换值"`
  54. ConvertUnit string `description:"数据转换单位"`
  55. ConvertEnUnit string `description:"数据转换单位"`
  56. }
  57. func GetChartEdbMappingList(chartInfoIds []int) (mappingList []*ChartEdbInfoMapping, err error) {
  58. o := orm.NewOrmUsingDB("data")
  59. sql := `
  60. SELECT * FROM chart_edb_mapping WHERE chart_info_id in (`+utils.GetOrmInReplace(len(chartInfoIds))+`)
  61. `
  62. _, err = o.Raw(sql, chartInfoIds).QueryRows(&mappingList)
  63. return
  64. }
  65. func GetChartEdbMappingListByChartInfoId(chartInfoId int) (mappingList []*ChartEdbInfoMapping, err error) {
  66. o := orm.NewOrmUsingDB("data")
  67. sql := `
  68. SELECT * FROM chart_edb_mapping WHERE chart_info_id = ?
  69. `
  70. _, err = o.Raw(sql, chartInfoId).QueryRows(&mappingList)
  71. return
  72. }