当前位置:网站首页>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();
}
}
边栏推荐
- Testng监听器
- 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
- Software testing is seriously involution, how to improve your competitiveness?
- "Digital Economy Panorama White Paper" Financial Digital User Chapter released!
- 静态文件快速建站
- Fluorescein-PEG-CLS,胆固醇-聚乙二醇-荧光素科研试剂
- CAS:178744-28-0,mPEG-DSPE,DSPE-mPEG,甲氧基-聚乙二醇-磷脂酰乙醇胺供应
- 【深度学习】基于tensorflow的服装图像分类训练(数据集:Fashion-MNIST)
- Minimized installation of debian11
- Work Subtotal QT Packing
猜你喜欢
Creo 9.0二维草图的诊断:加亮开放端点
End-to-End Lane Marker Detection via Row-wise Classification
Cloud platform construction solutions
Minimized installation of debian11
最小化安装debian11
CAS: 178744-28-0, mPEG-DSPE, DSPE-mPEG, methoxy-polyethylene glycol-phosphatidylethanolamine supply
Unity 截取3D图像 与 画中画PIP的实现
Fluorescein-PEG-CLS,胆固醇-聚乙二醇-荧光素科研试剂
跨域的学习
complete binary tree problem
随机推荐
七夕?new一个对象
With the rise of concepts such as metaverse and web3.0, many digital forms such as digital people and digital scenes have begun to appear.
HCIP BGP lab report
软件测试内卷严重,如何提升自己的竞争力呢?
易观分析:2022年Q2中国网络零售B2C市场交易规模达23444.7亿元
OPC UA 与IEC61499 深度融合(1)
禾匠编译错误记录
重发布实验报告
Creo 9.0二维草图的诊断:重叠几何
Kotlin - extension functions and operator overloading
SPOJ 2774 Longest Common Substring(两串求公共子串 SAM)
物联网新零售模式,引领购物新潮流
jav一键生成数据库文档
rosbridge-WSL2 && carla-win11
Creo9.0 绘制中心线
SolidEdge ST8安装教程
Binary search tree to solve the fallen leaves problem
直播预告 | 构建业务智联,快速拥抱财务数字化转型
utlis 线程池
The sword refers to the offer question 22 - the Kth node from the bottom in the linked list