package models import "github.com/beego/beego/v2/client/orm" type BaseFromTradeGuangzhouContract struct { BaseFromTradeGuangzhouContractId int `orm:"column(base_from_trade_guangzhou_contract_id);pk"` BaseFromTradeGuangzhouClassifyId int `description:"分类id"` ClassifyCode string `description:"分类编码"` Contract string `description:"合约编码"` TradeDate string `description:"合约日期"` } type ContractListReq struct { Source int `description:"渠道编码"` } // 获取所有合约 func (obj *BaseFromTradeGuangzhouIndex) GetBaseFromTradeGuangzhouContract(tradeDate string) (list []*BaseFromTradeGuangzhouContract, err error) { o := orm.NewOrm() if tradeDate != "" { sql := ` SELECT * FROM base_from_trade_guangzhou_contract WHERE trade_date=? ` _, err = o.Raw(sql, tradeDate).QueryRows(&list) return } else { sql := ` SELECT * FROM base_from_trade_guangzhou_contract ` _, err = o.Raw(sql).QueryRows(&list) return } }