修复Like与 Not Like BUG
This commit is contained in:
parent
b5574d07ef
commit
46ea6042fc
6
base.go
6
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+"%")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user