!57 代码生成工具问题修复

Merge pull request !57 from chaocloud/master
This commit is contained in:
芋道源码 2021-11-26 01:50:25 +00:00 committed by Gitee
commit e9b93ffe80
2 changed files with 9 additions and 2 deletions

View File

@ -191,7 +191,7 @@ public class ToolCodegenEngine {
} }
private static String javaFilePath(String path) { private static String javaFilePath(String path) {
return "java/${basePackage}/${table.moduleName}/" + path + ".java"; return "java/${basePackage}/modules/${table.moduleName}/" + path + ".java";
} }
private static String vueTemplatePath(String path) { private static String vueTemplatePath(String path) {

View File

@ -64,10 +64,17 @@ public class ToolCodegenSQLParser {
private static ToolSchemaTableDO parseTable(SQLCreateTableStatement statement) { private static ToolSchemaTableDO parseTable(SQLCreateTableStatement statement) {
return ToolSchemaTableDO.builder() return ToolSchemaTableDO.builder()
.tableName(statement.getTableSource().getTableName(true)) .tableName(statement.getTableSource().getTableName(true))
.tableComment(((SQLCharExpr) statement.getComment()).getText()) .tableComment(getCommentText(statement))
.build(); .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) { private static List<ToolSchemaColumnDO> parseColumns(SQLCreateTableStatement statement) {
List<ToolSchemaColumnDO> columns = new ArrayList<>(); List<ToolSchemaColumnDO> columns = new ArrayList<>();
statement.getTableElementList().forEach(element -> parseColumn(columns, element)); statement.getTableElementList().forEach(element -> parseColumn(columns, element));