From 029c8611556aa3b77cdae78376842e8531521c9f Mon Sep 17 00:00:00 2001
From: lishihai <dslsh@dscom>
Date: 星期四, 20 六月 2024 22:24:01 +0800
Subject: [PATCH] 产品->动态属性增改查

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

diff --git a/models/attribute.go b/models/attribute.go
index 92ca831..8f1a368 100644
--- a/models/attribute.go
+++ b/models/attribute.go
@@ -26,6 +26,7 @@
 		PageSize int
 		Orm      *gorm.DB
 		Keyword  string
+		IDs      []uint
 	}
 )
 
@@ -104,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
@@ -120,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)
 	}

--
Gitblit v1.8.0