mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进软删除条件在使用闭包查询情况下多次生成的问题
This commit is contained in:
@@ -222,6 +222,14 @@ abstract class Builder
|
|||||||
protected function parseWhere($where, $options)
|
protected function parseWhere($where, $options)
|
||||||
{
|
{
|
||||||
$whereStr = $this->buildWhere($where, $options);
|
$whereStr = $this->buildWhere($where, $options);
|
||||||
|
if (!empty($options['soft_delete'])) {
|
||||||
|
// 附加软删除条件
|
||||||
|
list($field, $condition) = $options['soft_delete'];
|
||||||
|
|
||||||
|
$binds = $this->query->getFieldsBind($options);
|
||||||
|
$whereStr = $whereStr ? '( ' . $whereStr . ' ) AND ' : '';
|
||||||
|
$whereStr = $whereStr . $this->parseWhereItem($field, $condition, '', $options, $binds);
|
||||||
|
}
|
||||||
return empty($whereStr) ? '' : ' WHERE ' . $whereStr;
|
return empty($whereStr) ? '' : ' WHERE ' . $whereStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,13 +288,7 @@ abstract class Builder
|
|||||||
|
|
||||||
$whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($key) + 1) : implode(' ', $str);
|
$whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($key) + 1) : implode(' ', $str);
|
||||||
}
|
}
|
||||||
if (!empty($options['soft_delete'])) {
|
|
||||||
// 附加软删除条件
|
|
||||||
list($field, $condition) = $options['soft_delete'];
|
|
||||||
|
|
||||||
$whereStr = $whereStr ? '( ' . $whereStr . ' ) AND ' : '';
|
|
||||||
$whereStr = $whereStr . $this->parseWhereItem($field, $condition, '', $options, $binds);
|
|
||||||
}
|
|
||||||
return $whereStr;
|
return $whereStr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user