From b3a318b7f707ca49fa9127881bbe709654eaa761 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期三, 27 九月 2023 17:27:51 +0800
Subject: [PATCH] 报表功能开发

---
 models/location.go |   31 ++++++++++++++++++++-----------
 1 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/models/location.go b/models/location.go
index db96855..64676df 100644
--- a/models/location.go
+++ b/models/location.go
@@ -30,13 +30,13 @@
 
 	LocationSearch struct {
 		Location
-		Order    string
-		PageNum  int
-		PageSize int
-		Keyword  string
-		Orm      *gorm.DB
-		Preload  bool
-		Codes    []string
+		Order      string
+		PageNum    int
+		PageSize   int
+		Keyword    string
+		Orm        *gorm.DB
+		Preload    bool
+		JointNames []string
 	}
 )
 
@@ -67,8 +67,14 @@
 	slf.Id = ID
 	return slf
 }
-func (slf *LocationSearch) SetCodes(ids []string) *LocationSearch {
-	slf.Codes = ids
+
+func (slf *LocationSearch) SetJointName(code string) *LocationSearch {
+	slf.JointName = code
+	return slf
+}
+
+func (slf *LocationSearch) SetJointNames(codes []string) *LocationSearch {
+	slf.JointNames = codes
 	return slf
 }
 
@@ -131,8 +137,11 @@
 	if slf.CompanyId != 0 {
 		db = db.Where("company_id=?", slf.CompanyId)
 	}
-	if len(slf.Codes) != 0 {
-		db = db.Where("warehouse_code in (?)", slf.Codes)
+	if slf.JointName != "" {
+		db = db.Where("joint_name like ?", slf.JointName+"%")
+	}
+	if len(slf.JointNames) != 0 {
+		db = db.Where("joint_name in (?)", slf.JointNames)
 	}
 
 	return db

--
Gitblit v1.8.0