Explorar o código

/Mine/QueryMineTradePositionExs 接口增加入参

zhou.xiaoning %!s(int64=2) %!d(string=hai) anos
pai
achega
717bc2662a

+ 4 - 4
controllers/guangzuan/tradeService.go

@@ -18,8 +18,8 @@ import (
 // @Security Group
 // @Param    userid   query    int    true  "用户ID"
 // @Param    executestatus query    int false "执行状态 - 1:未生效 2:进行中 3:已结束"
-// @Param    page          query    int false "页码"
-// @Param    pagesize      query    int false "每页条数"
+// @Param    page     query    int    false "页码"
+// @Param    pagesize query    int    false "每页条数"
 // @Success  200           {array}  models.GzcjjcorderM
 // @Failure  500     {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrder [get]
@@ -39,8 +39,8 @@ func QueryGZCJJCOrder(c *gin.Context) {
 // @Security Group
 // @Param    userid        query    int true  "用户ID"
 // @Param    orderid  query    string false "单据ID"
-// @Param    page     query    int    false "页码"
-// @Param    pagesize query    int    false "每页条数"
+// @Param    page          query    int false "页码"
+// @Param    pagesize      query    int false "每页条数"
 // @Success  200      {array}  models.GzcjjcorderdetailM
 // @Failure  500           {object} app.Response
 // @Router   /Guangzuan/QueryGZCJJCOrderDetail [get]

+ 1 - 0
controllers/mine/myposition.go

@@ -30,6 +30,7 @@ func QueryMineCpTradePreSaleResults(c *gin.Context) {
 // @Produce  json
 // @Security ApiKeyAuth
 // @Param    userid   query    int true  "用户ID"
+// @Param    goodsid  query    int false "商品ID"
 // @Param    page     query    int false "页码"
 // @Param    pagesize query    int false "每页条数"
 // @Success  200      {array}  models.MineTradePositionEx

+ 6 - 0
docs/docs.go

@@ -13592,6 +13592,12 @@ const docTemplate = `{
                     },
                     {
                         "type": "integer",
+                        "description": "商品ID",
+                        "name": "goodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "页码",
                         "name": "page",
                         "in": "query"

+ 6 - 0
docs/swagger.json

@@ -13583,6 +13583,12 @@
                     },
                     {
                         "type": "integer",
+                        "description": "商品ID",
+                        "name": "goodsid",
+                        "in": "query"
+                    },
+                    {
+                        "type": "integer",
                         "description": "页码",
                         "name": "page",
                         "in": "query"

+ 4 - 0
docs/swagger.yaml

@@ -37092,6 +37092,10 @@ paths:
         name: userid
         required: true
         type: integer
+      - description: 商品ID
+        in: query
+        name: goodsid
+        type: integer
       - description: 页码
         in: query
         name: page

+ 6 - 5
models/mine.go

@@ -111,7 +111,7 @@ func (r *MineCpTradePreSaleResult) GetDataByPage() (interface{}, error, int, int
 // MineTradePositionEx 我的持仓-转让持仓
 type MineTradePositionEx struct {
 	ACCOUNTID       int64   `json:"accountid" xorm:"ACCOUNTID"`             // 账号Id
-	GOODSID         int32   `json:"goodsid" xorm:"GOODSID"`                 // 商品Id
+	GOODSID         int32   `json:"goodsid" xorm:"GOODSID" form:"goodsid"`  // 商品Id
 	TRANSFERDEPOSIT float64 `json:"transferdeposit" xorm:"TRANSFERDEPOSIT"` // 转让定金(49)
 	DEPOSITREMAIN   float64 `json:"depositremain" xorm:"DEPOSITREMAIN"`     // 未付定金
 	PAYSTATUS       int32   `json:"paystatus" xorm:"PAYSTATUS"`             // 支付状态 -1:待支付 2:已支付
@@ -143,6 +143,7 @@ func (r *MineTradePositionEx) calc() {
 func (r *MineTradePositionEx) buildSql() string {
 	var sqlId utils.SQLVal = `
 	select 
+		g.GOODSID,
 		g.goodscode,
 		g.goodsname,
 		g.goodscode || '/' || g.goodsname "GOODSNAMEDISPLAY",
@@ -169,12 +170,12 @@ func (r *MineTradePositionEx) buildSql() string {
     on ge.userid = ui.userid
   left join taaccount ta
     on tpe.accountid = ta.accountid
- where g.marketid = 49201
-   and ta.relateduserid = %v
- order by tpe.paystatus, g.goodscode
+ where g.marketid = 49201 
 	`
 
-	sqlId.FormatParam(r.Userid)
+	sqlId.And("ta.relateduserid", r.Userid)
+	sqlId.AndEx("g.GOODSID", r.GOODSID, r.GOODSID != 0)
+	sqlId.OrderBy("tpe.paystatus, g.goodscode")
 
 	sqlId.Page(r.Page, r.PageSize)
 	return sqlId.String()