base_from_coalmine.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type BaseFromCoalmineMapping struct {
  7. BaseFromCoalmineMappingId int `orm:"column(base_from_coalmine_mapping_id);pk"`
  8. IndexName string `description:"持买单量指标名称"`
  9. IndexCode string `description:"持买单量指标编码"`
  10. CreateTime time.Time `description:"时间"`
  11. }
  12. type BaseFromCoalmineJsmIndex struct {
  13. BaseFromCoalmineJsmIndexId int `orm:"column(base_from_coalmine_jsm_index_id);pk"`
  14. IndexName string `description:"持买单量指标名称"`
  15. IndexCode string `description:"持买单量指标编码"`
  16. Exchange string `description:"样本统计类别"`
  17. DealValue string `description:"成交量"`
  18. DataTime string `description:"数据日期"`
  19. Source string `description:"来源"`
  20. Province string `description:"省份"`
  21. Description string `description:"描述"`
  22. Unit string `description:"单位"`
  23. Frequency string `description:"频率"`
  24. CreateTime time.Time `description:"插入时间"`
  25. ModifyTime time.Time `description:"修改时间"`
  26. }
  27. type BaseFromCoalmineCompanyIndex struct {
  28. BaseFromCoalmineCompanyIndexId int `orm:"column(base_from_coalmine_company_index_id);pk"`
  29. IndexName string `description:"持买单量指标名称"`
  30. IndexCode string `description:"持买单量指标编码"`
  31. DealValue string `description:"成交量"`
  32. DataTime string `description:"数据日期"`
  33. Source string `description:"来源"`
  34. Province string `description:"省份"`
  35. City string `description:"城市"`
  36. GroupName string `description:"集团名称"`
  37. Unit string `description:"单位"`
  38. Frequency string `description:"频率"`
  39. CreateTime time.Time `description:"插入时间"`
  40. ModifyTime time.Time `description:"修改时间"`
  41. }
  42. //添加指标
  43. func AddBaseFromCoalmineMapping(item *BaseFromCoalmineMapping) (lastId int64, err error) {
  44. o := orm.NewOrm()
  45. lastId, err = o.Insert(item)
  46. return
  47. }
  48. //查询指标
  49. func GetBaseFromCoalmineMapping() (items []*BaseFromCoalmineMapping, err error) {
  50. o := orm.NewOrm()
  51. sql := `SELECT * FROM base_from_coalmine_mapping`
  52. _, err = o.Raw(sql).QueryRows(&items)
  53. return
  54. }
  55. //查询数据
  56. func GetBaseFromCoalmineIndex() (items []*BaseFromCoalmineJsmIndex, err error) {
  57. o := orm.NewOrm()
  58. sql := `SELECT * FROM base_from_coalmine_jsm_index`
  59. _, err = o.Raw(sql).QueryRows(&items)
  60. return
  61. }
  62. func UpdateBaseFromCoalmineIndex(item *BaseFromCoalmineJsmIndex) (err error) {
  63. o := orm.NewOrm()
  64. sql := `UPDATE base_from_coalmine_jsm_index SET deal_value=? WHERE index_name=? AND data_time = ?`
  65. _, err = o.Raw(sql, item.DealValue, item.IndexName, item.DataTime).Exec()
  66. return
  67. }
  68. //添加数据
  69. func AddBaseFromCoalmineIndex(item *BaseFromCoalmineJsmIndex) (lastId int64, err error) {
  70. o := orm.NewOrm()
  71. lastId, err = o.Insert(item)
  72. return
  73. }
  74. //添加公司指标
  75. func AddBaseFromCoalmineCompanyIndex(item *BaseFromCoalmineCompanyIndex) (lastId int64, err error) {
  76. o := orm.NewOrm()
  77. lastId, err = o.Insert(item)
  78. return
  79. }
  80. //查询公司指标
  81. func GetBaseFromCoalmineCompanyIndex() (items []*BaseFromCoalmineCompanyIndex, err error) {
  82. o := orm.NewOrm()
  83. sql := `SELECT * FROM base_from_coalmine_company_index`
  84. _, err = o.Raw(sql).QueryRows(&items)
  85. return
  86. }
  87. func UpdateBaseFromCoalmineCompanyIndex(item *BaseFromCoalmineCompanyIndex) (err error) {
  88. o := orm.NewOrm()
  89. sql := `UPDATE base_from_coalmine_company_index SET deal_value=? WHERE index_name=? AND data_time = ?`
  90. _, err = o.Raw(sql, item.DealValue, item.IndexName, item.DataTime).Exec()
  91. return
  92. }
  93. type CoalMineDataReq struct {
  94. SheetData []SheetData
  95. }
  96. type SheetData struct {
  97. Name string
  98. Rows []Row
  99. Cols []*Col
  100. MaxRow int
  101. MaxCol int
  102. Hidden bool
  103. Selected bool
  104. }
  105. type Row struct {
  106. Cells []Cell
  107. Hidden bool
  108. Height float64
  109. OutlineLevel uint8
  110. isCustom bool
  111. }
  112. type Col struct {
  113. Min int
  114. Max int
  115. Hidden bool
  116. Width float64
  117. Collapsed bool
  118. OutlineLevel uint8
  119. numFmt string
  120. }
  121. type Cell struct {
  122. Value string
  123. }