From 6c8fc638919e5bf778f47f4d2be188717b7de23b Mon Sep 17 00:00:00 2001
From: lishihai <dslsh@dscom>
Date: 星期六, 29 六月 2024 17:51:54 +0800
Subject: [PATCH] 概述->业务类型->按仓库Ids筛选->BUG REPORT

---
 controllers/operation_type.go |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/controllers/operation_type.go b/controllers/operation_type.go
index 247562f..cf07e2f 100644
--- a/controllers/operation_type.go
+++ b/controllers/operation_type.go
@@ -7,6 +7,7 @@
 	"github.com/spf13/cast"
 	"gorm.io/gorm"
 	"strconv"
+	"strings"
 	"wms/constvar"
 	"wms/extend/code"
 	"wms/extend/util"
@@ -116,11 +117,21 @@
 		util.ResponseFormat(c, code.RequestParamError, err.Error())
 		return
 	}
+	warehouseIds := make([]int, 0)
+	if "" != params.WarehouseIds {
+		for _, strId := range strings.Split(params.WarehouseIds, ",") {
+			intId, err := strconv.Atoi(strId)
+			if err != nil {
+				util.ResponseFormat(c, code.RequestParamError, err.Error())
+			}
+			warehouseIds = append(warehouseIds, intId)
+		}
+	}
 	list, total, err := models.NewOperationTypeSearch().
 		SetPage(params.Page, params.PageSize).
 		SetKeyword(params.Keyword).
 		SetOrder("id desc").
-		SetWarehouseIds(params.WarehouseIds).
+		SetWarehouseIds(warehouseIds).
 		SetPreload(true).Find()
 	if err != nil {
 		util.ResponseFormat(c, code.RequestError, "鏌ユ壘澶辫触")

--
Gitblit v1.8.0