package data_manage import ( "fmt" "github.com/beego/beego/v2/client/orm" ) type OilchemData struct { InputValue string `orm:"column(DATA_VALUE)" description:"日期"` DataTime string `orm:"column(DATA_DATE)" description:"值"` } func GetEdbDataOilchemMaxOrMinDate(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_oilchem WHERE edb_code=? ` err = o.Raw(sql, edbCode).QueryRow(&minDate, &maxDate) return } type BaseFromOilchemIndexItem struct { BaseFromSciIndexId int `orm:"column(base_from_oilchem_index_id);pk"` // 主键,自动递增 IndexCode string // 指标编码 IndexName string // 指标名称 ClassifyId int // 分类Id Unit string // 单位 Frequency string // 频度 Describe string // 指标描述 CreateTime string // 创建时间 ModifyTime string // 修改时间 } // GetBaseInfoFromOilchemByIndexCode 获取指标信息 func GetBaseInfoFromOilchemByIndexCode(indexCode string) (item *BaseFromOilchemIndexItem, err error) { o := orm.NewOrmUsingDB("data") sql := `SELECT * FROM base_from_oilchem_index WHERE index_code=? ` sql = fmt.Sprintf(sql) err = o.Raw(sql, indexCode).QueryRow(&item) return }