From 200c45a9409a2a6b5b784b60b135f358a8b1db38 Mon Sep 17 00:00:00 2001 From: hulutech-web Date: Fri, 11 Oct 2024 10:38:46 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9D=A1=E4=BB=B6=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- paginator.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/paginator.go b/paginator.go index cb10729..3f0721e 100644 --- a/paginator.go +++ b/paginator.go @@ -32,7 +32,7 @@ type PageResult struct { // SearchByParams // ?name=xxx&pageSize=1¤tPage=1&sort=xxx&order=xxx -func (h *HttpResult) SearchByParams(params map[string]string, excepts ...string) *HttpResult { +func (h *HttpResult) SearchByParams(params map[string]string, conditionMap map[string]interface{}, excepts ...string) *HttpResult { for _, except := range excepts { delete(params, except) } @@ -47,6 +47,9 @@ func (h *HttpResult) SearchByParams(params map[string]string, excepts ...string) q = q.Raw(key+" like ?", "%"+value+"%").(orm.Query) } } + for key, val := range conditionMap { + q = q.Raw(key+" = ?", val).(orm.Query) + } return q }(query) return h