Skip to content

Commit

Permalink
Merge branch 'feature/feature_2.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
woodwhales committed Sep 4, 2022
2 parents b2f9fb7 + 9d8f8b6 commit 0e52e9e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ public GenerateTableInfos(Boolean generateCode,
this.generateMarkdown = generateMarkdown;
}

public GenerateTableInfos markdownFile(String markdownFile) {
public GenerateTableInfos markdownFile(String markdownFile, List<TableInfo> tables) {
if(generateMarkdown && StringUtils.isNotBlank(markdownFile)) {
// 设置 markdown 生成目录
this.markdownFile = new File(markdownFile);
this.tables = tables;
}
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public GenerateTableInfos buildGenerateTableInfos(DataBaseRequestBody requestBod
Boolean generateCode = javaCodeConfig.getGenerateCode();
Boolean generateMarkdown = markdownConfig.getGenerateMarkdown();
GenerateTableInfos generateTableInfos = new GenerateTableInfos(generateCode, generateMarkdown, dataBaseInfo);
// 获取数据库表结构信息
List<TableInfo> tables = generateService.listTables(dataBaseInfo, true);
// 生成代码
if(generateCode) {
// 检查目标文件目录是否为合法文件夹
Expand All @@ -54,8 +56,6 @@ public GenerateTableInfos buildGenerateTableInfos(DataBaseRequestBody requestBod
}
File baseDir = checkBaseDirPath(generateDir);
dataBaseInfo.getJavaCodeConfig().setInterfaceList(DataTool.toList(javaCodeConfig.getInterfaceList(), Function.identity(), true));
// 获取数据库表结构信息
List<TableInfo> tables = generateService.listTables(dataBaseInfo, true);
generateTableInfos.javaFile(baseDir.getAbsolutePath(), tables);
}
// 生成markdown
Expand All @@ -73,7 +73,7 @@ public GenerateTableInfos buildGenerateTableInfos(DataBaseRequestBody requestBod
throw new GenerateException("生成markdown的目录失败");
}
}
generateTableInfos.markdownFile(markdownDir);
generateTableInfos.markdownFile(markdownDir, tables);
}
return generateTableInfos;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public List<TableInfo> listTables(DataBaseInfo dataBaseInfo, boolean isProcess)

List<TableInfo> cacheTableInfoList = dataBaseInfoCache.getTableInfoList(dataBaseInfoKey);

// 生成代码
// 生成代码或者生成markdown
if(isProcess) {
final List<String> dbNameList = dataBaseInfo.getDbTableConfig().getDbNameList();
final Boolean selectAll = dataBaseInfo.getDbTableConfig().getSelectAll();
Expand Down

0 comments on commit 0e52e9e

Please sign in to comment.