@SpringBootTest
public class ScrewTest {
@Test
void documentGeneration() {
EngineConfig engineConfig = EngineConfig.builder()
.fileOutputDir("G:\\cql\\wp-db-word")
.openOutputDir(true)
.fileType(EngineFileType.WORD)
.produceType(EngineTemplateType.freemarker)
.build();
String[] dbNames = {"tenant_management", "tenant", "tenant_cloudcall", "tenant_device",
"tenant_members", "tenant_questionnaire", "config"};
for (String dbName : dbNames) {
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver");
hikariConfig.setJdbcUrl("jdbc:mysql://192.168.16.25:3306/"+ dbName +"?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true");
hikariConfig.setUsername("root");
hikariConfig.setPassword("root");
hikariConfig.addDataSourceProperty("useInformationSchema", "true");
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(5);
DataSource dataSource = new HikariDataSource(hikariConfig);
Configuration config = Configuration.builder()
.version("1.0.0")
.description("数据库设计文档生成")
.dataSource(dataSource)
.engineConfig(engineConfig)
.produceConfig(getProcessConfig())
.build();
new DocumentationExecute(config).execute();
}
}
public static ProcessConfig getProcessConfig(){
List<String> ignoreTableName = Arrays.asList("testa_testa","testb_testb");
List<String> ignorePrefix = Arrays.asList("testa","testb");
List<String> ignoreSuffix = Arrays.asList("_testa","_testb");
return ProcessConfig.builder()
.designatedTableName(new ArrayList<>())
.designatedTablePrefix(new ArrayList<>())
.designatedTableSuffix(new ArrayList<>())
.ignoreTableName(ignoreTableName)
.ignoreTablePrefix(ignorePrefix)
.ignoreTableSuffix(ignoreSuffix).build();
}