package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type ChartEdbMapping struct { ChartEdbMappingId int `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:"颜色"` ChartWidth float64 `description:"线条大小"` Source int `description:"1:ETA图库;2:商品价格曲线"` } // GetChartEdbMappingListByEdbInfoId 根据指标id获取关联图表列表 func GetChartEdbMappingListByEdbInfoId(edbInfoId int) (list []*ChartEdbMapping, err error) { o := orm.NewOrm() sql := ` SELECT * FROM chart_edb_mapping AS a WHERE edb_info_id=? ORDER BY chart_edb_mapping_id ASC ` _, err = o.Raw(sql, edbInfoId).QueryRows(&list) return } // GetGroupChartEdbMappingListByEdbInfoId 根据指标id和来源分组获取关联图表列表 func GetGroupChartEdbMappingListByEdbInfoId(edbInfoId, source int) (list []*ChartEdbMapping, err error) { o := orm.NewOrm() sql := ` SELECT * FROM chart_edb_mapping AS a WHERE edb_info_id=? AND source = ? GROUP BY chart_info_id ` _, err = o.Raw(sql, edbInfoId, source).QueryRows(&list) return }