From 96844c22ef3fba86a55e0af1b51bc1009d6fa950 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期五, 20 十月 2023 11:57:48 +0800
Subject: [PATCH] 1.库存盘点bug修改

---
 models/product_category.go |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/models/product_category.go b/models/product_category.go
index 5f6ebbf..62f611d 100644
--- a/models/product_category.go
+++ b/models/product_category.go
@@ -11,7 +11,7 @@
 	// ProductCategory 浜у搧鍒嗙被
 	ProductCategory struct {
 		BaseModelInt
-		Name                 string                        `json:"name" gorm:"index;type:varchar(255);not null;comment:鍒嗙被鍚嶇О"` //浣嶇疆鍚嶇О
+		Name                 string                        `json:"name" gorm:"index;type:varchar(255);not null;comment:鍒嗙被鍚嶇О"` //鍒嗙被鍚嶇О
 		ParentId             int                           `json:"parentId" gorm:"type:int;comment:涓婄骇鍒嗙被id"`                   //涓婄骇id
 		RouteId              int                           `json:"routeId" gorm:"type:int;comment:璺嚎id"`                      //璺嚎id
 		RouteName            string                        `json:"routeName" gorm:"type:varchar(512);comment:璺嚎鍚嶇О"`           //鍏徃
@@ -28,6 +28,7 @@
 		Keyword  string
 		Orm      *gorm.DB
 		Preload  bool
+		Ids      []int
 	}
 )
 
@@ -73,6 +74,10 @@
 	slf.Preload = preload
 	return slf
 }
+func (slf *ProductCategorySearch) SetIds(ids []int) *ProductCategorySearch {
+	slf.Ids = ids
+	return slf
+}
 
 func (slf *ProductCategorySearch) build() *gorm.DB {
 	var db = slf.Orm.Model(&ProductCategory{})
@@ -92,6 +97,9 @@
 	if slf.Name != "" {
 		db = db.Where("name = ?", slf.Name)
 	}
+	if len(slf.Ids) > 0 {
+		db = db.Where("id in (?)", slf.Ids)
+	}
 
 	return db
 }

--
Gitblit v1.8.0