From 46ea6042fc562e3efedd3a2ea521c5a15494b394 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Fri, 15 Jul 2022 00:32:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DLike=E4=B8=8E=20Not=20Like=20?= =?UTF-8?q?BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base.go b/base.go index cc1d7fc..1627762 100644 --- a/base.go +++ b/base.go @@ -132,15 +132,15 @@ func (b *BaseDao) setTxCondition(tx *gorm.DB, table string, optionFuncList ...Se // like 语句 if nil != o.Like { - for field, value := range o.NotIn { - tx.Where(field+" LIKE ? ", value) + for field, value := range o.Like { + tx.Where(field+" LIKE ? ", "%"+value+"%") } } // NOT LIKE 语句 if nil != o.NotLike { for field, value := range o.NotLike { - tx.Where(field+" NOT LIKE ? ", value) + tx.Where(field+" NOT LIKE ? ", "%"+value+"%") } }