Skip to content

Commit 873b361

Browse files
committed
SpringBootGenerator提交
0 parents  commit 873b361

26 files changed

+1435
-0
lines changed

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/target/
2+
!.mvn/wrapper/maven-wrapper.jar
3+
4+
### STS ###
5+
.apt_generated
6+
.classpath
7+
.factorypath
8+
.project
9+
.settings
10+
.springBeans
11+
.sts4-cache
12+
13+
### IntelliJ IDEA ###
14+
.idea
15+
*.iws
16+
*.iml
17+
*.ipr
18+
19+
### NetBeans ###
20+
/nbproject/private/
21+
/build/
22+
/nbbuild/
23+
/dist/
24+
/nbdist/
25+
/.nb-gradle/

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SpringBootGenerator
2+
3+
> 参考:[https://github.com/lihengming/spring-boot-api-project-seed](https://github.com/lihengming/spring-boot-api-project-seed)
4+
5+
#### 项目介绍
6+
7+
SpringBootGenerator是一个基于SpringBoot & MyBatis的种子项目,用于快速构建中小型API、RESTful API项目,稳定、简单、快速,使我们摆脱那些重复劳动,专注于业务代码的编写,能在短短几十秒钟内实现一套简单的API(自动生成Model、Mapper、MapperXML、Service、ServiceImpl、Controller基础代码),并运行提供服务
8+
9+
1. 统一响应结果封装
10+
2. 统一异常处理
11+
3. 集成通用Mapper插件、PageHelper分页插件,实现单表业务零SQL
12+
4. Controller模板提供POST和RESTful两套
13+
5. 通用BaseService
14+
15+
在原项目上修改
16+
17+
1. 改为SpringBoot的通用Mapper插件、PageHelper分页插件,配置更少
18+
2. 提供更完整的通用BaseService
19+
3. 优化Controller方法
20+
21+
#### 软件架构
22+
23+
SpringBoot + Mybatis + PageHelper + 通用Mapper
24+
25+
#### 安装教程
26+
27+
1. 解压后执行src\test\resources\sql\MySQL.sql脚本创建数据库和表
28+
2. src\test\java\com\example\generator\CodeGenerator.java运行Main方法生成代码
29+
30+
#### 使用说明
31+
32+
1. 可以自行修改src\test\resources\template下的模板
33+
34+
#### 参与贡献
35+
36+
1. Fork 本项目
37+
2. 新建 Feat_xxx 分支
38+
3. 提交代码
39+
4. 新建 Pull Request

pom.xml

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<groupId>com.example</groupId>
7+
<artifactId>SpringBootGenerator</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<packaging>jar</packaging>
10+
11+
<name>SpringBootGenerator</name>
12+
<description>Demo project for Spring Boot</description>
13+
14+
<parent>
15+
<groupId>org.springframework.boot</groupId>
16+
<artifactId>spring-boot-starter-parent</artifactId>
17+
<version>1.5.16.RELEASE</version>
18+
<relativePath/> <!-- lookup parent from repository -->
19+
</parent>
20+
21+
<properties>
22+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
23+
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
24+
<java.version>1.8</java.version>
25+
<mybatis.version>1.3.2</mybatis.version>
26+
<druid.version>1.1.10</druid.version>
27+
<pagehelper.version>1.2.3</pagehelper.version>
28+
<mapper.version>1.2.3</mapper.version>
29+
<fastjson.version>1.2.47</fastjson.version>
30+
<freemarker.version>2.3.23</freemarker.version>
31+
<generator.version>1.3.6</generator.version>
32+
<guava.version>23.0</guava.version>
33+
<commons-lang3.version>3.7</commons-lang3.version>
34+
</properties>
35+
36+
<dependencies>
37+
<dependency>
38+
<groupId>org.springframework.boot</groupId>
39+
<artifactId>spring-boot-starter</artifactId>
40+
</dependency>
41+
42+
<dependency>
43+
<groupId>org.springframework.boot</groupId>
44+
<artifactId>spring-boot-starter-test</artifactId>
45+
<scope>test</scope>
46+
</dependency>
47+
48+
<dependency>
49+
<groupId>org.springframework.boot</groupId>
50+
<artifactId>spring-boot-devtools</artifactId>
51+
<optional>true</optional>
52+
</dependency>
53+
54+
<!-- Web -->
55+
<dependency>
56+
<groupId>org.springframework.boot</groupId>
57+
<artifactId>spring-boot-starter-web</artifactId>
58+
</dependency>
59+
60+
<!-- Mysql-Connector -->
61+
<dependency>
62+
<groupId>mysql</groupId>
63+
<artifactId>mysql-connector-java</artifactId>
64+
</dependency>
65+
66+
<!-- Mybatis -->
67+
<dependency>
68+
<groupId>org.mybatis.spring.boot</groupId>
69+
<artifactId>mybatis-spring-boot-starter</artifactId>
70+
<version>${mybatis.version}</version>
71+
</dependency>
72+
73+
<!-- Druid -->
74+
<dependency>
75+
<groupId>com.alibaba</groupId>
76+
<artifactId>druid-spring-boot-starter</artifactId>
77+
<version>${druid.version}</version>
78+
</dependency>
79+
80+
<!-- Pagehelper -->
81+
<dependency>
82+
<groupId>com.github.pagehelper</groupId>
83+
<artifactId>pagehelper-spring-boot-starter</artifactId>
84+
<version>${pagehelper.version}</version>
85+
</dependency>
86+
87+
<!-- 通用Mapper -->
88+
<dependency>
89+
<groupId>tk.mybatis</groupId>
90+
<artifactId>mapper-spring-boot-starter</artifactId>
91+
<version>${mapper.version}</version>
92+
</dependency>
93+
94+
<!-- Fastjson -->
95+
<dependency>
96+
<groupId>com.alibaba</groupId>
97+
<artifactId>fastjson</artifactId>
98+
<version>${fastjson.version}</version>
99+
</dependency>
100+
101+
<!-- Generator -->
102+
<dependency>
103+
<groupId>org.freemarker</groupId>
104+
<artifactId>freemarker</artifactId>
105+
<version>${freemarker.version}</version>
106+
<scope>test</scope>
107+
</dependency>
108+
109+
<dependency>
110+
<groupId>org.mybatis.generator</groupId>
111+
<artifactId>mybatis-generator-maven-plugin</artifactId>
112+
<version>${generator.version}</version>
113+
<scope>test</scope>
114+
</dependency>
115+
116+
<!-- Guava -->
117+
<dependency>
118+
<groupId>com.google.guava</groupId>
119+
<artifactId>guava</artifactId>
120+
<version>${guava.version}</version>
121+
</dependency>
122+
123+
<!-- Commons-Lang3 -->
124+
<dependency>
125+
<groupId>org.apache.commons</groupId>
126+
<artifactId>commons-lang3</artifactId>
127+
<version>${commons-lang3.version}</version>
128+
</dependency>
129+
</dependencies>
130+
131+
<build>
132+
<plugins>
133+
<!-- SrpingBoot打包工具 -->
134+
<plugin>
135+
<groupId>org.springframework.boot</groupId>
136+
<artifactId>spring-boot-maven-plugin</artifactId>
137+
</plugin>
138+
<!-- 指定JDK编译版本 -->
139+
<plugin>
140+
<groupId>org.apache.maven.plugins</groupId>
141+
<artifactId>maven-compiler-plugin</artifactId>
142+
<configuration>
143+
<source>${java.version}</source>
144+
<target>${java.version}</target>
145+
<encoding>${project.build.sourceEncoding}</encoding>
146+
</configuration>
147+
</plugin>
148+
</plugins>
149+
</build>
150+
151+
</project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.example;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
6+
@SpringBootApplication
7+
@tk.mybatis.spring.annotation.MapperScan("com.example.mapper")
8+
public class Application {
9+
10+
public static void main(String[] args) {
11+
SpringApplication.run(Application.class, args);
12+
}
13+
}

0 commit comments

Comments
 (0)