[fix] 条件分支为空时, 构建sql错误

This commit is contained in:
what 2023-07-24 10:28:08 +08:00
parent 2a97e48523
commit 32031a7f53

View File

@ -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)
}