edb_data_oilchem.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package data_manage
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/client/orm"
  5. )
  6. type OilchemData struct {
  7. InputValue string `orm:"column(DATA_VALUE)" description:"日期"`
  8. DataTime string `orm:"column(DATA_DATE)" description:"值"`
  9. }
  10. func GetEdbDataOilchemMaxOrMinDate(edbCode string) (minDate, maxDate string, err error) {
  11. o := orm.NewOrmUsingDB("data")
  12. sql := ` SELECT MIN(data_time) AS minDate,MAX(data_time) AS maxDate FROM edb_data_oilchem WHERE edb_code=? `
  13. err = o.Raw(sql, edbCode).QueryRow(&minDate, &maxDate)
  14. return
  15. }
  16. type BaseFromOilchemIndexItem struct {
  17. BaseFromSciIndexId int `orm:"column(base_from_oilchem_index_id);pk"` // 主键,自动递增
  18. IndexCode string // 指标编码
  19. IndexName string // 指标名称
  20. ClassifyId int // 分类Id
  21. Unit string // 单位
  22. Frequency string // 频度
  23. Describe string // 指标描述
  24. CreateTime string // 创建时间
  25. ModifyTime string // 修改时间
  26. }
  27. // GetBaseInfoFromOilchemByIndexCode 获取指标信息
  28. func GetBaseInfoFromOilchemByIndexCode(indexCode string) (item *BaseFromOilchemIndexItem, err error) {
  29. o := orm.NewOrmUsingDB("data")
  30. sql := `SELECT * FROM base_from_oilchem_index WHERE index_code=? `
  31. sql = fmt.Sprintf(sql)
  32. err = o.Raw(sql, indexCode).QueryRow(&item)
  33. return
  34. }