package data_manage import ( "fmt" "github.com/beego/beego/v2/client/orm" ) type HisugarData struct { InputValue string `orm:"column(DATA_VALUE)" description:"日期"` DataTime string `orm:"column(DATA_DATE)" description:"值"` } func GetEdbDataHisugarMaxOrMinDate(edbCode string) (minDate, maxDate string, err error) { o := orm.NewOrmUsingDB("data") sql := ` SELECT MIN(data_time) AS minDate,MAX(data_time) AS maxDate FROM edb_data_hisugar WHERE edb_code=? ` err = o.Raw(sql, edbCode).QueryRow(&minDate, &maxDate) return } type BaseFromHisugarIndexItem struct { BaseFromSciIndexId int `orm:"column(base_from_hisugar_index_id);pk"` // 主键,自动递增 IndexCode string // 指标编码 IndexName string // 指标名称 ClassifyId int // 分类Id Unit string // 单位 Frequency string // 频度 Describe string // 指标描述 CreateTime string // 创建时间 ModifyTime string // 修改时间 } // GetBaseInfoFromHisugarByIndexCode 获取指标信息 func GetBaseInfoFromHisugarByIndexCode(indexCode string) (item *BaseFromHisugarIndexItem, err error) { o := orm.NewOrmUsingDB("data") sql := `SELECT * FROM base_from_hisugar_index WHERE index_code=? ` sql = fmt.Sprintf(sql) err = o.Raw(sql, indexCode).QueryRow(&item) return }