123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- package models
- import (
- "eta_gn/eta_task/global"
- "time"
- )
- //数据录入
- type EdbInfo struct {
- UserId int
- SecName string `orm:"column(SEC_NAME);" description:"指标名称"`
- NoticeTime string
- Frequency string
- TradeCode string `orm:"column(TRADE_CODE);" description:"指标编码"`
- }
- // GetEdbInfoByFrequencyNotDay 获取频度非日度 且 提醒时间不为空 的指标数据
- func GetEdbInfoByFrequencyNotDay() (items []*EdbInfo, err error) {
- //sql := `SELECT * FROM edbinfo WHERE frequency!="日度" AND notice_time<>'' and user_id>0 `
- //o := orm.NewOrmUsingDB("edb")
- //_, err = o.Raw(sql).QueryRows(&items)
- sql := `SELECT * FROM edbinfo WHERE frequency!="日度" AND notice_time<>'' and user_id>0 `
- err = global.DmSQL["edb"].Raw(sql).Find(&items).Error
- return
- }
- type Edbdata struct {
- TradeCode string `gorm:"column:TRADE_CODE;primaryKey"` // `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)
- sql := `SELECT * FROM edbdata WHERE TRADE_CODE=? order by DT desc `
- err = global.DmSQL["data"].Raw(sql, tradeCode).Find(&item).Error
- return
- }
|