From b66d84535490824a27a75875218c5f678f177a78 Mon Sep 17 00:00:00 2001 From: chaocloud <840558273@qq.com> Date: Wed, 24 Nov 2021 15:08:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=87=AA=E5=8A=A8=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=B7=A5=E5=85=B7=EF=BC=8C=E5=BD=93=E8=A1=A8=E6=B3=A8?= =?UTF-8?q?=E9=87=8A=E4=B8=BA=E7=A9=BA=E6=97=B6=EF=BC=8C=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?SQL=E5=AF=BC=E5=85=A5=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/service/codegen/impl/ToolCodegenSQLParser.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/service/codegen/impl/ToolCodegenSQLParser.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/service/codegen/impl/ToolCodegenSQLParser.java index bb664a1d5..d9f253881 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/service/codegen/impl/ToolCodegenSQLParser.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/service/codegen/impl/ToolCodegenSQLParser.java @@ -64,10 +64,17 @@ public class ToolCodegenSQLParser { private static ToolSchemaTableDO parseTable(SQLCreateTableStatement statement) { return ToolSchemaTableDO.builder() .tableName(statement.getTableSource().getTableName(true)) - .tableComment(((SQLCharExpr) statement.getComment()).getText()) + .tableComment(getCommentText(statement)) .build(); } + private static String getCommentText(SQLCreateTableStatement statement) { + if (statement == null || statement.getComment() == null) { + return ""; + } + return ((SQLCharExpr) statement.getComment()).getText(); + } + private static List parseColumns(SQLCreateTableStatement statement) { List columns = new ArrayList<>(); statement.getTableElementList().forEach(element -> parseColumn(columns, element));