From 17aa8dc8bd487fc07346bea79771c1414a86db32 Mon Sep 17 00:00:00 2001 From: augushong Date: Mon, 21 Oct 2024 15:34:00 +0800 Subject: [PATCH] =?UTF-8?q?db=E5=A2=9E=E5=8A=A0whereif=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- extend/base/common/provider/db/QueryBase.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extend/base/common/provider/db/QueryBase.php b/extend/base/common/provider/db/QueryBase.php index 71e9769..9ea591c 100644 --- a/extend/base/common/provider/db/QueryBase.php +++ b/extend/base/common/provider/db/QueryBase.php @@ -57,4 +57,13 @@ class QueryBase extends DbQuery return md5(json_encode($options)); } + + public function whereIf($where_condition, $field, $op = null, $condition = null) + { + if ($where_condition) { + $this->where($field, $op, $condition); + } + + return $this; + } }