From 55bd24a2d654052d4c4c8eb6e7bee244af81d446 Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期四, 19 十月 2023 15:53:22 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS

---
 models/location_product.go |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/models/location_product.go b/models/location_product.go
index 520b18a..c3f26c6 100644
--- a/models/location_product.go
+++ b/models/location_product.go
@@ -90,7 +90,13 @@
 	}
 
 	if slf.Keyword != "" {
-		db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
+		//db = db.Where("Product.name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
+		db.Joins("left join wms_location on wms_location_product.location_id = wms_location.id").
+			Joins("left join material on wms_location_product.product_id = material.id").
+			Joins("left join wms_product_category on wms_location_product.product_category_id = wms_product_category.id").
+			Where("wms_location.name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)).
+			Or("material.name like ?", fmt.Sprintf("%%%v%%", slf.Keyword)).
+			Or("wms_product_category.name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
 	}
 
 	if slf.Preload {

--
Gitblit v1.8.0