multiple_graph_config.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. package data_manage
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. // MultipleGraphConfig 多图配置表
  7. type MultipleGraphConfig struct {
  8. MultipleGraphConfigId int `orm:"column(multiple_graph_config_id);pk"`
  9. EdbInfoIdA int `description:"指标A"`
  10. EdbInfoIdB int `description:"指标B"`
  11. Curve string `description:"曲线图配置"`
  12. Correlation string `description:"相关性配置"`
  13. RollingCorrelation string `description:"滚动相关性配置"`
  14. SysUserId int `description:"操作人id"`
  15. SysUserRealName string `description:"操作人真实姓名"`
  16. ModifyTime time.Time `description:"最近一次修改时间"`
  17. CreateTime time.Time `description:"添加时间"`
  18. }
  19. // AddMultipleGraphConfig 新增多图配置
  20. func AddMultipleGraphConfig(item *MultipleGraphConfig) (err error) {
  21. o := orm.NewOrmUsingDB("data")
  22. // 表格信息入库
  23. lastId, err := o.Insert(item)
  24. if err != nil {
  25. return
  26. }
  27. item.MultipleGraphConfigId = int(lastId)
  28. return
  29. }
  30. // Update 更新 基础信息
  31. func (item *MultipleGraphConfig) Update(cols []string) (err error) {
  32. o := orm.NewOrmUsingDB("data")
  33. _, err = o.Update(item, cols...)
  34. return
  35. }
  36. // GetMultipleGraphConfigById 根据配置id获取配置
  37. func GetMultipleGraphConfigById(id int) (item *MultipleGraphConfig, err error) {
  38. o := orm.NewOrmUsingDB("data")
  39. sql := `SELECT * FROM multiple_graph_config WHERE multiple_graph_config_id = ? `
  40. // 表格信息入库
  41. err = o.Raw(sql, id).QueryRow(&item)
  42. return
  43. }
  44. // CurveConfig 曲线图配置
  45. type CurveConfig struct {
  46. DateType int `description:"日期类型:1:00年至今,2:10年至今,3:15年至今,4:年初至今,5:自定义时间"`
  47. StartDate string `description:"自定义开始日期"`
  48. EndDate string `description:"自定义结束日期"`
  49. LeftMin float64 `description:"图表左侧最小值"`
  50. LeftMax float64 `description:"图表左侧最大值"`
  51. RightMin float64 `description:"图表右侧最小值"`
  52. RightMax float64 `description:"图表右侧最大值"`
  53. IsOrder bool `description:"true:正序,false:逆序"`
  54. EdbInfoType bool `description:"true:标准指标,false:领先指标"`
  55. LeadValue int `description:"领先值"`
  56. LeadUnit string `description:"领先单位"`
  57. }
  58. // CorrelationConfig 相关性配置
  59. type CorrelationConfig struct {
  60. LeadValue int `description:"领先期数"`
  61. LeadUnit string `description:"频度"`
  62. CalculateValue int `description:"计算窗口"`
  63. CalculateUnit string `description:"计算频度"`
  64. }
  65. // RollingCorrelationConfig 滚动相关性配置
  66. type RollingCorrelationConfig struct {
  67. LeadValue int `description:"领先期数"`
  68. LeadUnit string `description:"频度"`
  69. CalculateValue int `description:"计算窗口"`
  70. CalculateUnit string `description:"计算频度"`
  71. }