edb_info_update_log.go 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. package data_manage
  2. import (
  3. "eta_gn/eta_task/global"
  4. "time"
  5. )
  6. type EdbInfoUpdateLog struct {
  7. Id int `gorm:"column:id;primaryKey"` // `orm:"column(id);pk"`
  8. EdbInfoId int `description:"指标id"`
  9. SourceName string `description:"来源名称"`
  10. Source int `description:"来源id"`
  11. EdbCode string `description:"指标编码"`
  12. EdbName string `description:"指标名称"`
  13. EdbNameSource string `description:"指标名称来源"`
  14. Frequency string `description:"频率"`
  15. Unit string `description:"单位"`
  16. StartDate string `description:"起始日期"`
  17. EndDate string `description:"终止日期"`
  18. ClassifyId int `description:"分类id"`
  19. SysUserId int `description:"创建人"`
  20. SysUserRealName string `description:"创建人名称"`
  21. UpdateSysUserId int `description:"变更人"`
  22. UpdateSysUserRealName string `description:"变更人名称"`
  23. EdbModifyTime string `description:"指标修改时间"`
  24. UniqueCode string `description:"唯一编码"`
  25. LatestDate string `description:"数据最新日期"`
  26. LatestValue float64 `description:"数据最新值"`
  27. TerminalCode string `gorm:"column:terminal_code;default:'';comment:'终端编码,用于配置在机器上'"`
  28. CreateTime time.Time `gorm:"column:create_time;default:null;comment:'创建时间,即指标刷新/更新操作时间点'"`
  29. DataUpdateTime time.Time `gorm:"column:data_update_time;default:null;comment:'最近一次数据发生变化的时间'"`
  30. ErDataUpdateDate time.Time `gorm:"column:er_data_update_date;default:null;comment:'本次更新,数据发生变化的最早日期'"`
  31. UpdateResult int32 `gorm:"column:update_result;default:null;comment:'本次刷新操作结果:1成功,2失败'"`
  32. UpdateFailedReason string `gorm:"column:update_failed_reason;default:null;comment:'刷新失败原因'"`
  33. DataUpdateResult int32 `gorm:"column:data_update_result;not null;default:0;comment:'数据更新结果:1成功,2失败'"`
  34. DataUpdateFailedReason string `description:"数据未正常更新原因"`
  35. IsSourceRefresh int `description:"终端刷新到数据源的刷新操作:0否,1是"`
  36. UpdateType int `description:"变更类型,0:数据明细变更,1:基础信息变更, 2:新增指标"`
  37. }
  38. func GetEdbInfoUpdateLogByCondition(condition string, pars []interface{}) (item []*EdbInfoUpdateLog, err error) {
  39. //o := orm.NewOrmUsingDB("data")
  40. sql := ` SELECT * FROM edb_info_update_log WHERE 1=1 `
  41. if condition != "" {
  42. sql += condition
  43. }
  44. sql += `ORDER BY id ASC limit 0,10 `
  45. //_, err = o.Raw(sql, pars).QueryRows(&item)
  46. err = global.DmSQL["data"].Raw(sql, pars...).Find(&item).Error
  47. return
  48. }