From 01c810b1e927d19419d50e9f3cab9a08bb8ce4d8 Mon Sep 17 00:00:00 2001 From: augushong Date: Mon, 22 Aug 2022 17:26:16 +0800 Subject: [PATCH] =?UTF-8?q?curd=E6=94=AF=E6=8C=81=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=99=A8=E5=A4=9A=E4=B8=AA=E5=85=B3=E8=81=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/service/curd/BuildCurdService.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/admin/service/curd/BuildCurdService.php b/app/admin/service/curd/BuildCurdService.php index 3d84f68..39edb30 100644 --- a/app/admin/service/curd/BuildCurdService.php +++ b/app/admin/service/curd/BuildCurdService.php @@ -1070,10 +1070,13 @@ class BuildCurdService $controllerExportMethod = ''; } else { $relationCode = ''; + $relation_table = []; + foreach ($this->relationArray as $key => $val) { $relation = Str::camel($key); - $relationCode = "->withJoin('{$relation}', 'LEFT')\r"; + $relation_table[] = $relation; } + $relationCode = "->withJoin(['" . implode('\',\'', $relation_table) . "'], 'LEFT')\r"; $controllerIndexMethod = $this->replaceTemplate( $this->getTemplate("controller{$this->DS}indexMethod"), [