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