Skip to content

Commit 8bf53aa

Browse files
author
Tellsea
committed
SpringBoot 集成 screw
1 parent df5629b commit 8bf53aa

File tree

3 files changed

+187
-43
lines changed

3 files changed

+187
-43
lines changed

README.md

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# SpringBoot
22

3-
支持作者就star一下,谢谢 🎉🎉
3+
支持作者就 star 一下,谢谢 🎉🎉
44

5-
springboot-learn 这个工程为IDEA创建的Empty Project工程,其余子工程之间互不干涉,clone之后可以更改一下maven的配置即可
5+
springboot-learn 这个工程为 IDEA 创建的 Empty Project 工程,其余子工程之间互不干涉,clone 之后可以更改一下 maven 的配置即可
66

77
## 基础框架
88

@@ -18,71 +18,71 @@ springboot-learn 这个工程为IDEA创建的Empty Project工程,其余子工
1818

1919
## 基础篇
2020

21-
| 名称 | 博文地址 | 源码地址 |
22-
|:--|:--|:--|
23-
| SpringBoot 入门案例 Hello World | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-hello)|
24-
| SpringBoot 配置 Thymeleaf 模板引擎 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-thymeleaf) |
25-
| SpringBoot 搭建全局异常处理 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-global) |
26-
| SpringBoot 配置 Druid 连接池 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-druid) |
27-
| SpringBoot 配置 AOP 切面记录日志 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-aop-log) |
28-
| SpringBoot 配置 Actuator 监控 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-actuator) |
29-
| SpringBoot 配置 Swagger2 实现 restfull风格 API 文档 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-swagger2) |
30-
| SpringBoot 配置 Thymeleaf 页面静态化 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-thymeleaf-static) |
21+
| 名称 | 博文地址 | 源码地址 |
22+
| :--------------------------------------------------- | :------- | :------------------------------------------------------------------------------------------ |
23+
| SpringBoot 入门案例 Hello World | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-hello) |
24+
| SpringBoot 配置 Thymeleaf 模板引擎 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-thymeleaf) |
25+
| SpringBoot 搭建全局异常处理 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-global) |
26+
| SpringBoot 配置 Druid 连接池 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-druid) |
27+
| SpringBoot 配置 AOP 切面记录日志 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-aop-log) |
28+
| SpringBoot 配置 Actuator 监控 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-actuator) |
29+
| SpringBoot 配置 Swagger2 实现 restfull 风格 API 文档 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-swagger2) |
30+
| SpringBoot 配置 Thymeleaf 页面静态化 | | [源码](https://github.com/Tellsea/springboot-learn/tree/master/springboot-thymeleaf-static) |
3131

3232
## 整合篇
3333

3434
### 持久层
3535

36-
| 名称 | 博文地址 | 源码地址 |
37-
|:--|:--|:--|
38-
| SpringBoot 整合 Mybatis | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-mybatis)|
39-
| SpringBoot 整合 SpringData JPA | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-jpa)|
40-
| SpringBoot 整合 JDBC Templete | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-jdbc-templete)|
36+
| 名称 | 博文地址 | 源码地址 |
37+
| :----------------------------- | :------- | :--------------------------------------------------------------------------------------- |
38+
| SpringBoot 整合 Mybatis | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-mybatis) |
39+
| SpringBoot 整合 SpringData JPA | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-jpa) |
40+
| SpringBoot 整合 JDBC Templete | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-jdbc-templete) |
4141

4242
### 定时器
4343

44-
| 名称 | 博文地址 | 源码地址 |
45-
|:--|:--|:--|
46-
| SpringBoot 整合 Task 定时器 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-task)|
47-
| SpringBoot 整合 Quartz 任务调度 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-quartz)|
44+
| 名称 | 博文地址 | 源码地址 |
45+
| :------------------------------ | :------- | :-------------------------------------------------------------------------------- |
46+
| SpringBoot 整合 Task 定时器 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-task) |
47+
| SpringBoot 整合 Quartz 任务调度 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-quartz) |
4848

4949
### 缓存
5050

51-
| 名称 | 博文地址 | 源码地址 |
52-
|:--|:--|:--|
53-
| SpringBoot 整合 Ehcache 高性能缓存 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-ehcache)|
54-
| SpringBoot 整合 Redis 缓存管理 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-redis)|
51+
| 名称 | 博文地址 | 源码地址 |
52+
| :--------------------------------- | :------- | :--------------------------------------------------------------------------------- |
53+
| SpringBoot 整合 Ehcache 高性能缓存 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-ehcache) |
54+
| SpringBoot 整合 Redis 缓存管理 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-redis) |
5555

5656
### 权限
5757

58-
| 名称 | 博文地址 | 源码地址 |
59-
|:--|:--|:--|
60-
| SpringBoot 整合 Shiro 权限管理 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-shiro)|
61-
| SpringBoot 整合 SpringSecurity 权限管理 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-security)|
62-
| SpringBoot 整合 JWT + RSA 分布式授权 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-jwt-rsa)|
58+
| 名称 | 博文地址 | 源码地址 |
59+
| :-------------------------------------- | :------- | :---------------------------------------------------------------------------------- |
60+
| SpringBoot 整合 Shiro 权限管理 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-shiro) |
61+
| SpringBoot 整合 SpringSecurity 权限管理 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-security) |
62+
| SpringBoot 整合 JWT + RSA 分布式授权 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-jwt-rsa) |
6363

6464
### 邮件短信
6565

66-
| 名称 | 博文地址 | 源码地址 |
67-
|:--|:--|:--|
68-
| SpringBoot 整合 Email 发送邮件 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-email)|
69-
| SpringBoot 整合 SMS 阿里短信服务 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-sms)|
66+
| 名称 | 博文地址 | 源码地址 |
67+
| :------------------------------- | :------- | :------------------------------------------------------------------------------- |
68+
| SpringBoot 整合 Email 发送邮件 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-email) |
69+
| SpringBoot 整合 SMS 阿里短信服务 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-sms) |
7070

7171
### 中间件
7272

73-
| 名称 | 博文地址 | 源码地址 |
74-
|:--|:--|:--|
75-
| SpringBoot 整合 七牛云对象存储 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-qiniu)|
76-
| SpringBoot 整合 Easypoi 打印报表 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-easypoi)|
77-
| SpringBoot 整合 RabbitMQ 消息中间件 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-rabbitmq)|
78-
| SpringBoot 整合 WebSocket 聊天案例 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-websocket)|
79-
| SpringBoot 使用 Echars 实现数据可视化 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-echarts)|
73+
| 名称 | 博文地址 | 源码地址 |
74+
| :------------------------------------ | :------- | :----------------------------------------------------------------------------------- |
75+
| SpringBoot 整合 七牛云对象存储 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-qiniu) |
76+
| SpringBoot 整合 Easypoi 打印报表 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-easypoi) |
77+
| SpringBoot 整合 RabbitMQ 消息中间件 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-rabbitmq) |
78+
| SpringBoot 整合 WebSocket 聊天案例 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-websocket) |
79+
| SpringBoot 使用 Echars 实现数据可视化 | 链接 | [链接](https://github.com/Tellsea/springboot-learn/tree/master/springboot-echarts) |
8080

8181
## 注意事项
8282

83-
每次学习前请先使用git更新项目,避免产生只是新旧代码问题。
83+
每次学习前请先使用 git 更新项目,避免产生只是新旧代码问题。
8484

85-
一些工程的测试方法在springboot的测试类中,比如:mybatis的通用mapper,CRUD的方法在测试类中测试的
85+
一些工程的测试方法在 springboot 的测试类中,比如:mybatis 的通用 mapper,CRUD 的方法在测试类中测试的
8686

8787
**我不管,看了就 Star**
8888

springboot-screw/pom.xml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>org.springframework.boot</groupId>
9+
<artifactId>spring-boot-starter-parent</artifactId>
10+
<version>2.1.3.RELEASE</version>
11+
<relativePath/> <!-- lookup parent from repository -->
12+
</parent>
13+
14+
<groupId>cn.tellsea</groupId>
15+
<artifactId>springboot-screw</artifactId>
16+
<version>1.0-SNAPSHOT</version>
17+
18+
<properties>
19+
<maven.compiler.source>8</maven.compiler.source>
20+
<maven.compiler.target>8</maven.compiler.target>
21+
</properties>
22+
23+
<dependencies>
24+
<dependency>
25+
<groupId>org.springframework.boot</groupId>
26+
<artifactId>spring-boot-starter-web</artifactId>
27+
</dependency>
28+
29+
<dependency>
30+
<groupId>com.zaxxer</groupId>
31+
<artifactId>HikariCP</artifactId>
32+
<version>3.4.5</version>
33+
</dependency>
34+
35+
<dependency>
36+
<groupId>mysql</groupId>
37+
<artifactId>mysql-connector-java</artifactId>
38+
<version>5.1.47</version>
39+
<scope>runtime</scope>
40+
</dependency>
41+
42+
<dependency>
43+
<groupId>cn.smallbun.screw</groupId>
44+
<artifactId>screw-core</artifactId>
45+
<version>1.0.5</version>
46+
</dependency>
47+
</dependencies>
48+
49+
</project>
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
package cn.tellsea.test;
2+
3+
import cn.smallbun.screw.core.Configuration;
4+
import cn.smallbun.screw.core.engine.EngineConfig;
5+
import cn.smallbun.screw.core.engine.EngineFileType;
6+
import cn.smallbun.screw.core.engine.EngineTemplateType;
7+
import cn.smallbun.screw.core.execute.DocumentationExecute;
8+
import cn.smallbun.screw.core.process.ProcessConfig;
9+
import com.zaxxer.hikari.HikariConfig;
10+
import com.zaxxer.hikari.HikariDataSource;
11+
12+
import javax.sql.DataSource;
13+
import java.util.ArrayList;
14+
15+
/**
16+
* SpringBoot 集成 screw 一键生成数据库文档
17+
*
18+
* @author Tellsea
19+
* @date 2022/3/16
20+
*/
21+
public class MainTest {
22+
23+
public static void main(String[] args) {
24+
documentGeneration();
25+
}
26+
27+
/**
28+
* 文档生成
29+
*/
30+
public static void documentGeneration() {
31+
//数据源
32+
HikariConfig hikariConfig = new HikariConfig();
33+
hikariConfig.setDriverClassName("com.mysql.jdbc.Driver");
34+
hikariConfig.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/project-service?useUnicode=true&characterEncoding=UTF-8");
35+
hikariConfig.setUsername("root");
36+
hikariConfig.setPassword("123456");
37+
//设置可以获取tables remarks信息
38+
hikariConfig.addDataSourceProperty("useInformationSchema", "true");
39+
hikariConfig.setMinimumIdle(2);
40+
hikariConfig.setMaximumPoolSize(5);
41+
DataSource dataSource = new HikariDataSource(hikariConfig);
42+
//生成配置
43+
EngineConfig engineConfig = EngineConfig.builder()
44+
//生成文件路径
45+
.fileOutputDir("D:\\test")
46+
//打开目录
47+
.openOutputDir(true)
48+
//文件类型
49+
.fileType(EngineFileType.MD)
50+
//生成模板实现
51+
.produceType(EngineTemplateType.freemarker)
52+
//自定义文件名称
53+
.fileName("自定义文件名称").build();
54+
55+
//忽略表
56+
ArrayList<String> ignoreTableName = new ArrayList<>();
57+
ignoreTableName.add("test_user");
58+
ignoreTableName.add("test_group");
59+
//忽略表前缀
60+
ArrayList<String> ignorePrefix = new ArrayList<>();
61+
ignorePrefix.add("test_");
62+
//忽略表后缀
63+
ArrayList<String> ignoreSuffix = new ArrayList<>();
64+
ignoreSuffix.add("_test");
65+
ProcessConfig processConfig = ProcessConfig.builder()
66+
//指定生成逻辑、当存在指定表、指定表前缀、指定表后缀时,将生成指定表,其余表不生成、并跳过忽略表配置
67+
//根据名称指定表生成
68+
.designatedTableName(new ArrayList<>())
69+
//根据表前缀生成
70+
.designatedTablePrefix(new ArrayList<>())
71+
//根据表后缀生成
72+
.designatedTableSuffix(new ArrayList<>())
73+
//忽略表名
74+
.ignoreTableName(ignoreTableName)
75+
//忽略表前缀
76+
.ignoreTablePrefix(ignorePrefix)
77+
//忽略表后缀
78+
.ignoreTableSuffix(ignoreSuffix).build();
79+
//配置
80+
Configuration config = Configuration.builder()
81+
//版本
82+
.version("1.0.0")
83+
//描述
84+
.description("数据库设计文档生成")
85+
//数据源
86+
.dataSource(dataSource)
87+
//生成配置
88+
.engineConfig(engineConfig)
89+
//生成配置
90+
.produceConfig(processConfig)
91+
.build();
92+
//执行生成
93+
new DocumentationExecute(config).execute();
94+
}
95+
}

0 commit comments

Comments
 (0)