当前位置:网站首页>Database generates HTML document
Database generates HTML document
2022-07-22 01:47:00 【Dotclv】
Today, I found a good database to generate documents. The code is recorded
Add a dependency
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.my</groupId>
<artifactId>mysqldocument</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId>
<version>1.0.5</version>
</dependency>
<dependency>
<groupId>com.zaxxer</groupId>
<artifactId>HikariCP</artifactId>
<version>3.4.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Code implementation
import cn.smallbun.screw.core.Configuration;
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 MysqldocumentApplicationTests {
@Test
void documentGeneration() {
// data source
HikariConfig hikariConfig = new HikariConfig();
hikariConfig.setDriverClassName("com.mysql.cj.jdbc.Driver");
hikariConfig.setJdbcUrl("jdbc:mysql://xxx.xxx.xxx.xxx:3306/xxx_xx?characterEncoding=UTF-8");
hikariConfig.setUsername("root");
hikariConfig.setPassword("xxx");
// Set to get tables remarks Information
hikariConfig.addDataSourceProperty("useInformationSchema", "true");
hikariConfig.setMinimumIdle(2);
hikariConfig.setMaximumPoolSize(5);
DataSource dataSource = new HikariDataSource(hikariConfig);
// Generate configuration
EngineConfig engineConfig = EngineConfig.builder()
// Generate file path
.fileOutputDir("/cn/")
// Open Directory
.openOutputDir(true)
// file type
.fileType(EngineFileType.HTML)
// Generate template implementation
.produceType(EngineTemplateType.freemarker)
// Custom file name
.fileName(" Test generation database document ").build();
// Ignore table
ArrayList<String> ignoreTableName = new ArrayList<>();
ignoreTableName.add("xxl_job_group");
ignoreTableName.add("xxl_job_info");
// Ignore table prefix
// ArrayList<String> ignorePrefix = new ArrayList<>();
// ignorePrefix.add("xxl_");
// // Ignore table suffix
// ArrayList<String> ignoreSuffix = new ArrayList<>();
// ignoreSuffix.add("_user");
ProcessConfig processConfig = ProcessConfig.builder()
// Specify the generation logic 、 When there is a specified table 、 Specify table prefix 、 When specifying the table suffix , The specified table will be generated , The rest of the tables do not generate 、 And skip ignoring table configuration
// Specify a table by name to generate
.designatedTableName(new ArrayList<>())
// Generate according to the table prefix
.designatedTablePrefix(new ArrayList<>())
// Generate from table suffix
.designatedTableSuffix(new ArrayList<>())
// Ignore table name
.ignoreTableName(ignoreTableName).build();
// Ignore table prefix
// .ignoreTablePrefix(ignorePrefix)
// // Ignore table suffix
// .ignoreTableSuffix(ignoreSuffix).build();
// To configure
Configuration config = Configuration.builder()
// edition
.version("1.0.0")
// describe
.description(" Database design document generation ")
// data source
.dataSource(dataSource)
// Generate configuration
.engineConfig(engineConfig)
// Generate configuration
.produceConfig(processConfig)
.build();
// Perform build
new DocumentationExecute(config).execute();
}
}
边栏推荐
- 群晖7.1.0万兆网络实测
- TCP的滑动窗口、单例模式(懒汉饿汉)双检锁/双重校验锁(DCL,即 double-checked locking)
- Est - ce que cela signifie que le binlog de MySQL est activé?
- CRM concept: understand the concepts of leads, prospect, MQL and SQL
- huawei设置使用账号密码登录
- 看看
- 乘风破浪,金融科技时代下的数字化转型之路
- 【着色器实现Television信号三原色闪烁效果_Shader效果第五篇】
- linux服务器安装了图形界面,但是在安装数据库时显示初始化图形界面失败
- Easyexcel is easy to use
猜你喜欢
午休专列&问题思考:由时:分:秒构成字符串转换为秒的问题思考
【集训DAY8】【Luogu_P6335】Staza【Tarjan】
每个博主都需要问自己的7个基本问题
Leetcode 48旋转图像(水平+主对角线)、Leetcode 221最大正方形(动态规划dp表示以ij为右下角的答案值)、Leetcode 240搜索二维矩阵II(排除行列法)
Easyexcel realizes file upload - batch insert file download
TCP的滑动窗口、单例模式(懒汉饿汉)双检锁/双重校验锁(DCL,即 double-checked locking)
Major breakthrough! Successful development of the first domestic scientific computing software
LeetCode 560和为 K 的子数组(有负数、一次遍历前缀和)、LeetCode 438找到字符串中所有字母异位词(优化滑动窗口)、LeetCode 141环形链表I(快慢指针)、142II
Jupyterhub配置Go环境
Strict location dependent optimization of dynamic recursion
随机推荐
一文深入浅出理解国产开源木兰许可系列协议
乘风破浪,金融科技时代下的数字化转型之路
Number game: n people count off, those who report a multiple of 3 leave, and the rest continue
Easyexcel realizes file upload - batch insert file download
Riding the wind and waves, the road of digital transformation in the era of financial technology
Father son process, zombie process and orphan process
1、Nacos 配置中心源码解析之 Hello World
linux服务器安装了图形界面,但是在安装数据库时显示初始化图形界面失败
請問這是錶示mysql的binlog已經開啟嗎?
Pyqt5 packaging error, missing files, such as importerror: opencv loader: missing configuration file: ['config.py'] Check
学习路之PHP--thinkphp5+windows服务器实现定时任务
谷歌展示 Chrome 浏览器图标废案,曾打算做成小火箭
CRM concept: understand the concepts of leads, prospect, MQL and SQL
CRM 概念:了解Leads、Prospect、MQL 和 SQL 的概念
Judgment of empty string in Oracle
tinymce 去掉编辑器换行默认增加的p标签
TCP的滑动窗口、单例模式(懒汉饿汉)双检锁/双重校验锁(DCL,即 double-checked locking)
NepCTF2022 WP
【集训DAY8】Series【矩阵乘法】
Idea running @test cannot be input from the console and is in the loading state