123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- package data_manage
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type BaseFromTradeCffexIndex struct {
- BaseFromTradeCffexIndexId int `orm:"column(base_from_trade_cffex_index_id);pk"`
- Rank int
- DealShortName string
- DealName string
- DealCode string
- DealValue int
- DealChange int
- BuyShortName string
- BuyName string
- BuyCode string
- BuyValue int
- BuyChange int
- SoldShortName string
- SoldName string
- SoldCode string
- SoldValue int
- SoldChange int
- Frequency string
- ClassifyName string
- ClassifyType string
- CreateTime time.Time
- ModifyTime time.Time
- DataTime string
- }
- func AddBaseFromTradeCffexIndex(item *BaseFromTradeCffexIndex) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- func GetBaseFromTradeCffexIndexAll(dateStr string) (list []*BaseFromTradeCffexIndex, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM base_from_trade_cffex_index WHERE data_time=?`
- _, err = o.Raw(sql, dateStr).QueryRows(&list)
- return
- }
- func ModifyBaseFromTradeCffexIndex(columnList [5]string, dataList [5]interface{}, dataId int) (err error) {
- o := orm.NewOrm()
- sql := "UPDATE base_from_trade_cffex_index SET " +
- columnList[0] + "=?," + columnList[1] + "=?," + columnList[2] + "=?," + columnList[3] + "=?," + columnList[4] +
- "=?,modify_time=NOW() WHERE base_from_trade_cffex_index_id=? "
- _, err = o.Raw(sql, dataList[0], dataList[1], dataList[2], dataList[3], dataList[4], dataId).Exec()
- return
- }
- type CffexIndexResp struct {
- Ret int
- Msg string
- ErrMsg string
- ErrCode string
- Data []*BaseFromTradeCffexIndex
- }
- func GetBaseFromTradeCffexIndexMaxDate() (max_date time.Time, err error) {
- o := orm.NewOrm()
- sql := ` SELECT max(a.data_time)as max_date FROM base_from_trade_cffex_index as a `
- err = o.Raw(sql).QueryRow(&max_date)
- return
- }
|