改进where方法的原生sql条件 并且支持参数绑定

This commit is contained in:
thinkphp
2016-04-28 14:19:55 +08:00
parent 43fb7cc445
commit 810a88a48e
2 changed files with 8 additions and 2 deletions

View File

@@ -311,7 +311,7 @@ abstract class Builder
$whereStr .= $key . ' ' . $exp . ' ' . $this->parseValue($value);
} elseif ('EXP' == $exp) {
// 表达式查询
$whereStr .= $key . ' ' . $value;
$whereStr .= '( ' . $key . ' ' . $value . ' )';
} elseif (in_array($exp, ['NOT NULL', 'NULL'])) {
// NULL 查询
$whereStr .= $key . ' IS ' . $exp;