From f4508a84236a4aff1c7b5bfa17a14a8ff95728ba Mon Sep 17 00:00:00 2001
From: yinbentan <yinbentan@live.com>
Date: 星期一, 08 七月 2024 09:45:10 +0800
Subject: [PATCH] 接口调用报错处理

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

diff --git a/models/location_product_amount.go b/models/location_product_amount.go
index 98abd13..6b82f7c 100644
--- a/models/location_product_amount.go
+++ b/models/location_product_amount.go
@@ -36,6 +36,7 @@
 		ProductIds  []string
 		Ids         []int
 		Query       string
+		Fields      string
 	}
 
 	LocationProductAmountWithOperation struct {
@@ -131,6 +132,11 @@
 	return slf
 }
 
+func (slf *LocationProductAmountSearch) SetFields(fields string) *LocationProductAmountSearch {
+	slf.Fields = fields
+	return slf
+}
+
 func (slf *LocationProductAmountSearch) build() *gorm.DB {
 	var db = slf.Orm.Model(&LocationProductAmount{})
 
@@ -181,6 +187,10 @@
 		db = db.Where("warehouse_id = ?", slf.WarehouseId)
 	}
 
+	if slf.Fields != "" {
+		db = db.Select(slf.Fields)
+	}
+
 	return db
 }
 

--
Gitblit v1.8.0