index_notice.go 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. //数据录入
  7. type EdbInfo struct {
  8. UserId int
  9. SecName string `orm:"column(SEC_NAME);" description:"指标名称"`
  10. NoticeTime string
  11. Frequency string
  12. TradeCode string `orm:"column(TRADE_CODE);" description:"指标编码"`
  13. }
  14. // GetEdbInfoByFrequencyNotDay 获取频度非日度 且 提醒时间不为空 的指标数据
  15. func GetEdbInfoByFrequencyNotDay() (items []*EdbInfo, err error) {
  16. sql := `SELECT * FROM edbinfo WHERE frequency!="日度" AND notice_time<>'' and user_id>0 `
  17. o := orm.NewOrmUsingDB("edb")
  18. _, err = o.Raw(sql).QueryRows(&items)
  19. return
  20. }
  21. type Edbdata struct {
  22. TradeCode string `orm:"column(TRADE_CODE);pk" description:"指标编码"`
  23. Dt string `orm:"column(DT)" description:"日期"`
  24. Close string `orm:"column(CLOSE)" description:"值"`
  25. ModifyTime time.Time `orm:"column(modify_time)" description:"修改时间"`
  26. }
  27. // GetLastEdbdataInfo 根据指标编号获取指标最近的一条数据
  28. func GetLastEdbdataInfo(tradeCode string) (item *Edbdata, err error) {
  29. sql := `SELECT * FROM edbdata WHERE TRADE_CODE=? order by DT desc `
  30. o := orm.NewOrmUsingDB("edb")
  31. err = o.Raw(sql, tradeCode).QueryRow(&item)
  32. return
  33. }