chart_edb_mapping.go 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package data_manage
  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. PredictChartColor string `description:"预测数据的颜色"`
  23. ChartWidth float64 `description:"线条大小"`
  24. Source int `description:"1:ETA图库;2:商品价格曲线"`
  25. EdbAliasName string `description:"中文别名"`
  26. IsConvert int `description:"是否数据转换 0不转 1转"`
  27. ConvertType int `description:"数据转换类型 1乘 2除 3对数"`
  28. ConvertValue float64 `description:"数据转换值"`
  29. ConvertUnit string `description:"数据转换单位"`
  30. ConvertEnUnit string `description:"数据转换单位"`
  31. }
  32. func GetChartEdbMappingTotal() (total int, err error) {
  33. o := orm.NewOrmUsingDB("data")
  34. sql := ` SELECT COUNT(1) AS count FROM chart_edb_mapping `
  35. err = o.Raw(sql).QueryRow(&total)
  36. return
  37. }
  38. func GetChartEdbMappingList(startSize, pageSize int) (items []*ChartEdbMapping, err error) {
  39. o := orm.NewOrmUsingDB("data")
  40. sql := ` SELECT * FROM chart_edb_mapping WHERE 1=1 `
  41. sql += " LIMIT ?,? "
  42. _, err = o.Raw(sql, startSize, pageSize).QueryRows(&items)
  43. return
  44. }
  45. type ChartEdbInfoMapping struct {
  46. EdbInfoId int `description:"指标id"`
  47. SourceName string `description:"来源名称"`
  48. Source int `description:"来源id"`
  49. SubSource int `description:"来源id"`
  50. EdbCode string `description:"指标编码"`
  51. EdbName string `description:"指标名称"`
  52. EdbAliasName string `description:"指标名称(别名)"`
  53. EdbNameEn string `description:"英文指标名称"`
  54. EdbAliasNameEn string `description:"英文指标名称(别名)"`
  55. EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
  56. Frequency string `description:"频率"`
  57. FrequencyEn string `description:"英文频率"`
  58. Unit string `description:"单位"`
  59. UnitEn string `description:"英文单位"`
  60. StartDate string `description:"起始日期"`
  61. EndDate string `description:"终止日期"`
  62. ModifyTime string `description:"指标最后更新时间"`
  63. ChartEdbMappingId int `description:"图表指标id"`
  64. ChartInfoId int `description:"图表id"`
  65. MaxData float64 `description:"上限"`
  66. MinData float64 `description:"下限"`
  67. IsOrder bool `description:"true:正序,false:逆序"`
  68. IsAxis int `description:"1:左轴,0:右轴"`
  69. EdbInfoType int `description:"1:标准指标,0:领先指标"`
  70. EdbInfoCategoryType int `description:"0:普通指标,1:预测指标"`
  71. LeadValue int `description:"领先值"`
  72. LeadUnit string `description:"领先单位"`
  73. LeadUnitEn string `description:"领先英文单位"`
  74. ChartStyle string `description:"图表类型"`
  75. ChartColor string `description:"颜色"`
  76. PredictChartColor string `description:"预测数据的颜色"`
  77. ChartWidth float64 `description:"线条大小"`
  78. ChartType int `description:"生成样式:1:曲线图,2:季节性图,3:面积图,4:柱状图,5:散点图,6:组合图,7:柱方图,8:商品价格曲线图,9:相关性图"`
  79. LatestDate string `description:"数据最新日期"`
  80. LatestValue float64 `description:"数据最新值"`
  81. MoveLatestDate string `description:"移动后的数据最新日期"`
  82. UniqueCode string `description:"指标唯一编码"`
  83. MinValue float64 `json:"-" description:"最小值"`
  84. MaxValue float64 `json:"-" description:"最大值"`
  85. DataList interface{}
  86. IsNullData bool `json:"-" description:"是否空数据"`
  87. MappingSource int `description:"1:ETA图库;2:商品价格曲线"`
  88. RegionType string `description:"交易所来源,海外还是国内" json:"-"`
  89. ClassifyId int `description:"分类id"`
  90. SubSourceName string `description:"子数据来源名称"`
  91. IndicatorCode string `description:"指标代码"`
  92. IsConvert int `description:"是否数据转换 0不转 1转"`
  93. ConvertType int `description:"数据转换类型 1乘 2除 3对数"`
  94. ConvertValue float64 `description:"数据转换值"`
  95. ConvertUnit string `description:"数据转换单位"`
  96. ConvertEnUnit string `description:"数据转换单位"`
  97. IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
  98. HaveOperaAuth bool `description:"是否有数据权限,默认:false"`
  99. }
  100. func GetRelationEdbInfoListMappingByCondition(condition string, pars []interface{}) (item []*ChartEdbInfoMapping, err error) {
  101. o := orm.NewOrmUsingDB("data")
  102. sql := ` SELECT a.* FROM edb_info AS a
  103. JOIN edb_info_calculate_mapping AS b on a.edb_info_id = b.edb_info_id WHERE 1=1 `
  104. if condition != "" {
  105. sql += condition
  106. }
  107. _, err = o.Raw(sql, pars).QueryRows(&item)
  108. return
  109. }