Преглед изворни кода

1. 增加查询筛选框列表接口

zou.yingbin пре 4 година
родитељ
комит
df6f8491d7
6 измењених фајлова са 262 додато и 8 уклоњено
  1. 19 2
      controllers/wrTrade2/qryWrTrade.go
  2. 70 2
      docs/docs.go
  3. 70 2
      docs/swagger.json
  4. 47 2
      docs/swagger.yaml
  5. 55 0
      models/wrTrade2.go
  6. 1 0
      routers/router.go

+ 19 - 2
controllers/wrTrade2/qryWrTrade.go

@@ -60,11 +60,11 @@ func QueryOrderQuoteDetail(c *gin.Context) {
 
 // QueryWrPosition
 // @Summary 查询现货(预售)仓单持仓
-// @Description 页面 现货仓单->现货汇总/库存汇总/现货明细 ; 预售仓单->订单汇总
+// @Description 页面 现货仓单->现货汇总/库存汇总; 预售仓单->订单汇总
 // @Produce json
 // @Security ApiKeyAuth
 // @Param userid query int true "用户id"
-// @Param querytype query int true "查询类型  1-现货汇总 2-库存汇总(订单汇总) 3-现货明细"
+// @Param querytype query int true "查询类型  1-现货汇总 2-库存汇总(订单汇总)"
 // @Success 200 {array} models.WrPosition
 // @Failure 500 {object} app.Response
 // @Router /WrTrade2/QueryWrPosition [get]
@@ -175,6 +175,7 @@ func QueryPerformancePlan(c *gin.Context) {
 
 // QueryHoldLB
 // @Summary 查询仓单持有记录
+// @Description 页面 现货仓单->现货明细? ,  表名叫仓单持有记录, 有挂单特有维度,为防误解汇总也有相关维度, 新写接口,不跟汇总合在一起了。
 // @Produce json
 // @Security ApiKeyAuth
 // @Param accountid query int true "资金账号"
@@ -188,3 +189,19 @@ func QueryHoldLB(c *gin.Context) {
 	a.DoBindReq(&m)
 	a.DoGetDataI(&m)
 }
+
+// QueryFilterItem
+// @Summary 查询筛选框列表
+// @Produce json
+// @Security ApiKeyAuth
+// @Param itype query string true "类型(可多选,逗号隔开) 1-品种 2-品类(商品) 3-仓库"
+// @Success 200 {array} models.WrFilterItem
+// @Failure 500 {object} app.Response
+// @Router /WrTrade2/QueryFilterItem [get]
+// @Tags 仓单贸易v2
+func QueryFilterItem(c *gin.Context) {
+	a := app.GinUtils{Gin: app.Gin{C: c}}
+	m := models.WrFilterItem{}
+	a.DoBindReq(&m)
+	a.DoGetDataI(&m)
+}

+ 70 - 2
docs/docs.go

@@ -10933,6 +10933,48 @@ var doc = `{
                 }
             }
         },
+        "/WrTrade2/QueryFilterItem": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询筛选框列表",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "类型(可多选,逗号隔开) 1-品种 2-品类(商品) 3-仓库",
+                        "name": "itype",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrFilterItem"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryHoldLB": {
             "get": {
                 "security": [
@@ -10940,6 +10982,7 @@ var doc = `{
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "页面 现货仓单-\u003e现货明细? ,  表名叫仓单持有记录, 有挂单特有维度,为防误解汇总也有相关维度, 新写接口,不跟汇总合在一起了。",
                 "produces": [
                     "application/json"
                 ],
@@ -11327,7 +11370,7 @@ var doc = `{
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "页面 现货仓单-\u003e现货汇总/库存汇总/现货明细 ; 预售仓单-\u003e订单汇总",
+                "description": "页面 现货仓单-\u003e现货汇总/库存汇总; 预售仓单-\u003e订单汇总",
                 "produces": [
                     "application/json"
                 ],
@@ -11345,7 +11388,7 @@ var doc = `{
                     },
                     {
                         "type": "integer",
-                        "description": "查询类型  1-现货汇总 2-库存汇总(订单汇总) 3-现货明细",
+                        "description": "查询类型  1-现货汇总 2-库存汇总(订单汇总)",
                         "name": "querytype",
                         "in": "query",
                         "required": true
@@ -29323,6 +29366,31 @@ var doc = `{
                 }
             }
         },
+        "models.WrFilterItem": {
+            "type": "object",
+            "properties": {
+                "itemcode": {
+                    "description": "代码",
+                    "type": "string"
+                },
+                "itemid": {
+                    "description": "项id",
+                    "type": "integer"
+                },
+                "itemname": {
+                    "description": "名称",
+                    "type": "string"
+                },
+                "itemtype": {
+                    "description": "类型 1-品种 2-品类(商品) 3-仓库",
+                    "type": "integer"
+                },
+                "itype": {
+                    "description": "类型 逗号隔开, 如 1,2",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrGoodsInfo": {
             "type": "object",
             "properties": {

+ 70 - 2
docs/swagger.json

@@ -10917,6 +10917,48 @@
                 }
             }
         },
+        "/WrTrade2/QueryFilterItem": {
+            "get": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "仓单贸易v2"
+                ],
+                "summary": "查询筛选框列表",
+                "parameters": [
+                    {
+                        "type": "string",
+                        "description": "类型(可多选,逗号隔开) 1-品种 2-品类(商品) 3-仓库",
+                        "name": "itype",
+                        "in": "query",
+                        "required": true
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "type": "array",
+                            "items": {
+                                "$ref": "#/definitions/models.WrFilterItem"
+                            }
+                        }
+                    },
+                    "500": {
+                        "description": "Internal Server Error",
+                        "schema": {
+                            "$ref": "#/definitions/app.Response"
+                        }
+                    }
+                }
+            }
+        },
         "/WrTrade2/QueryHoldLB": {
             "get": {
                 "security": [
@@ -10924,6 +10966,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
+                "description": "页面 现货仓单-\u003e现货明细? ,  表名叫仓单持有记录, 有挂单特有维度,为防误解汇总也有相关维度, 新写接口,不跟汇总合在一起了。",
                 "produces": [
                     "application/json"
                 ],
@@ -11311,7 +11354,7 @@
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "页面 现货仓单-\u003e现货汇总/库存汇总/现货明细 ; 预售仓单-\u003e订单汇总",
+                "description": "页面 现货仓单-\u003e现货汇总/库存汇总; 预售仓单-\u003e订单汇总",
                 "produces": [
                     "application/json"
                 ],
@@ -11329,7 +11372,7 @@
                     },
                     {
                         "type": "integer",
-                        "description": "查询类型  1-现货汇总 2-库存汇总(订单汇总) 3-现货明细",
+                        "description": "查询类型  1-现货汇总 2-库存汇总(订单汇总)",
                         "name": "querytype",
                         "in": "query",
                         "required": true
@@ -29307,6 +29350,31 @@
                 }
             }
         },
+        "models.WrFilterItem": {
+            "type": "object",
+            "properties": {
+                "itemcode": {
+                    "description": "代码",
+                    "type": "string"
+                },
+                "itemid": {
+                    "description": "项id",
+                    "type": "integer"
+                },
+                "itemname": {
+                    "description": "名称",
+                    "type": "string"
+                },
+                "itemtype": {
+                    "description": "类型 1-品种 2-品类(商品) 3-仓库",
+                    "type": "integer"
+                },
+                "itype": {
+                    "description": "类型 逗号隔开, 如 1,2",
+                    "type": "string"
+                }
+            }
+        },
         "models.WrGoodsInfo": {
             "type": "object",
             "properties": {

+ 47 - 2
docs/swagger.yaml

@@ -13280,6 +13280,24 @@ definitions:
     - autoid
     - warehousecode
     type: object
+  models.WrFilterItem:
+    properties:
+      itemcode:
+        description: 代码
+        type: string
+      itemid:
+        description: 项id
+        type: integer
+      itemname:
+        description: 名称
+        type: string
+      itemtype:
+        description: 类型 1-品种 2-品类(商品) 3-仓库
+        type: integer
+      itype:
+        description: 类型 逗号隔开, 如 1,2
+        type: string
+    type: object
   models.WrGoodsInfo:
     properties:
       haswr:
@@ -22918,8 +22936,35 @@ paths:
       tags:
       - 仓单贸易
       - 仓单贸易
+  /WrTrade2/QueryFilterItem:
+    get:
+      parameters:
+      - description: 类型(可多选,逗号隔开) 1-品种 2-品类(商品) 3-仓库
+        in: query
+        name: itype
+        required: true
+        type: string
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            items:
+              $ref: '#/definitions/models.WrFilterItem'
+            type: array
+        "500":
+          description: Internal Server Error
+          schema:
+            $ref: '#/definitions/app.Response'
+      security:
+      - ApiKeyAuth: []
+      summary: 查询筛选框列表
+      tags:
+      - 仓单贸易v2
   /WrTrade2/QueryHoldLB:
     get:
+      description: 页面 现货仓单->现货明细? ,  表名叫仓单持有记录, 有挂单特有维度,为防误解汇总也有相关维度, 新写接口,不跟汇总合在一起了。
       parameters:
       - description: 资金账号
         in: query
@@ -23169,14 +23214,14 @@ paths:
       - 仓单贸易v2
   /WrTrade2/QueryWrPosition:
     get:
-      description: 页面 现货仓单->现货汇总/库存汇总/现货明细 ; 预售仓单->订单汇总
+      description: 页面 现货仓单->现货汇总/库存汇总; 预售仓单->订单汇总
       parameters:
       - description: 用户id
         in: query
         name: userid
         required: true
         type: integer
-      - description: 查询类型  1-现货汇总 2-库存汇总(订单汇总) 3-现货明细
+      - description: 查询类型  1-现货汇总 2-库存汇总(订单汇总)
         in: query
         name: querytype
         required: true

+ 55 - 0
models/wrTrade2.go

@@ -1184,3 +1184,58 @@ func (r *WrHoldLB) GetDataEx() (interface{}, error) {
 	}
 	return sData, err
 }
+
+// WrFilterItem 筛选框列表项
+type WrFilterItem struct {
+	ITEMTYPE int32  `json:"itemtype"  xorm:"'ITEMTYPE'"` // 类型 1-品种 2-品类(商品) 3-仓库
+	ITEMNAME string `json:"itemname"  xorm:"'ITEMNAME'"` // 名称
+	ITEMCODE string `json:"itemcode"  xorm:"'ITEMCODE'"` // 代码
+	ITEMID   int64  `json:"itemid"  xorm:"'ITEMID'"`     // 项id
+
+	IType string `json:"-" form:"itype"` // 类型 逗号隔开, 如 1,2
+}
+
+func (r *WrFilterItem) calc() {
+
+}
+
+func (r *WrFilterItem) buildSql() string {
+	if r.IType == "" {
+		r.IType = "1, 2, 3"
+	}
+	r.IType = strings.ReplaceAll(r.IType, " ", "")
+	sType := strings.Split(r.IType, ",")
+	sqls := make([]string, 0)
+	for _, v := range sType {
+		switch v {
+		case "1":
+			sqls = append(sqls, "select 1 itemtype, t.deliverygoodsid itemid, t.deliverygoodscode itemcode, to_char(t.deliverygoodsname) itemname from deliverygoods t")
+		case "2":
+			sqls = append(sqls, "select 2 itemtype, t.wrstandardid itemid, to_char(t.wrstandardcode) itemcode, to_char(t.wrstandardname) itemname from wrstandard t")
+		case "3":
+			sqls = append(sqls, "select 3 itemtype, t.autoid itemid, t.warehousecode itemcode, to_char(t.warehousename) itemname from warehouseinfo t")
+		default:
+		}
+	}
+
+	var sqlId string
+	for _, v := range sqls {
+		if len(sqlId) > 0 {
+			sqlId += " union all " + v
+		} else {
+			sqlId = v
+		}
+	}
+	sqlId += " order by itemtype, itemid"
+	return sqlId
+}
+
+// GetDataEx 获取筛选框列表项
+func (r *WrFilterItem) GetDataEx() (interface{}, error) {
+	sData := make([]WrFilterItem, 0)
+	err := db.GetEngine().SQL(r.buildSql()).Find(&sData)
+	for i := range sData {
+		sData[i].calc()
+	}
+	return sData, err
+}

+ 1 - 0
routers/router.go

@@ -526,6 +526,7 @@ func InitRouter() *gin.Engine {
 		wrTrade2R.GET("QueryWrGoodsInfo", wrTrade2.QueryWrGoodsInfo)
 		wrTrade2R.GET("QueryPerformancePlan", wrTrade2.QueryPerformancePlan)
 		wrTrade2R.GET("QueryHoldLB", wrTrade2.QueryHoldLB)
+		wrTrade2R.GET("QueryFilterItem", wrTrade2.QueryFilterItem)
 	}
 
 	return r