|
|
@@ -2,6 +2,7 @@ package order
|
|
|
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
+ "fmt"
|
|
|
"mtp2_if/db"
|
|
|
"mtp2_if/global/app"
|
|
|
"mtp2_if/global/e"
|
|
|
@@ -14,8 +15,8 @@ import (
|
|
|
|
|
|
// QueryTradePositionReq 持仓汇总查询请求参数
|
|
|
type QueryTradePositionReq struct {
|
|
|
- AccountID int `form:"accountID" binding:"required"`
|
|
|
- TradeMode int `form:"tradeMode"`
|
|
|
+ AccountID string `form:"accountID" binding:"required"`
|
|
|
+ TradeMode string `form:"tradeMode"`
|
|
|
}
|
|
|
|
|
|
// QueryTradePositionRsp 持仓汇总查询返回模型
|
|
|
@@ -50,8 +51,8 @@ type QueryTradePositionRsp struct {
|
|
|
// @Summary 持仓汇总查询(合约市场)
|
|
|
// @Produce json
|
|
|
// @Security ApiKeyAuth
|
|
|
-// @Param accountID query int true "资金账户"
|
|
|
-// @Param tradeMode query int false "交易模式"
|
|
|
+// @Param accountID query string true "资金账户 - 格式:1,2,3"
|
|
|
+// @Param tradeMode query string false "交易模式 - 格式:1,2,3"
|
|
|
// @Success 200 {object} QueryTradePositionRsp
|
|
|
// @Failure 500 {object} app.Response
|
|
|
// @Router /Order/QueryTradePosition [get]
|
|
|
@@ -88,9 +89,9 @@ func QueryTradePosition(c *gin.Context) {
|
|
|
Join("LEFT", "MARKET", "GOODS.MARKETID = MARKET.MARKETID").
|
|
|
Join("LEFT", "ENUMDICITEM", "GOODS.GOODUNITID = ENUMDICITEM.ENUMITEMNAME and ENUMDICITEM.ENUMDICCODE = 'goodsunit'").
|
|
|
Select("TRADEPOSITION.*, GOODS.GOODSCODE, GOODS.GOODSNAME, GOODS.CURRENCYID, GOODS.GOODUNITID, ENUMDICITEM.ENUMDICNAME as GOODUNIT, GOODS.AGREEUNIT, GOODS.DECIMALPLACE, MARKET.MARKETID, MARKET.TRADEMODE").
|
|
|
- Where("TRADEPOSITION.ACCOUNTID = ?", req.AccountID)
|
|
|
- if req.TradeMode != 0 {
|
|
|
- s = s.And("MARKET.TRADEMODE = ?", req.TradeMode)
|
|
|
+ Where(fmt.Sprintf(`TRADEPOSITION.ACCOUNTID in (%s)`, req.AccountID))
|
|
|
+ if len(req.TradeMode) > 0 {
|
|
|
+ s = s.And(fmt.Sprintf(`MARKET.TRADEMODE in (%s)`, req.TradeMode))
|
|
|
}
|
|
|
if err := s.Find(&datas); err != nil {
|
|
|
// 查询失败
|