修复Like与 Not Like BUG

This commit is contained in:
白茶清欢 2022-07-15 00:32:54 +08:00
parent b5574d07ef
commit 46ea6042fc
1 changed files with 3 additions and 3 deletions

View File

@ -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+"%")
}
}