edbdata.go 681 B

123456789101112131415161718192021
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type Edbdata struct {
  7. TradeCode string `orm:"column(TRADE_CODE);pk" description:"指标编码"`
  8. Dt string `orm:"column(DT)" description:"日期"`
  9. Close string `orm:"column(CLOSE)" description:"值"`
  10. ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
  11. }
  12. // GetLastEdbdataInfo 根据指标编号获取指标最近的一条数据
  13. func GetLastEdbdataInfo(tradeCode string) (item *Edbdata, err error) {
  14. sql := `SELECT * FROM edbdata WHERE TRADE_CODE=? order by DT desc `
  15. o := orm.NewOrmUsingDB("edb")
  16. err = o.Raw(sql, tradeCode).QueryRow(&item)
  17. return
  18. }