package data_manage import ( "eta_gn/eta_task/global" "time" ) type ChartEdbMapping struct { ChartEdbMappingId int `gorm:"column:chart_edb_mapping_id;primaryKey"` // `orm:"column(chart_edb_mapping_id);pk"` ChartInfoId int `description:"图表id"` EdbInfoId int `description:"指标id"` CreateTime time.Time `description:"创建时间"` ModifyTime time.Time `description:"修改时间"` UniqueCode string `description:"唯一编码"` MaxData float64 `description:"上限"` MinData float64 `description:"下限"` IsOrder bool `description:"true:正序,false:逆序"` IsAxis int `description:"true:左轴,false:右轴"` EdbInfoType int `description:"true:标准指标,false:领先指标"` LeadValue int `description:"领先值"` LeadUnit string `description:"领先单位"` ChartStyle string `description:"图表类型"` ChartColor string `description:"颜色"` PredictChartColor string `description:"预测数据的颜色"` ChartWidth float64 `description:"线条大小"` Source int `description:"1:ETA图库;2:商品价格曲线"` EdbAliasName string `description:"中文别名"` IsConvert int `description:"是否数据转换 0不转 1转"` ConvertType int `description:"数据转换类型 1乘 2除 3对数"` ConvertValue float64 `description:"数据转换值"` ConvertUnit string `description:"数据转换单位"` ConvertEnUnit string `description:"数据转换单位"` } func GetChartEdbMappingTotal() (total int, err error) { //o := orm.NewOrmUsingDB("data") sql := ` SELECT COUNT(1) AS count FROM chart_edb_mapping ` //err = o.Raw(sql).QueryRow(&total) err = global.DmSQL["data"].Raw(sql).Scan(&total).Error return } func GetChartEdbMappingList(startSize, pageSize int) (items []*ChartEdbMapping, err error) { //o := orm.NewOrmUsingDB("data") sql := ` SELECT * FROM chart_edb_mapping WHERE 1=1 ` sql += " LIMIT ?,? " //_, err = o.Raw(sql, startSize, pageSize).QueryRows(&items) err = global.DEFAULT_DmSQL.Raw(sql, startSize, pageSize).Find(&items).Error return } type ChartEdbInfoMapping struct { EdbInfoId int `description:"指标id"` SourceName string `description:"来源名称"` Source int `description:"来源id"` SubSource int `description:"来源id"` EdbCode string `description:"指标编码"` EdbName string `description:"指标名称"` EdbAliasName string `description:"指标名称(别名)"` EdbNameEn string `description:"英文指标名称"` EdbAliasNameEn string `description:"英文指标名称(别名)"` EdbType int `description:"指标类型:1:基础指标,2:计算指标"` Frequency string `description:"频率"` FrequencyEn string `description:"英文频率"` Unit string `description:"单位"` UnitEn string `description:"英文单位"` StartDate string `description:"起始日期"` EndDate string `description:"终止日期"` ModifyTime string `description:"指标最后更新时间"` ChartEdbMappingId int `description:"图表指标id"` ChartInfoId int `description:"图表id"` MaxData float64 `description:"上限"` MinData float64 `description:"下限"` IsOrder bool `description:"true:正序,false:逆序"` IsAxis int `description:"1:左轴,0:右轴"` EdbInfoType int `description:"1:标准指标,0:领先指标"` EdbInfoCategoryType int `description:"0:普通指标,1:预测指标"` LeadValue int `description:"领先值"` LeadUnit string `description:"领先单位"` LeadUnitEn string `description:"领先英文单位"` ChartStyle string `description:"图表类型"` ChartColor string `description:"颜色"` PredictChartColor string `description:"预测数据的颜色"` ChartWidth float64 `description:"线条大小"` ChartType int `description:"生成样式:1:曲线图,2:季节性图,3:面积图,4:柱状图,5:散点图,6:组合图,7:柱方图,8:商品价格曲线图,9:相关性图"` LatestDate string `description:"数据最新日期"` LatestValue float64 `description:"数据最新值"` MoveLatestDate string `description:"移动后的数据最新日期"` UniqueCode string `description:"指标唯一编码"` MinValue float64 `json:"-" description:"最小值"` MaxValue float64 `json:"-" description:"最大值"` DataList interface{} IsNullData bool `json:"-" description:"是否空数据"` MappingSource int `description:"1:ETA图库;2:商品价格曲线"` RegionType string `description:"交易所来源,海外还是国内" json:"-"` ClassifyId int `description:"分类id"` SubSourceName string `description:"子数据来源名称"` IndicatorCode string `description:"指标代码"` IsConvert int `description:"是否数据转换 0不转 1转"` ConvertType int `description:"数据转换类型 1乘 2除 3对数"` ConvertValue float64 `description:"数据转换值"` ConvertUnit string `description:"数据转换单位"` ConvertEnUnit string `description:"数据转换单位"` IsJoinPermission int `description:"是否加入权限管控,0:不加入;1:加入;默认:0"` HaveOperaAuth bool `description:"是否有数据权限,默认:false"` } func GetRelationEdbInfoListMappingByCondition(condition string, pars []interface{}) (item []*ChartEdbInfoMapping, err error) { //o := orm.NewOrmUsingDB("data") sql := ` SELECT a.* FROM edb_info AS a JOIN edb_info_calculate_mapping AS b on a.edb_info_id = b.edb_info_id WHERE 1=1 ` if condition != "" { sql += condition } //_, err = o.Raw(sql, pars).QueryRows(&item) err = global.DmSQL["data"].Raw(sql, pars...).Find(&item).Error return }