edb_data_sci99.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package data_manage
  2. import (
  3. "fmt"
  4. "github.com/beego/beego/v2/client/orm"
  5. )
  6. type Sci99Data struct {
  7. InputValue string `orm:"column(DATA_VALUE)" description:"日期"`
  8. DataTime string `orm:"column(DATA_DATE)" description:"值"`
  9. }
  10. func GetEdbDataSci99MaxOrMinDate(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_sci99 WHERE edb_code=? `
  13. err = o.Raw(sql, edbCode).QueryRow(&minDate, &maxDate)
  14. return
  15. }
  16. type BaseFromSci99IndexItem struct {
  17. BaseFromSciIndexId int `orm:"column(base_from_sci99_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. // GetBaseInfoFromSci99ByIndexCode 获取指标信息
  28. func GetBaseInfoFromSci99ByIndexCode(indexCode string) (item *BaseFromSci99IndexItem, err error) {
  29. o := orm.NewOrmUsingDB("data")
  30. sql := `SELECT * FROM base_from_sci99_index WHERE index_code=? `
  31. sql = fmt.Sprintf(sql)
  32. err = o.Raw(sql, indexCode).QueryRow(&item)
  33. return
  34. }