12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- package data_manage
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type BaseFromTradeShanghaiIndex struct {
- BaseFromTradeShangHaiIndexId int `orm:"column(base_from_trade_shanghai_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 AddBaseFromTradeShangHaiIndex(item *BaseFromTradeShanghaiIndex) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- func GetBaseFromTradeShangHaiIndexAll(dateStr string) (list []*BaseFromTradeShanghaiIndex, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM base_from_trade_shanghai_index WHERE data_time>=?`
- _, err = o.Raw(sql, dateStr).QueryRows(&list)
- return
- }
- func ModifyBaseFromTradeShangHaiIndex(dealValue, buyValue, soldValue int, dataId int) (err error) {
- o := orm.NewOrm()
- sql := `UPDATE base_from_trade_shanghai_index SET deal_value=?,buy_value=?,sold_value=?,modify_time=NOW() WHERE base_from_trade_shanghai_index_id=? `
- _, err = o.Raw(sql, dealValue, buyValue, soldValue, dataId).Exec()
- return
- }
- type ShanghaiIndexResp struct {
- Ret int
- Msg string
- ErrMsg string
- ErrCode string
- Data []*BaseFromTradeShanghaiIndex
- }
- func GetBaseFromTradeShangHaiIndexMaxDate() (max_date time.Time, err error) {
- o := orm.NewOrm()
- sql := ` SELECT max(a.data_time)as max_date FROM base_from_trade_shanghai_index as a `
- err = o.Raw(sql).QueryRow(&max_date)
- return
- }
|