package models import "github.com/beego/beego/v2/client/orm" //数据录入 type EdbInfo struct { UserId int SecName string `orm:"column(SEC_NAME);" description:"指标名称"` NoticeTime string Frequency string TradeCode string `orm:"column(TRADE_CODE);" description:"指标编码"` } //获取日度指标 func GetEdbInfoByFrequency(frequency string) (items []*EdbInfo, err error) { sql := `SELECT * FROM edbinfo WHERE frequency=? AND notice_time<>'' ` o := orm.NewOrmUsingDB("edb") _, err = o.Raw(sql, frequency).QueryRows(&items) return } //获取日度指标 func GetEdbInfoByFrequencyWeek(frequency, weekDay string) (items []*EdbInfo, err error) { sql := `SELECT * FROM edbinfo WHERE frequency=? AND notice_time<>'' AND left(notice_time,2)=? ` o := orm.NewOrmUsingDB("edb") _, err = o.Raw(sql, frequency, weekDay).QueryRows(&items) return } func GetEdbdataCount(tradeCode, nowDate string) (count int, err error) { sql := `SELECT COUNT(1) AS count FROM edbdata WHERE TRADE_CODE=? AND DT=? ` o := orm.NewOrmUsingDB("edb") err = o.Raw(sql, tradeCode, nowDate).QueryRow(&count) return } // 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) return }