代码自动生成工具,当表注释为空时,根据SQL导入失败问题修复
This commit is contained in:
parent
7991d68586
commit
b66d845354
@ -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<ToolSchemaColumnDO> parseColumns(SQLCreateTableStatement statement) {
|
||||
List<ToolSchemaColumnDO> columns = new ArrayList<>();
|
||||
statement.getTableElementList().forEach(element -> parseColumn(columns, element));
|
||||
|
Loading…
Reference in New Issue
Block a user