From 80c8e74c7428329f06d1aa3b70b95b46da732b0a Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期四, 27 六月 2024 20:09:03 +0800
Subject: [PATCH] 保存库存结算时间点重启定时任务

---
 models/attribute.go |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/models/attribute.go b/models/attribute.go
index 31e6d90..8f1a368 100644
--- a/models/attribute.go
+++ b/models/attribute.go
@@ -25,6 +25,8 @@
 		PageNum  int
 		PageSize int
 		Orm      *gorm.DB
+		Keyword  string
+		IDs      []uint
 	}
 )
 
@@ -103,7 +105,10 @@
 	slf.ID = id
 	return slf
 }
-
+func (slf *AttributeSearch) SetIDs(ids []uint) *AttributeSearch {
+	slf.IDs = ids
+	return slf
+}
 func (slf *AttributeSearch) SetName(name string) *AttributeSearch {
 	slf.Name = name
 	return slf
@@ -119,7 +124,9 @@
 	if slf.ID != 0 {
 		db = db.Where("id = ?", slf.ID)
 	}
-
+	if len(slf.IDs) != 0 {
+		db = db.Where("id in ?", slf.IDs)
+	}
 	if slf.Order != "" {
 		db = db.Order(slf.Order)
 	}
@@ -130,6 +137,9 @@
 	if slf.Name != "" {
 		db = db.Where("name = ?", slf.Name)
 	}
+	if slf.Keyword != "" {
+		db = db.Where("id like ? or data_type like ? ", fmt.Sprintf("%%%v%%", slf.Keyword), fmt.Sprintf("%%%v%%", slf.Keyword))
+	}
 
 	return db
 }

--
Gitblit v1.8.0