From 8846f3474764a406ff4830a1a9e57a0598a5adeb Mon Sep 17 00:00:00 2001 From: longlihale <1510613524@qq.com> Date: Thu, 30 Dec 2021 11:36:59 +0800 Subject: [PATCH] fix: generate sql incorrect when use soft_delete and only one OR --- clause/where.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/clause/where.go b/clause/where.go index 02843e04..d04cdc5a 100644 --- a/clause/where.go +++ b/clause/where.go @@ -94,8 +94,12 @@ func And(exprs ...Expression) Expression { return nil } - if _, ok := exprs[0].(OrConditions); !ok && len(exprs) == 1 { - return exprs[0] + if len(exprs) == 1 { + + if _, ok := exprs[0].(OrConditions); !ok { + return exprs[0] + } + } return AndConditions{Exprs: exprs}