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"))