当前位置:网站首页>Screw数据库文档生成器
Screw数据库文档生成器
2022-06-22 18:00:00 【阿国GG在学习】
一、引入依赖
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId>
<version>1.0.3</version>
</dependency>二、在测试类编写
package com.bojian.digital.clinic;
import cn.smallbun.screw.core.*;
import cn.smallbun.screw.core.engine.EngineConfig;
import cn.smallbun.screw.core.engine.EngineFileType;
import cn.smallbun.screw.core.engine.EngineTemplateType;
import cn.smallbun.screw.core.execute.DocumentationExecute;
import cn.smallbun.screw.core.process.ProcessConfig;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import javax.sql.DataSource;
import java.util.ArrayList;
@SpringBootTest
class ClinicApplicationTests {
@Test
void documentGeneration() {
//数据源
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver");
hikariConfig.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/Datebase");
hikariConfig.setUsername("root");
hikariConfig.setPassword("password");
//设置可以获取tables remarks信息
hikariConfig.addDataSourceProperty("useInformationSchema", "true");
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(5);
DataSource dataSource = new HikariDataSource(hikariConfig);
//生成配置
EngineConfig engineConfig = EngineConfig.builder()
//生成文件路径
.fileOutputDir("文件路径")
//打开目录
.openOutputDir(true)
//文件类型
.fileType(EngineFileType.HTML)
//生成模板实现
.produceType(EngineTemplateType.freemarker)
//自定义文件名称
// .fileName("SQl.html")
.build();
//忽略表
ArrayList<String> ignoreTableName = new ArrayList<>();
ignoreTableName.add("test_user");
ignoreTableName.add("test_group");
//忽略表前缀
ArrayList<String> ignorePrefix = new ArrayList<>();
ignorePrefix.add("test_");
//忽略表后缀
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.0")
//描述
.description("数据库设计文档生成")
//数据源
.dataSource(dataSource)
//生成配置
.engineConfig(engineConfig)
//生成配置
.produceConfig(processConfig)
.build();
//执行生成
new DocumentationExecute(config).execute();
}
}
运行之后再对应地目录种查看生成的文件
边栏推荐
- 200亿VS 50亿,“脱水”小红书,到底值多钱?
- 如何在 FlowUs和Notion 等笔记软件中进行任务管理?
- Iplook becomes RedHat (red hat) business partner
- Sre is bound to move towards the era of chaotic engineering -- Huawei cloud chaotic engineering practice
- Pull down refresh and pull up to load more listviews
- Centeros install mangodb
- 下拉刷新及上拉加载更多的ListView
- std::enable_shared_from_this 错误:error: expected template-name before ‘<’ token
- std::enable_ shared_ from_ This error: error: expected template name before '<' token
- Flutter系列-flutter路由管理
猜你喜欢

维智科技亮相西部数博会,时空AI技术获高度认可

Several important viewpoints on operation and maintenance, monitoring and aiops

IPLOOK 成为 RedHat(红帽)业务合作伙伴

Flutter系列-搭建Flutter开发环境

Detailed explanation of shell script (x) -- how to use sed editor

Shell script explanation (VII) -- regular expression, sort, uniq, tr

牛客网:合并区间
![jniLibs. Srcdirs = ['LIBS'] what's the use?](/img/d5/3070f8e793507efc601bb22d5024fa.png)
jniLibs. Srcdirs = ['LIBS'] what's the use?

消息中间件(一)MQ详解及四大MQ比较

下拉刷新及上拉加载更多的ListView
随机推荐
mini-Web框架:模板替换与路由列表功能开发 | 黑马程序员
Active directory user logon Report
2022 G2 power plant boiler stoker question bank and online simulation examination
預訓練語言模型,bert,RoFormer-Sim又稱SimBERTv2
Sre is bound to move towards the era of chaotic engineering -- Huawei cloud chaotic engineering practice
Pre training language model, Bert, roformer SIM, also known as simbertv2
DBMS in Oracle_ output. put_ Example of line usage
助力客户数字化转型,构建全新的运维体系
3GPP 5g R17 standard is frozen, and redcap as an important feature deserves attention!
5G 短消息解决方案
一款支持HomeKit的摄像头?智汀 IPC摄像头IC1开箱体验
Thread pool: reading the source code of threadpoolexcutor
回文数(简单版)
Chrome suddenly can't copy and paste
缓存3种方式及原理
线程池:ThreadPoolExcutor源码阅读
3GPP 5G R17标准冻结,RedCap作为重要特性值得关注!
C sqlsugar, hisql, FreeSQL ORM framework omni-directional performance test comparison sqlserver
如何提高工作效率?苹果电脑效率工具合集
5gc and satellite integrated communication scheme