public static void main(String[] args) {
documentGeneration();
}
public static void documentGeneration() {
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName("com.mysql.jdbc.Driver");
hikariConfig.setJdbcUrl("jdbc:mysql://192.168.180.20:13306/grass?useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai");
hikariConfig.setUsername("root");
hikariConfig.setPassword("root");
hikariConfig.addDataSourceProperty("useInformationSchema", "true");
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(5);
DataSource dataSource = new HikariDataSource(hikariConfig);
String fileOutputDir = "E://hzqq";
EngineConfig engineConfig = EngineConfig.builder()
.fileOutputDir(fileOutputDir)
.openOutputDir(true)
.fileType(EngineFileType.WORD)
.produceType(EngineTemplateType.freemarker)
.fileName("自定义文件名称11").build();
ArrayList<String> ignoreTableName = new ArrayList<>();
ignoreTableName.add("test_user");
ignoreTableName.add("test_group");
ArrayList<String> ignorePrefix = new ArrayList<>();
ignorePrefix.add("app_");
ArrayList<String> ignoreSuffix = new ArrayList<>();
ignoreSuffix.add("_test");
ProcessConfig processConfig = ProcessConfig.builder()
.designatedTableName(new ArrayList<>())
.designatedTablePrefix(new ArrayList<>())
.designatedTableSuffix(new ArrayList<>())
.ignoreTableName(ignoreTableName)
.ignoreTablePrefix(ignorePrefix)
.ignoreTableSuffix(ignoreSuffix).build();
Configuration config = Configuration.builder()
.version("1.0.1")
.description("数据库设计文档生成")
.dataSource(dataSource)
.engineConfig(engineConfig)
.produceConfig(processConfig)
.build();
new DocumentationExecute(config).execute();
}