1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- package data_manage
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- // MultipleGraphConfigChartMapping 图表与多图配置的关系表
- type MultipleGraphConfigChartMapping struct {
- Id int `orm:"column(id);pk"`
- MultipleGraphConfigId int `description:"多图配置id"`
- ChartInfoId int `description:"图表id"`
- Source int `description:"来源,1:曲线图,2:相关性图;3:滚动相关性图1;4:滚动相关性图2;"`
- ModifyTime time.Time `description:"最近一次修改时间"`
- CreateTime time.Time `description:"添加时间"`
- }
- // AddMultipleGraphConfigChartMapping 新增多图配置
- func AddMultipleGraphConfigChartMapping(item *MultipleGraphConfigChartMapping) (err error) {
- o := orm.NewOrmUsingDB("data")
- // 表格信息入库
- lastId, err := o.Insert(item)
- if err != nil {
- return
- }
- item.Id = int(lastId)
- return
- }
- // Update 更新 基础信息
- func (item *MultipleGraphConfigChartMapping) Update(cols []string) (err error) {
- o := orm.NewOrmUsingDB("data")
- _, err = o.Update(item, cols...)
- return
- }
- // GetMultipleGraphConfigChartMappingByIdAndSource 根据配置id和来源获取关联关系
- func GetMultipleGraphConfigChartMappingByIdAndSource(configId, source int) (item *MultipleGraphConfigChartMapping, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE multiple_graph_config_id = ? AND source = ? `
- err = o.Raw(sql, configId, source).QueryRow(&item)
- return
- }
- // GetMultipleGraphConfigChartMappingByChartId 根据图表id和来源获取关联关系
- func GetMultipleGraphConfigChartMappingByChartId(chartId int) (item *MultipleGraphConfigChartMapping, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE chart_info_id = ? `
- err = o.Raw(sql, chartId).QueryRow(&item)
- return
- }
- // GetMultipleGraphConfigChartMappingListById 根据配置id获取所有关联关系
- func GetMultipleGraphConfigChartMappingListById(configId int) (items []*MultipleGraphConfigChartMapping, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE multiple_graph_config_id = ? `
- _, err = o.Raw(sql, configId).QueryRows(&items)
- return
- }
|