edb_info_updates.go 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. package data_manage
  2. import (
  3. "eta_gn/eta_api/global"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. )
  6. type UpdatesStatisticalItem struct {
  7. Total int
  8. Source int
  9. EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
  10. }
  11. func GetUpdatesStatistical(condition string, pars []interface{}) (list []*UpdatesStatisticalItem, err error) {
  12. sql := ` SELECT COUNT(1) AS total,source,edb_type FROM edb_info
  13. WHERE 1=1 `
  14. sql += condition
  15. sql += ` GROUP BY source `
  16. err = global.DmSQL["data"].Raw(sql, pars...).Scan(&list).Error
  17. return
  18. }
  19. type UpdatesStatisticalResp struct {
  20. ThsUpdate int `description:"同花顺已更新"`
  21. ThsNotUpdate int `description:"同花顺未更新"`
  22. WindUpdate int `description:"wind已更新"`
  23. WindNotUpdate int `description:"wind未更新"`
  24. PbUpdate int `description:"彭博已更新"`
  25. PbNotUpdate int `description:"彭博未更新"`
  26. PbFinanceUpdate int `description:"彭博财务已更新"`
  27. PbFinanceNotUpdate int `description:"彭博财务未更新"`
  28. LzUpdate int `description:"隆众已更新"`
  29. LzNotUpdate int `description:"隆众未更新"`
  30. SmmUpdate int `description:"Smm已更新"`
  31. SmmNotUpdate int `description:"Smm未更新"`
  32. MysteelUpdate int `description:"钢联已更新"`
  33. MysteelNotUpdate int `description:"钢联未更新"`
  34. ZzUpdate int `description:"郑商所已更新"`
  35. ZzNotUpdate int `description:"郑商所未更新"`
  36. DlUpdate int `description:"大商所已更新"`
  37. DlNotUpdate int `description:"大商所未更新"`
  38. ShUpdate int `description:"上期所已更新"`
  39. ShNotUpdate int `description:"上期所未更新"`
  40. CffexUpdate int `description:"中金所已更新"`
  41. CffexNotUpdate int `description:"中金所未更新"`
  42. ShfeUpdate int `description:"上期能源已更新"`
  43. ShfeNotUpdate int `description:"上期能源未更新"`
  44. GieUpdate int `description:"欧洲天然气已更新"`
  45. GieNotUpdate int `description:"欧洲天然气未更新"`
  46. CalculateUpdate int `description:"计算指标已更新"`
  47. CalculateNotUpdate int `description:"计算指标未更新"`
  48. ManualUpdate int `description:"手工指标已更新"`
  49. ManualNotUpdate int `description:"手工指标未更新"`
  50. LtUpdate int `description:"路透已更新"`
  51. LtNotUpdate int `description:"路透未更新"`
  52. CoalUpdate int `description:"煤炭网已更新"`
  53. CoalNotUpdate int `description:"煤炭网未更新"`
  54. GoogleTravelUpdate int `description:"谷歌出行已更新"`
  55. GoogleTravelNotUpdate int `description:"谷歌出行未更新"`
  56. EiaSteoUpdate int `description:"eia steo报告已更新"`
  57. EiaSteoNotUpdate int `description:"eia steo报告未更新"`
  58. UNUpdate int `description:"UN报告已更新"`
  59. UNNotUpdate int `description:"UN报告未更新"`
  60. SciUpdate int `description:"卓创数据已更新"`
  61. SciNotUpdate int `description:"卓创数据未更新"`
  62. BaiinfoUpdate int `description:"百川盈孚数据已更新"`
  63. BaiinfoNotUpdate int `description:"百川盈孚数据未更新"`
  64. NationalStatisticsUpdate int `description:"国家统计局数据已更新"`
  65. NationalStatisticsNotUpdate int `description:"国家统计局数据未更新"`
  66. FubaoUpdate int `description:"富宝已更新"`
  67. FubaoNotUpdate int `description:"富宝未更新"`
  68. }
  69. func GetUpdatesList(condition string, pars []interface{}, startSize, pageSize int) (list []*EdbInfoView, err error) {
  70. sql := ` SELECT * FROM edb_info
  71. WHERE 1=1 `
  72. sql += condition
  73. sql += ` LIMIT ?,? `
  74. pars = append(pars, startSize)
  75. pars = append(pars, pageSize)
  76. err = global.DmSQL["data"].Raw(sql, pars...).Scan(&list).Error
  77. return
  78. }
  79. // GetAllUpdatesList 获取所有待更新的指标
  80. func GetAllUpdatesList() (list []*EdbInfoView, err error) {
  81. o := global.DmSQL["data"]
  82. sql := ` SELECT * FROM edb_info
  83. WHERE 1=1 AND is_update=? AND no_update=? AND edb_info_type = ? ORDER BY edb_type ASC `
  84. err = o.Raw(sql, 1, 0, 0).Scan(&list).Error
  85. return
  86. }
  87. func GetUpdatesListTotal(condition string, pars []interface{}) (count int, err error) {
  88. o := global.DmSQL["data"]
  89. sql := ` SELECT COUNT(1) AS count FROM edb_info
  90. WHERE 1=1 `
  91. sql += condition
  92. err = o.Raw(sql, pars...).Scan(&count).Error
  93. return
  94. }
  95. type UpdatesListResp struct {
  96. List []*EdbInfoView
  97. Total int
  98. Paging *paging.PagingItem
  99. }