1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- package data_manage
- import (
- "github.com/rdlucklib/rdluck_tools/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:"线条大小"`
- }
- func AddChartEdbMapping(items []*ChartEdbMapping) (err error) {
- o := orm.NewOrm()
- o.Using("data")
- _, err = o.InsertMulti(1, items)
- return
- }
- func GetChartEdbMappingList(chartInfoId int) (list []*ChartEdbInfoMapping, err error) {
- o := orm.NewOrm()
- o.Using("data")
- sql := ` SELECT a.*,b.source_name,b.source,b.edb_code,b.edb_name,b.frequency,b.unit,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value,b.unique_code
- FROM chart_edb_mapping AS a
- INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
- WHERE chart_info_id=?
- ORDER BY chart_edb_mapping_id ASC `
- _, err = o.Raw(sql, chartInfoId).QueryRows(&list)
- return
- }
- func GetChartEdbMappingListByEdbInfoId(edbInfoStr string) (list []*ChartEdbInfoMapping, err error) {
- o := orm.NewOrm()
- o.Using("data")
- sql := ` SELECT *
- FROM edb_info
- WHERE edb_info_id IN(` + edbInfoStr + `)
- ORDER BY FIELD(edb_info_id,` + edbInfoStr + `)
- `
- _, err = o.Raw(sql).QueryRows(&list)
- return
- }
|