mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-01 20:52:48 +08:00
修正Query的join方法
This commit is contained in:
@@ -666,22 +666,25 @@ class Query
|
||||
$prefix = $this->prefix;
|
||||
// 传入的表名为数组
|
||||
if (is_array($join)) {
|
||||
if (count($join) > 1) {
|
||||
$prefix = array_pop($join);
|
||||
}
|
||||
if (0 !== $key = key($join)) {
|
||||
// 设置了键名则键名为表名,键值作为表的别名
|
||||
$table = $key;
|
||||
if (false === strpos($table, '.')) {
|
||||
$table = $prefix . $table;
|
||||
}
|
||||
$alias = array_shift($join);
|
||||
$this->alias([$table => $alias]);
|
||||
$table = [$table => $alias];
|
||||
} else {
|
||||
$table = array_shift($join);
|
||||
if (false === strpos($table, '.')) {
|
||||
$table = $prefix . $table;
|
||||
}
|
||||
}
|
||||
if (count($join)) {
|
||||
// 有设置第二个元素则把第二元素作为表前缀
|
||||
$table = (string) current($join) . $table;
|
||||
} elseif (false === strpos($table, '.')) {
|
||||
// 加上默认的表前缀
|
||||
$table = $prefix . $table;
|
||||
}
|
||||
|
||||
} else {
|
||||
$join = trim($join);
|
||||
if (0 === strpos($join, '__')) {
|
||||
|
||||
Reference in New Issue
Block a user