From 2fc1ef519dfd4ef3c9f6208258882ad50ec1faf3 Mon Sep 17 00:00:00 2001 From: liu xm Date: Mon, 8 Nov 2021 13:27:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9F=BA=E4=BA=8E=E5=BB=BA?= =?UTF-8?q?=E8=A1=A8SQL=E7=94=9F=E6=88=90=E4=BB=A3=E7=A0=81=20=E5=88=97?= =?UTF-8?q?=E5=90=8D=E6=B2=A1=E6=9C=89COMMENT=E6=B3=A8=E9=87=8A=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tool/service/codegen/impl/ToolCodegenSQLParser.java | 4 +++- 1 file changed, 3 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 7a79f05d2..bb664a1d5 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 @@ -16,6 +16,7 @@ import org.apache.commons.collections4.keyvalue.DefaultKeyValue; import java.util.ArrayList; import java.util.List; +import java.util.Objects; import static com.alibaba.druid.sql.SQLUtils.normalize; @@ -97,7 +98,8 @@ public class ToolCodegenSQLParser { columns.add(ToolSchemaColumnDO.builder() .columnName(normalize(definition.getColumnName())) .columnType(definition.getDataType().toString()) - .columnComment(normalize(definition.getComment().toString())) + .columnComment(Objects.isNull(definition.getComment()) ? "" + : normalize(definition.getComment().toString())) .nullable(!text.contains(" NOT NULL")) .primaryKey(false) .autoIncrement(text.contains("AUTO_INCREMENT"))