12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package data_manage
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- // MultipleGraphConfig 多图配置表
- type MultipleGraphConfig struct {
- MultipleGraphConfigId int `orm:"column(multiple_graph_config_id);pk"`
- EdbInfoIdA int `description:"指标A"`
- EdbInfoIdB int `description:"指标B"`
- Curve string `description:"曲线图配置"`
- Correlation string `description:"相关性配置"`
- RollingCorrelation string `description:"滚动相关性配置"`
- SysUserId int `description:"操作人id"`
- SysUserRealName string `description:"操作人真实姓名"`
- ModifyTime time.Time `description:"最近一次修改时间"`
- CreateTime time.Time `description:"添加时间"`
- }
- // AddMultipleGraphConfig 新增多图配置
- func AddMultipleGraphConfig(item *MultipleGraphConfig) (err error) {
- o := orm.NewOrmUsingDB("data")
- // 表格信息入库
- lastId, err := o.Insert(item)
- if err != nil {
- return
- }
- item.MultipleGraphConfigId = int(lastId)
- return
- }
- // Update 更新 基础信息
- func (item *MultipleGraphConfig) Update(cols []string) (err error) {
- o := orm.NewOrmUsingDB("data")
- _, err = o.Update(item, cols...)
- return
- }
- // GetMultipleGraphConfigById 根据配置id获取配置
- func GetMultipleGraphConfigById(id int) (item *MultipleGraphConfig, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM multiple_graph_config WHERE multiple_graph_config_id = ? `
- // 表格信息入库
- err = o.Raw(sql, id).QueryRow(&item)
- return
- }
- // CurveConfig 曲线图配置
- type CurveConfig struct {
- DateType int `description:"日期类型:1:00年至今,2:10年至今,3:15年至今,4:年初至今,5:自定义时间"`
- StartDate string `description:"自定义开始日期"`
- EndDate string `description:"自定义结束日期"`
- LeftMin float64 `description:"图表左侧最小值"`
- LeftMax float64 `description:"图表左侧最大值"`
- RightMin float64 `description:"图表右侧最小值"`
- RightMax float64 `description:"图表右侧最大值"`
- IsOrder bool `description:"true:正序,false:逆序"`
- EdbInfoType bool `description:"true:标准指标,false:领先指标"`
- LeadValue int `description:"领先值"`
- LeadUnit string `description:"领先单位"`
- }
- // CorrelationConfig 相关性配置
- type CorrelationConfig struct {
- LeadValue int `description:"领先期数"`
- LeadUnit string `description:"频度"`
- CalculateValue int `description:"计算窗口"`
- CalculateUnit string `description:"计算频度"`
- }
- // RollingCorrelationConfig 滚动相关性配置
- type RollingCorrelationConfig struct {
- LeadValue int `description:"领先期数"`
- LeadUnit string `description:"频度"`
- CalculateValue int `description:"计算窗口"`
- CalculateUnit string `description:"计算频度"`
- }
|