当前位置:网站首页>Screw database document generator
Screw database document generator
2022-06-22 19:32:00 【Algeria GG is learning】
One 、 Introduce dependencies
<dependency>
<groupId>cn.smallbun.screw</groupId>
<artifactId>screw-core</artifactId>
<version>1.0.3</version>
</dependency>Two 、 Write in test class
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() {
// data source
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");
// 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(" File path ")
// Open Directory
.openOutputDir(true)
// file type
.fileType(EngineFileType.HTML)
// Generate template implementation
.produceType(EngineTemplateType.freemarker)
// Custom file name
// .fileName("SQl.html")
.build();
// Ignore table
ArrayList<String> ignoreTableName = new ArrayList<>();
ignoreTableName.add("test_user");
ignoreTableName.add("test_group");
// Ignore table prefix
ArrayList<String> ignorePrefix = new ArrayList<>();
ignorePrefix.add("test_");
// Ignore table suffix
ArrayList<String> ignoreSuffix = new ArrayList<>();
ignoreSuffix.add("_test");
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)
// 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();
}
}
After running, view the generated files according to the directory type
边栏推荐
- 集群、分布式、微服务概念和区别
- Flush difficult to open an account? Is it safe to open an account online?
- Digital business cloud: build a digital supply chain system to enable enterprises to optimize and upgrade their logistics supply chain
- 贪心之分配问题(1)
- Method of activity jump to fragment (intent)
- Error in created hook: “TypeError: Cannot read property ‘tableId‘ of undefined“
- codeup最长回文子串
- 下拉刷新及上拉加载更多的ListView
- Shell script (V) -- function
- Digital commerce cloud: analyze the design idea of B2B2C multi-user mall system architecture, and open a new era of intelligent mall
猜你喜欢

YARN笔记

After reading the hated courage

线程池:ThreadPoolExcutor源码阅读

IPLOOK和思博伦通信建立长期合作

结构型模式之适配器模式

Shell programming specification and variables

Intelligent procurement system solution for processing and manufacturing industry: help enterprises realize integrated and Collaborative Procurement in the whole process

Digital commerce cloud: analyze the design idea of B2B2C multi-user mall system architecture, and open a new era of intelligent mall

加工制造业智慧采购系统解决方案:助力企业实现全流程采购一体化协同

Problems of different renderers running on the web with flutter2.0
随机推荐
STM32控制矩阵按键,HAL库,cubeMX配置
shell脚本详解(十)——sed编辑器的使用方法
Implementing Domain Driven Design - using ABP framework - solution overview
Flutter2.0运行在web上不同渲染器的问题
贪心之区间问题(2)
IPLOOK作为O-RAN联盟会员,将共同促进5G产业发展
【干货|接口测试必备技能-常见接口协议解析】
Problems of different renderers running on the web with flutter2.0
Shell编程规范与变量
数商云:解析B2B2C多用户商城系统架构设计思路,开启智能商城新时代
数字赋能机械制造业,供应链协同管理系统解决方案助力企业供应链再升级
Niuke.com: consolidation interval
mysql数据库设计
贪心之区间问题(1)
IPLOOK 成为 RedHat(红帽)业务合作伙伴
Screw数据库文档生成器
线程池:ThreadPoolExcutor源码阅读
数商云:数字化供应链系统搭建,赋能企业实现物流供应链的优化升级
程序员工具大全【持续更新】
输入两个字符串,输出最长相同子串