From 3d429faf57e40af56a6df4c07d5ea42e041cdb46 Mon Sep 17 00:00:00 2001 From: makejava <1353036300@qq.com> Date: Mon, 30 Aug 2021 16:14:09 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A9=E7=94=A8=E5=8F=8D=E5=B0=84=E8=A7=A3?= =?UTF-8?q?=E5=86=B3171=E5=85=BC=E5=AE=B9=E6=A3=80=E6=9F=A5=E4=B8=8D?= =?UTF-8?q?=E9=80=9A=E8=BF=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java b/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java index 82c76a5..d5b43f5 100644 --- a/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java +++ b/src/main/java/com/sjhy/plugin/dto/TableInfoSettingsDTO.java @@ -7,6 +7,8 @@ import com.intellij.psi.PsiClass; import com.sjhy.plugin.entity.TableInfo; import lombok.Data; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.HashMap; import java.util.Map; @@ -36,8 +38,10 @@ public class TableInfoSettingsDTO { builder.insert(0, "."); } builder.insert(0, name); - element = (DbElement) element.getParent(); - if (element == null) { + try { + Method method = element.getClass().getDeclaredMethod("getParent"); + element = (DbElement) method.invoke(element); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) { break; } // 未必所有的数据库都是存在三层,例如MySQL就只有两层。如果上次层不是Namespace,则不再继续获取