修复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 语句
|
// like 语句
|
||||||
if nil != o.Like {
|
if nil != o.Like {
|
||||||
for field, value := range o.NotIn {
|
for field, value := range o.Like {
|
||||||
tx.Where(field+" LIKE ? ", value)
|
tx.Where(field+" LIKE ? ", "%"+value+"%")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOT LIKE 语句
|
// NOT LIKE 语句
|
||||||
if nil != o.NotLike {
|
if nil != o.NotLike {
|
||||||
for field, value := range 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