edb_info_delete_log.go 5.2 KB

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