From bbdd88b2c4dd034c6be9883bb7c222096d1877bc Mon Sep 17 00:00:00 2001 From: uuling Date: Thu, 29 Jun 2017 16:37:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E7=BB=84=E6=89=B9=E9=87=8F=E8=AE=BE=E7=BD=AE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=A1=A8=E4=BB=A5=E5=8F=8A=E5=88=AB=E5=90=8D=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Db::table('think_user')->alias(['think_user'=>'user','think_dept'=>'dept'])->join('think_dept','dept.user_id= user.id')->select(); 生成的SQL为 SELECT * FROM think_user user INNER JOIN think_dept think_dept ON dept.user_id= user.id 修改后生成的SQL为 SELECT * FROM think_user user INNER JOIN think_dept dept ON dept.user_id= user.id --- library/think/db/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/think/db/Builder.php b/library/think/db/Builder.php index 562f18c9..b6e48cfd 100644 --- a/library/think/db/Builder.php +++ b/library/think/db/Builder.php @@ -199,7 +199,7 @@ abstract class Builder $key = strstr($key, '@think', true); } $key = $this->parseSqlTable($key); - $item[] = $this->parseKey($key) . ' ' . $this->parseKey($table); + $item[] = $this->parseKey($key) . ' ' . (isset($options['alias'][$table]) ? $this->parseKey($options['alias'][$table]) : $this->parseKey($table)); } else { $table = $this->parseSqlTable($table); if (isset($options['alias'][$table])) {