mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 23:22:48 +08:00
改进hasWhere查询的数据重复问题
This commit is contained in:
@@ -97,6 +97,7 @@ class BelongsTo extends OneToOne
|
|||||||
}
|
}
|
||||||
return $this->parent->db()->alias($model)
|
return $this->parent->db()->alias($model)
|
||||||
->field($model . '.*')
|
->field($model . '.*')
|
||||||
|
->group($model . '.' . $this->foreignKey)
|
||||||
->join($table . ' ' . $relation, $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $this->joinType)
|
->join($table . ' ' . $relation, $model . '.' . $this->foreignKey . '=' . $relation . '.' . $this->localKey, $this->joinType)
|
||||||
->where($where);
|
->where($where);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,6 +271,7 @@ class HasMany extends Relation
|
|||||||
}
|
}
|
||||||
return $this->parent->db()->alias($model)
|
return $this->parent->db()->alias($model)
|
||||||
->field($model . '.*')
|
->field($model . '.*')
|
||||||
|
->group($model . '.' . $this->localKey)
|
||||||
->join($table . ' ' . $relation, $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey)
|
->join($table . ' ' . $relation, $model . '.' . $this->localKey . '=' . $relation . '.' . $this->foreignKey)
|
||||||
->where($where);
|
->where($where);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user