Bladeren bron

查现货商品、套保商品支持按状态过滤

zou.yingbin 4 jaren geleden
bovenliggende
commit
b4c2517ce7

+ 3 - 1
controllers/ermcp/qryMiddleGoods.go

@@ -15,6 +15,7 @@ import (
 // 查询套保品种请求
 type QryMiddleGoodsReq struct {
 	UserId uint32 `form:"userid" binding:"required"` //用户ID
+	Status *int32 `form:"status" binding:"required"` //状态
 }
 
 // 查询套保品种应答
@@ -24,6 +25,7 @@ type QryMiddleGoodsRsp models.ErmcpMiddleGoodsModel
 // @Produce json
 // @Security ApiKeyAuth
 // @Param userid query int true  "所属机构ID"
+// @Param status query int true  "状态 0-停用 1-正常"
 // @Success 200 {array} QryMiddleGoodsRsp
 // @Failure 500 {object} app.Response
 // @Router /Ermcp/QueryMiddleGoods [get]
@@ -32,6 +34,6 @@ func QueryMiddleGoods(c *gin.Context) {
 	appG := app.GinUtils{Gin:app.Gin{C: c}}
 	var req QryMiddleGoodsReq
 	appG.DoBindReq(&req)
-	m := models.ErmcpMiddleGoodsModel{AREAUSERID: req.UserId}
+	m := models.ErmcpMiddleGoodsModel{AREAUSERID: req.UserId, ISVALID: *req.Status}
 	appG.DoGetData(&m)
 }

+ 3 - 1
controllers/ermcp/qryWrstandard.go

@@ -18,6 +18,7 @@ import (
 //查询现货商品请求
 type QryWrStandardReq struct {
 	UserId int `form:"userid" binding:"required"` //用户ID
+	Status *int32 `form:"status" binding:"required"` //状态
 }
 
 //查询现货商品响应
@@ -28,6 +29,7 @@ type QryWrStandardRsp models.ErmcpWrstandard
 // @Produce json
 // @Security ApiKeyAuth
 // @Param userid query int true  "所属机构ID"
+// @Param status query int true  "状态 0-停用 1-正常"
 // @Success 200 {array} QryWrStandardRsp
 // @Failure 500 {object} app.Response
 // @Router /Ermcp/QueryWrStandard [get]
@@ -39,7 +41,7 @@ func QueryWrStandard(c *gin.Context) {
 		appG.Response(http.StatusBadRequest, e.INVALID_PARAMS, nil)
 		return
 	}
-	m := models.ErmcpWrstandard{AREAUSERID: req.UserId}
+	m := models.ErmcpWrstandard{AREAUSERID: req.UserId, ISVALID: *req.Status}
 	if d, err := m.GetData(); err == nil {
 		for i := range d {
 			d[i].EnumdicName = mtpcache.GetEnumDicitemName(d[i].UNITID)

+ 14 - 0
docs/docs.go

@@ -1266,6 +1266,13 @@ var doc = `{
                         "name": "userid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "状态 0-停用 1-正常",
+                        "name": "status",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {
@@ -1448,6 +1455,13 @@ var doc = `{
                         "name": "userid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "状态 0-停用 1-正常",
+                        "name": "status",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {

+ 14 - 0
docs/swagger.json

@@ -1250,6 +1250,13 @@
                         "name": "userid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "状态 0-停用 1-正常",
+                        "name": "status",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {
@@ -1432,6 +1439,13 @@
                         "name": "userid",
                         "in": "query",
                         "required": true
+                    },
+                    {
+                        "type": "integer",
+                        "description": "状态 0-停用 1-正常",
+                        "name": "status",
+                        "in": "query",
+                        "required": true
                     }
                 ],
                 "responses": {

+ 10 - 0
docs/swagger.yaml

@@ -7580,6 +7580,11 @@ paths:
         name: userid
         required: true
         type: integer
+      - description: 状态 0-停用 1-正常
+        in: query
+        name: status
+        required: true
+        type: integer
       produces:
       - application/json
       responses:
@@ -7694,6 +7699,11 @@ paths:
         name: userid
         required: true
         type: integer
+      - description: 状态 0-停用 1-正常
+        in: query
+        name: status
+        required: true
+        type: integer
       produces:
       - application/json
       responses:

+ 1 - 0
models/ermcpMiddleGoods.go

@@ -68,5 +68,6 @@ func (r *ErmcpMiddleGoodsModel) buildSql() string {
 	if r.AREAUSERID > 0{
 		sqlId = sqlId + fmt.Sprintf(" and AREAUSERID = %v", r.AREAUSERID)
 	}
+	sqlId = sqlId + fmt.Sprintf(" and ISVALID=%v", r.ISVALID)
 	return sqlId
 }

+ 2 - 2
models/ermcpWrstandard.go

@@ -49,8 +49,8 @@ func (r *ErmcpWrstandard) buildSql() string {
 		"       REMARK," +
 		"       AREAUSERID" +
 		"  from wrstandard t" +
-		" where t.AREAUSERID=%v"
-	sqlId := fmt.Sprintf(str, r.AREAUSERID)
+		" where t.AREAUSERID=%v and t.ISVALID=%v"
+	sqlId := fmt.Sprintf(str, r.AREAUSERID, r.ISVALID)
 	if r.WRSTANDARDID > 0 {
 		sqlId = sqlId + fmt.Sprintf(" and WRSTANDARDID=%v", r.WRSTANDARDID)
 	}