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