123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- package data_manage
- import (
- "eta_gn/eta_chart_lib/global"
- "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:"添加时间"`
- // }
- // MultipleGraphConfig 多图配置表
- type MultipleGraphConfig struct {
- MultipleGraphConfigId int `gorm:"column:multiple_graph_config_id;primaryKey" description:"多图配置ID" orm:"column(multiple_graph_config_id);pk"`
- EdbInfoIdA int `gorm:"column:edb_info_id_a" description:"指标A"`
- EdbInfoIdB int `gorm:"column:edb_info_id_b" description:"指标B"`
- Curve string `gorm:"column:curve" description:"曲线图配置"`
- Correlation string `gorm:"column:correlation" description:"相关性配置"`
- RollingCorrelation string `gorm:"column:rolling_correlation" description:"滚动相关性配置"`
- SysUserId int `gorm:"column:sys_user_id" description:"操作人id"`
- SysUserRealName string `gorm:"column:sys_user_real_name" description:"操作人真实姓名"`
- ModifyTime time.Time `gorm:"column:modify_time" description:"最近一次修改时间"`
- CreateTime time.Time `gorm:"column:create_time" description:"添加时间"`
- }
- // AddMultipleGraphConfig 新增多图配置
- func AddMultipleGraphConfig(item *MultipleGraphConfig) (err error) {
- o := global.DmSQL["data"]
- // 表格信息入库
- err = o.Create(item).Error
- return
- }
- // Update 更新 基础信息
- func (item *MultipleGraphConfig) Update(cols []string) (err error) {
- o := global.DmSQL["data"]
- err = o.Model(item).Select(cols).Updates(item).Error
- return
- }
- // GetMultipleGraphConfigById 根据配置id获取配置
- func GetMultipleGraphConfigById(id int) (item *MultipleGraphConfig, err error) {
- o := global.DmSQL["data"]
- sql := `SELECT * FROM multiple_graph_config WHERE multiple_graph_config_id = ? `
- // 表格信息入库
- err = o.Raw(sql, id).First(&item).Error
- return
- }
- // 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:"计算频度"`
- }
|