当前位置:网站首页>Jar a key generation document database
Jar a key generation document database
2022-08-03 23:22:00 【JamonWang】
1、使用方式为:
screw
(螺丝钉)
2、下图为例子:
3、数据库支持
MySQL、MariaDB、TIDB、Oracle、SqlServer、Cache DB、PostgreSQL
4、生成方式一:插件方式 - pom中添加插件
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-maven-plugin</artifactId>
<version>1.0.3</version>
<dependencies>
<!-- HikariCP -->
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
</dependency>
<!--mysql driver-->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
</dependency>
</dependencies>
<configuration>
<!--username-->
<username>root</username>
<!--password-->
<password>root</password>
<!--driver-->
<driverClassName>com.mysql.cj.jdbc.Driver</driverClassName>
<!--jdbc url-->
<jdbcUrl>jdbc:mysql://127.0.0.1:3306/jamoncloud?serverTimezone=Asia/Shanghai</jdbcUrl>
<!--生成文件类型-->
<!-- <fileType>HTML</fileType>-->
<!-- <fileType>WORD</fileType>-->
<fileType>MD</fileType>
<!--打开文件输出目录-->
<openOutputDir>false</openOutputDir>
<!--生成模板-->
<produceType>freemarker</produceType>
<!--文档名称 为空时:将采用[数据库名称-描述-版本号]作为文档名称-->
<!--<docName>测试文档名称</docName>-->
<!--描述-->
<description>数据库文档生成</description>
<!--版本-->
<version>${project.version}</version>
<!--标题-->
<title>fire数据库文档</title>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
点击screw:run The documentation will be generated in the directorydoc目录中, The generated document supports three HTML、WORD、MD
5、生成方式二:
添加pom
<!-- screw核心 螺丝钉 生成数据库文档-->
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId>
<version>1.0.5</version>
</dependency>
测试类中添加如下方法,Execute this method
@SpringBootTest
public class documentGeneration {
@Autowired
ApplicationContext applicationContext;
@Test
public void contextLoads() {
//数据源:HikariCP 线程池, SpringBoot 2.0开始内置了HikariCP,2.0之前的版本需要引入依赖
HikariConfig hikariConfig = new HikariConfig();
// com.mysql.jdbc.Driver MySQL5驱动;com.mysql.cj.jdbc.Driver MySQL6之后的驱动
hikariConfig.setDriverClassName("com.mysql.jdbc.Driver");
hikariConfig.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/jamoncloud?serverTimezone=Asia/Shanghai");
hikariConfig.setUsername("root");
hikariConfig.setPassword("root");
//设置可以获取tables remarks信息
hikariConfig.addDataSourceProperty("useInformationSchema", "true");
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(5);
DataSource dataSourceMysql = new HikariDataSource(hikariConfig);
// DataSource dataSourceMysql = applicationContext.getBean(DataSource.class);
// 生成文件配置
String path = System.getProperty ("user.dir") + "\\doc";
EngineConfig engineConfig = EngineConfig.builder()
// 生成文件路径,自己mac本地的地址,这里需要自己更换下路径
.fileOutputDir(path)
// 打开目录
.openOutputDir(false)
// 文件类型
.fileType(EngineFileType.MD)
// 生成模板实现
.produceType(EngineTemplateType.freemarker).build();
// 生成文档配置(包含以下自定义版本号、描述等配置连接)
Configuration config = Configuration.builder()
.version("1.0.3")
.description("生成文档信息描述")
.dataSource(dataSourceMysql)
.engineConfig(engineConfig)
.produceConfig(getProcessConfig())
.build();
// 执行生成
new DocumentationExecute(config).execute();
}
/**
* 配置想要生成的表+ 配置想要忽略的表
*
* @return 生成表配置
*/
public static ProcessConfig getProcessConfig() {
// 忽略表名
List<String> ignoreTableName = Arrays.asList("a", "test_group");
// 忽略表前缀,如忽略a开头的数据库表
List<String> ignorePrefix = Arrays.asList("a", "t");
// 忽略表后缀
List<String> ignoreSuffix = Arrays.asList("_test", "czb_");
return ProcessConfig.builder()
//根据名称指定表生成
// .designatedTableName(Arrays.asList("fire_user"))
//根据表前缀生成
.designatedTablePrefix(new ArrayList<>())
//根据表后缀生成
.designatedTableSuffix(new ArrayList<>())
//忽略表名
.ignoreTableName(ignoreTableName)
//忽略表前缀
.ignoreTablePrefix(ignorePrefix)
//忽略表后缀
.ignoreTableSuffix(ignoreSuffix).build();
}
}
边栏推荐
- 【论文阅读】TRO 2021: Fail-Safe Motion Planning for Online Verification of Autonomous Vehicles Using Conve
- Unity2021发布WebGL雾效消失问题
- MCS-51单片机,定时1分钟,汇编程序
- 代码随想录笔记_动态规划_416分割等和子集
- 易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元
- ts用法大全
- ML's yellowbrick: A case of interpretability (threshold map) for LoR logistic regression model using yellowbrick based on whether Titanic was rescued or not based on the two-class prediction dataset
- Zilliz 2023 秋季校园招聘正式启动!
- 跨域的学习
- navicat 连接 mongodb 报错[13][Unauthorized] command listDatabases requires authentication
猜你喜欢
用栈实现队列
The Chinese Valentine's Day event is romantically launched, don't let the Internet slow down and miss the dark time
jav一键生成数据库文档
Binary search tree to solve the fallen leaves problem
FinClip最易用的智能电视小程序
响应式织梦模板塑身瑜伽类网站
Code Casual Recording Notes_Dynamic Programming_416 Segmentation and Subsetting
rosbridge-WSL2 && carla-win11
CAS: 178744-28-0, mPEG-DSPE, DSPE-mPEG, methoxy-polyethylene glycol-phosphatidylethanolamine supply
直播系统聊天技术(八):vivo直播系统中IM消息模块的架构实践
随机推荐
生成器版和查看器版有什么区别?
用栈实现队列
Analysys Analysis: The transaction scale of China's online retail B2C market in Q2 2022 will reach 2,344.47 billion yuan
Republish the lab report
V8中的快慢数组(附源码、图文更易理解)
Scala基础【正则表达式、框架式开发原则】
Cloud platform construction solutions
override learning (parent and child)
Unity 截取3D图像 与 画中画PIP的实现
举一个 web worker 的例子
node连接mysql数据库报错:Client does not support authentication protocol requested by server
牛客2022 暑期多校3 H Hacker(SAM + 线段树查询区间内部最大子段和)
Work Subtotal QT Packing
静态文件快速建站
【LeetCode】最长回文子序列(动态规划)
跨域的学习
Quickly build a website with static files
Canvas App中点击图标生成PDF并保存到Dataverse中
The principle and use of AOSP CameraLatencyHistogram
complete binary tree problem