mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
优化
This commit is contained in:
@@ -375,12 +375,12 @@ class BelongsToMany extends Relation
|
|||||||
{
|
{
|
||||||
// 关联查询封装
|
// 关联查询封装
|
||||||
$tableName = $this->query->getTable();
|
$tableName = $this->query->getTable();
|
||||||
$relationFk = $this->query->getPk();
|
|
||||||
$table = $this->pivot->getTable();
|
$table = $this->pivot->getTable();
|
||||||
$query = $this->query->field($tableName . '.*')
|
$query = $this->query->field($tableName . '.*')
|
||||||
->field(true, false, $table, 'pivot', 'pivot__');
|
->field(true, false, $table, 'pivot', 'pivot__');
|
||||||
|
|
||||||
if (empty($this->baseQuery)) {
|
if (empty($this->baseQuery)) {
|
||||||
|
$relationFk = $this->query->getPk();
|
||||||
$query->join($table . ' pivot', 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk)
|
$query->join($table . ' pivot', 'pivot.' . $foreignKey . '=' . $tableName . '.' . $relationFk)
|
||||||
->where($condition);
|
->where($condition);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user