From 3f881308a42318ad83c14a24fa330b2cf8c5cc0c Mon Sep 17 00:00:00 2001 From: thinkphp Date: Mon, 4 Dec 2017 09:11:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0whereOr=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E5=92=8CunionAll=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/db/Query.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/db/Query.php b/src/db/Query.php index 934f6fe4..6ecee553 100644 --- a/src/db/Query.php +++ b/src/db/Query.php @@ -112,6 +112,10 @@ public function __call($method, $args) // 根据某个字段获取记录的某个值 $name = Db::parseName(substr($method, 10)); return $this->where($name, '=', $args[0])->value($args[1]); + } elseif (strtolower(substr($method, 0, 7)) == 'whereor') { + $name = Loader::parseName(substr($method, 7)); + array_unshift($args, $name); + return call_user_func_array([$this, 'whereOr'], $args); } elseif (strtolower(substr($method, 0, 5)) == 'where') { $name = Db::parseName(substr($method, 5)); array_unshift($args, $name); @@ -727,6 +731,17 @@ public function union($union, $all = false) return $this; } + /** + * 查询SQL组装 union all + * @access public + * @param mixed $union + * @return $this + */ + public function unionAll($union) + { + return $this->union($union, true); + } + /** * 指定查询字段 支持字段排除和指定数据表 * @access public