# dbdocument **Repository Path**: anttribe/dbdocument ## Basic Information - **Project Name**: dbdocument - **Description**: 数据库文档生成工具 - **Primary Language**: Java - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2021-09-28 - **Last Updated**: 2022-12-22 ## Categories & Tags **Categories**: Uncategorized **Tags**: 数据库 ## README ### 项目介绍 dbdocument是一个用于生成数据库结构文档的工具,用于解决在项目开发过程中,编写和维护数据库文档的痛点。 ### 数据库支持 - [x] MySQL ### 文档生成支持(不限,生成格式和模板可自定义) - [x] html - [x] word - [x] markdown ### 文档截图 + **html** ![image-20221222152237467](README.assets/image-20221222152237467.png) + **word** ![image-20221222152303261](README.assets/image-20221222152303261.png) + **markdwon** ![image-20221222152344840](README.assets/image-20221222152344840.png) ### 使用方式 + **引入依赖** ```xml com.anttribe.dbdocument dbdocument 0.0.1-SNAPSHOT ``` + **编写代码** ``` java public void testGenerateWithDefaultConfig() { HikariConfig hikariConfig = new HikariConfig(); hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver"); hikariConfig.setJdbcUrl("jdbc:mysql://localhost:3306/webcatee_db"); hikariConfig.setUsername("webcatee"); hikariConfig.setPassword("webcatee"); // 设置可以获取tables remarks信息 hikariConfig.addDataSourceProperty("useInformationSchema", "true"); hikariConfig.setMinimumIdle(2); hikariConfig.setMaximumPoolSize(5); dataSource = new HikariDataSource(hikariConfig); String templateFilepath = "templates/freemarker/dbdocument_md.ftl"; docGeneratorConfig = Configuration.builder().copyright(Copyright.builder().build()) // 定义模板路径 .templateConfig(TemplateConfiguration.builder().templateFile(templateFilepath).build()) // 指定输出文件路径和输出文件类型 .outputConfig(OutputConfiguration.builder().outputDirectory("/Testing/dbdocument/outputs") .generatorFileType(SupportedGeneratorFileType.MAKEDOWN).build()) .build(); DbDocumentConfiguration configuration = DbDocumentConfiguration.builder().docGeneratorConfiguration(docGeneratorConfig).build(); DbDocumentGenerator generator = new DbDocumentGenerator(configuration); GeneratorOutput output = generator.generate(dataSource); System.out.println(output); } ``` ### FAQ