From 32031a7f53b6012d455e4abe2efda277d0e9a2ef Mon Sep 17 00:00:00 2001 From: what Date: Mon, 24 Jul 2023 10:28:08 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=20=E6=9D=A1=E4=BB=B6=E5=88=86=E6=94=AF?= =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E6=97=B6,=20=E6=9E=84=E5=BB=BAsql=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- engine/engine_case.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/engine/engine_case.go b/engine/engine_case.go index d508abb..d37e59c 100644 --- a/engine/engine_case.go +++ b/engine/engine_case.go @@ -11,6 +11,10 @@ type EngineCase[T any] struct { } func (this EngineCase[T]) ToSql(param contracts.ModelParam) db.Expression { + if this.predicate == nil || this.predicate.IsEmpty() { + return db.Raw("NULL") + } + return this.predicate.ToSql(param) }