contract.go 1.0 KB

1234567891011121314151617181920212223242526272829
  1. package models
  2. import "github.com/beego/beego/v2/client/orm"
  3. type BaseFromTradeGuangzhouContract struct {
  4. BaseFromTradeGuangzhouContractId int `orm:"column(base_from_trade_guangzhou_contract_id);pk"`
  5. BaseFromTradeGuangzhouClassifyId int `description:"分类id"`
  6. ClassifyCode string `description:"分类编码"`
  7. Contract string `description:"合约编码"`
  8. TradeDate string `description:"合约日期"`
  9. }
  10. type ContractListReq struct {
  11. Source int `description:"渠道编码"`
  12. }
  13. // 获取所有合约
  14. func (obj *BaseFromTradeGuangzhouIndex) GetBaseFromTradeGuangzhouContract(tradeDate string) (list []*BaseFromTradeGuangzhouContract, err error) {
  15. o := orm.NewOrm()
  16. if tradeDate != "" {
  17. sql := ` SELECT * FROM base_from_trade_guangzhou_contract WHERE trade_date=? `
  18. _, err = o.Raw(sql, tradeDate).QueryRows(&list)
  19. return
  20. } else {
  21. sql := ` SELECT * FROM base_from_trade_guangzhou_contract `
  22. _, err = o.Raw(sql).QueryRows(&list)
  23. return
  24. }
  25. }