edb_info_delete_log.go 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. package data_stat
  2. import (
  3. "eta/eta_api/global"
  4. "eta/eta_api/utils"
  5. "github.com/rdlucklib/rdluck_tools/paging"
  6. )
  7. // EdbInfoDeleteLog 指标删除日志表
  8. type EdbInfoDeleteLog struct {
  9. Id uint64 `orm:"column(id);pk" gorm:"primaryKey"`
  10. EdbInfoId int `description:"指标ID"`
  11. EdbInfoType int `description:"指标类型,0:普通指标,1:预测指标"`
  12. SourceName string `description:"来源名称"`
  13. Source int `description:"来源id"`
  14. EdbCode string `description:"指标编码"`
  15. EdbName string `description:"指标名称"`
  16. EdbNameEn string `description:"英文指标名称"`
  17. EdbNameSource string `description:"指标名称来源"`
  18. Frequency string `description:"频率"`
  19. Unit string `description:"单位"`
  20. UnitEn string `description:"英文单位"`
  21. StartDate string `description:"起始日期"`
  22. EndDate string `description:"终止日期"`
  23. SysUserId int `description:"创建人ID"`
  24. SysUserRealName string `description:"创建人姓名"`
  25. UniqueCode string `description:"指标唯一编码"`
  26. EdbCreateTime string `description:"指标创建时间"`
  27. EdbModifyTime string `description:"指标修改时间"`
  28. CreateTime string `description:"创建时间即删除时间"`
  29. MinValue float64 `description:"指标最小值"`
  30. MaxValue float64 `description:"指标最大值"`
  31. CalculateFormula string `description:"计算公式"`
  32. EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
  33. LatestDate string `description:"数据最新日期"`
  34. LatestValue float64 `description:"数据最新值"`
  35. MoveType int `description:"移动方式:1:领先(默认),2:滞后"`
  36. MoveFrequency string `description:"移动频度"`
  37. NoUpdate int8 `description:"是否停止更新,0:继续更新;1:停止更新"`
  38. ChartImage string `description:"图表图片"`
  39. Calendar string `description:"公历/农历" orm:"default(公历);"`
  40. DataDateType string `orm:"column(data_date_type);size(255);null;default(交易日)"`
  41. ManualSave int `description:"是否有手动保存过上下限: 0-否; 1-是"`
  42. TerminalCode string `description:"终端编码,用于配置在机器上"`
  43. DelSysUserId int `description:"删除人ID"`
  44. DelSysUserRealName string `description:"删除人姓名"`
  45. DataUpdateTime string `description:"最近一次数据发生变化的时间"`
  46. ErDataUpdateDate string `description:"本次更新,数据发生变化的最早日期"`
  47. }
  48. type EdbInfoDeleteLogItem struct {
  49. Id uint64 `orm:"column(id);"`
  50. EdbInfoId int `description:"指标ID"`
  51. EdbInfoType int `description:"指标类型,0:普通指标,1:预测指标"`
  52. SourceName string `description:"来源名称"`
  53. Source int `description:"来源id"`
  54. EdbCode string `description:"指标编码"`
  55. EdbName string `description:"指标名称"`
  56. EdbNameEn string `description:"英文指标名称"`
  57. EdbNameSource string `description:"指标名称来源"`
  58. Frequency string `description:"频率"`
  59. Unit string `description:"单位"`
  60. StartDate string `description:"起始日期"`
  61. EndDate string `description:"终止日期"`
  62. SysUserId int `description:"创建人ID"`
  63. SysUserRealName string `description:"创建人姓名"`
  64. EdbCreateTime string `description:"指标创建时间"`
  65. CreateTime string `description:"创建时间即删除时间"`
  66. LatestDate string `description:"数据最新日期"`
  67. LatestValue float64 `description:"数据最新值"`
  68. TerminalCode string `description:"终端编码,用于配置在机器上"`
  69. DelSysUserId int `description:"删除人ID"`
  70. DelSysUserRealName string `description:"删除人姓名"`
  71. DataUpdateTime string `description:"最近一次数据发生变化的时间"`
  72. ErDataUpdateDate string `description:"本次更新,数据发生变化的最早日期"`
  73. }
  74. func AddEdbDeleteLog(item *EdbInfoDeleteLog) (lastId int64, err error) {
  75. o := global.DbMap[utils.DbNameIndex]
  76. err = o.Create(item).Error
  77. if err != nil {
  78. return
  79. }
  80. lastId = int64(item.Id)
  81. return
  82. }
  83. type GetEdbDeleteLogResp struct {
  84. List []*EdbInfoDeleteLogItem
  85. Paging *paging.PagingItem
  86. }
  87. func GetEdbDeleteLogByCondition(condition string, pars []interface{}, orderStr string, pageSize, startSize int) (item []*EdbInfoDeleteLog, err error) {
  88. o := global.DbMap[utils.DbNameIndex]
  89. sql := ` SELECT * FROM edb_info_delete_log WHERE 1=1 `
  90. if condition != "" {
  91. sql += condition
  92. }
  93. if orderStr != "" {
  94. sql += orderStr
  95. } else {
  96. sql += ` ORDER BY create_time DESC, id DESC `
  97. }
  98. sql += ` LIMIT ?,? `
  99. pars = append(pars, startSize, pageSize)
  100. err = o.Raw(sql, pars...).Find(&item).Error
  101. return
  102. }
  103. // GetEdbDeleteLogCount
  104. func GetEdbDeleteLogCount(condition string, pars []interface{}) (count int, err error) {
  105. o := global.DbMap[utils.DbNameIndex]
  106. sql := ` SELECT count(*) FROM edb_info_delete_log WHERE 1=1 `
  107. if condition != "" {
  108. sql += condition
  109. }
  110. err = o.Raw(sql, pars...).Scan(&count).Error
  111. return
  112. }