From 9cc7854c7262346a75b852afc65484be27c9537f Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期四, 16 十一月 2023 10:00:55 +0800
Subject: [PATCH] 出入库明细添加排序

---
 models/location_product_amount.go |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/models/location_product_amount.go b/models/location_product_amount.go
index 94cf597..f076f91 100644
--- a/models/location_product_amount.go
+++ b/models/location_product_amount.go
@@ -124,7 +124,11 @@
 	}
 
 	if slf.Keyword != "" {
-		db = db.Where("product_name like ?", fmt.Sprintf("%%%v%%", slf.Keyword))
+		db = db.Joins("left join wms_location on wms_location_product_amount.location_id = wms_location.id").
+			Joins("left join material on wms_location_product_amount.product_id = material.id").
+			Joins("left join wms_product_category on wms_location_product_amount.product_category_id = wms_product_category.id").
+			Where("wms_location.name like ?", "%"+slf.Keyword+"%").Or("material.name like ?", "%"+slf.Keyword+"%").
+			Or("wms_product_category.name like ?", "%"+slf.Keyword+"%")
 	}
 
 	if slf.Preload {

--
Gitblit v1.8.0