计划升级or语句支持
This commit is contained in:
22
base.go
22
base.go
@ -192,11 +192,6 @@ func (b *BaseDao) setTxCondition(tx *gorm.DB, optionFuncList ...SetOption) *gorm
|
||||
tx = tx.Model(o.Model)
|
||||
}
|
||||
|
||||
// 设置where条件
|
||||
if nil != o.Where && len(o.Where) > 0 {
|
||||
tx = tx.Where(o.Where)
|
||||
}
|
||||
|
||||
// 设置 limit offset
|
||||
if o.Limit > 0 {
|
||||
tx = tx.Limit(o.Limit)
|
||||
@ -205,6 +200,11 @@ func (b *BaseDao) setTxCondition(tx *gorm.DB, optionFuncList ...SetOption) *gorm
|
||||
}
|
||||
}
|
||||
|
||||
// 设置where条件
|
||||
if nil != o.Where && len(o.Where) > 0 {
|
||||
tx = tx.Where(o.Where)
|
||||
}
|
||||
|
||||
// in 语句
|
||||
if nil != o.In {
|
||||
tx = tx.Where(o.In)
|
||||
@ -251,17 +251,7 @@ func (b *BaseDao) setTxCondition(tx *gorm.DB, optionFuncList ...SetOption) *gorm
|
||||
}
|
||||
|
||||
// or 语句
|
||||
if nil != o.OR {
|
||||
expression := ""
|
||||
valList := make([]any, 0)
|
||||
for _, o := range o.OR {
|
||||
if len(expression) > 0 {
|
||||
expression = expression + " OR "
|
||||
}
|
||||
expression = expression + " " + o.Express
|
||||
valList = append(valList, o.Value)
|
||||
}
|
||||
tx = tx.Where(expression, valList...)
|
||||
if len(o.OR) > 0 {
|
||||
}
|
||||
return tx
|
||||
}
|
||||
|
Reference in New Issue
Block a user