123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type BaseFromTradeIneIndex struct {
- BaseFromTradeIneIndexId int `orm:"column(base_from_trade_ine_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 AddBaseFromTradeIneIndex(item *BaseFromTradeIneIndex) (lastId int64, err error) {
- o := orm.NewOrmUsingDB("data")
- lastId, err = o.Insert(item)
- return
- }
- func GetBaseFromTradeIneIndexAll(dateStr string) (list []*BaseFromTradeIneIndex, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM base_from_trade_ine_index where data_time=?`
- _, err = o.Raw(sql, dateStr).QueryRows(&list)
- return
- }
- func ModifyBaseFromTradeIneIndex(dealValue, buyValue, soldValue int, dataId int) (err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `UPDATE base_from_trade_ine_index SET deal_value=?,buy_value=?,sold_value=?,modify_time=NOW() WHERE base_from_trade_ine_index_id=? `
- _, err = o.Raw(sql, dealValue, buyValue, soldValue, dataId).Exec()
- return
- }
- func GetIndexCodeFromMapping(exchange string) (list []*BaseFromTradeMapping, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM base_from_trade_mapping where exchange=?`
- _, err = o.Raw(sql, exchange).QueryRows(&list)
- return
- }
- func AddBaseFromTradeMapping(indexName, indexCode, exchange string) (err error) {
- o := orm.NewOrmUsingDB("data")
- sql := "Insert Into base_from_trade_mapping(index_name,index_code,exchange) Values('" + indexName + "','" + indexCode + "','" + exchange + "')"
- _, err = o.Raw(sql).Exec()
- return
- }
|