multiple_graph_config.go 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. package data_manage
  2. import (
  3. "eta_gn/eta_chart_lib/global"
  4. "time"
  5. )
  6. type MultipleGraphConfig struct {
  7. MultipleGraphConfigId int `gorm:"column:multiple_graph_config_id;primaryKey" description:"多图配置ID" orm:"column(multiple_graph_config_id);pk"`
  8. EdbInfoIdA int `gorm:"column:edb_info_id_a" description:"指标A"`
  9. EdbInfoIdB int `gorm:"column:edb_info_id_b" description:"指标B"`
  10. Curve string `gorm:"column:curve" description:"曲线图配置"`
  11. Correlation string `gorm:"column:correlation" description:"相关性配置"`
  12. RollingCorrelation string `gorm:"column:rolling_correlation" description:"滚动相关性配置"`
  13. SysUserId int `gorm:"column:sys_user_id" description:"操作人id"`
  14. SysUserRealName string `gorm:"column:sys_user_real_name" description:"操作人真实姓名"`
  15. ModifyTime time.Time `gorm:"column:modify_time" description:"最近一次修改时间"`
  16. CreateTime time.Time `gorm:"column:create_time" description:"添加时间"`
  17. }
  18. func AddMultipleGraphConfig(item *MultipleGraphConfig) (err error) {
  19. o := global.DmSQL["data"]
  20. err = o.Create(item).Error
  21. return
  22. }
  23. func (item *MultipleGraphConfig) Update(cols []string) (err error) {
  24. o := global.DmSQL["data"]
  25. err = o.Model(item).Select(cols).Updates(item).Error
  26. return
  27. }
  28. func GetMultipleGraphConfigById(id int) (item *MultipleGraphConfig, err error) {
  29. o := global.DmSQL["data"]
  30. sql := `SELECT * FROM multiple_graph_config WHERE multiple_graph_config_id = ? `
  31. err = o.Raw(sql, id).First(&item).Error
  32. return
  33. }
  34. type CurveConfig struct {
  35. DateType int `description:"日期类型:1:00年至今,2:10年至今,3:15年至今,4:年初至今,5:自定义时间"`
  36. StartDate string `description:"自定义开始日期"`
  37. EndDate string `description:"自定义结束日期"`
  38. LeftMin float64 `description:"图表左侧最小值"`
  39. LeftMax float64 `description:"图表左侧最大值"`
  40. RightMin float64 `description:"图表右侧最小值"`
  41. RightMax float64 `description:"图表右侧最大值"`
  42. IsOrder bool `description:"true:正序,false:逆序"`
  43. EdbInfoType bool `description:"true:标准指标,false:领先指标"`
  44. LeadValue int `description:"领先值"`
  45. LeadUnit string `description:"领先单位"`
  46. }
  47. type CorrelationConfig struct {
  48. LeadValue int `description:"领先期数"`
  49. LeadUnit string `description:"频度"`
  50. CalculateValue int `description:"计算窗口"`
  51. CalculateUnit string `description:"计算频度"`
  52. }
  53. type RollingCorrelationConfig struct {
  54. LeadValue int `description:"领先期数"`
  55. LeadUnit string `description:"频度"`
  56. CalculateValue int `description:"计算窗口"`
  57. CalculateUnit string `description:"计算频度"`
  58. }