package models import ( "github.com/beego/beego/v2/client/orm" "time" ) type BaseFromTradeZhengzhouIndex struct { BaseFromTradeZhengzhouIndexId int `orm:"column(base_from_trade_zhengzhou_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 AddBaseFromTradeZhengzhouIndex(item *BaseFromTradeZhengzhouIndex) (lastId int64, err error) { o := orm.NewOrmUsingDB("data") lastId, err = o.Insert(item) return } func GetBaseFromTradeZhengzhouIndexAll(dateStr string) (list []*BaseFromTradeZhengzhouIndex, err error) { o := orm.NewOrmUsingDB("data") sql := `SELECT * FROM base_from_trade_zhengzhou_index WHERE data_time=?` _, err = o.Raw(sql, dateStr).QueryRows(&list) return } func ModifyBaseFromTradeZhengzhouIndex(dealValue, buyValue, soldValue int, dataId int) (err error) { o := orm.NewOrmUsingDB("data") sql := `UPDATE base_from_trade_zhengzhou_index SET deal_value=?,buy_value=?,sold_value=?,modify_time=NOW() WHERE base_from_trade_zhengzhou_index_id=? ` _, err = o.Raw(sql, dealValue, buyValue, soldValue, dataId).Exec() return }