From 82c058c91daed212fd9b3807dca9ca80217ce738 Mon Sep 17 00:00:00 2001
From: wangpengfei <274878379@qq.com>
Date: 星期三, 30 八月 2023 20:25:01 +0800
Subject: [PATCH] fix

---
 service/test/supplier.go |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/service/test/supplier.go b/service/test/supplier.go
index 8a75662..4ce559f 100644
--- a/service/test/supplier.go
+++ b/service/test/supplier.go
@@ -34,7 +34,7 @@
 // UpdateSupplier 鏇存柊Supplier璁板綍
 // Author [piexlmax](https://github.com/piexlmax)
 func (sService *SupplierService) UpdateSupplier(s test.Supplier) (err error) {
-	err = global.GVA_DB.Save(&s).Error
+	err = global.GVA_DB.Updates(&s).Error
 	return err
 }
 
@@ -60,12 +60,30 @@
 	if info.Name != "" {
 		db = db.Where("name LIKE ?", "%"+info.Name+"%")
 	}
+	if info.Number != "" {
+		db = db.Where("number LIKE ?", "%"+info.Number+"%")
+	}
+	if info.SupplierType != "" {
+		db = db.Where("supplier_type LIKE ?", "%"+info.SupplierType+"%")
+	}
+	if info.Industry != "" {
+		db = db.Where("industry LIKE ?", "%"+info.Industry+"%")
+	}
+	if info.Contact != "" {
+		db = db.Where("contact LIKE ?", "%"+info.Contact+"%")
+	}
+	if info.Phone != "" {
+		db = db.Where("phone LIKE ?", "%"+info.Phone+"%")
+	}
+	if info.CreatedAt != nil {
+		db = db.Where("created_at = ?", info.CreatedAt)
+	}
 	err = db.Count(&total).Error
 	if err != nil {
 		return
 	}
 
-	err = db.Limit(limit).Offset(offset).Find(&ss).Error
+	err = db.Debug().Limit(limit).Offset(offset).Preload("Contract").Find(&ss).Error
 	return ss, total, err
 }
 

--
Gitblit v1.8.0