Skip to content

Commit 2cf0aa1

Browse files
author
geekidea
committed
README.md
1 parent 921ed20 commit 2cf0aa1

File tree

2 files changed

+23
-123
lines changed

2 files changed

+23
-123
lines changed

README-zh.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ mapstruct | 1.3.1.Final | 对象属性复制工具 |
9494
## CHANGELOG
9595
#### [CHANGELOG.md](https://github.com/geekidea/spring-boot-plus/blob/master/CHANGELOG.md)
9696

97-
## 使用
97+
## 快速开始
9898
### 克隆 spring-boot-plus
9999
```bash
100100
git clone https://gitee.com/geekidea/spring-boot-plus.git
@@ -234,6 +234,7 @@ public class SpringBootPlusGenerator {
234234
```text
235235
spring-boot-plus/generator/src/main/resources
236236
```
237+
237238
```text
238239
└── templates
239240
├── controller.java.vm 控制器代码生成模版
@@ -246,7 +247,7 @@ spring-boot-plus/generator/src/main/resources
246247
└── serviceImpl.java.vm 服务实现代码生成模版
247248
```
248249

249-
> 生成的代码结构
250+
#### 生成的代码结构
250251

251252
```text
252253
└── src

README.md

Lines changed: 20 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -152,101 +152,6 @@ INSERT INTO foo_bar (id, name, foo, bar, remark, state, version, create_time, up
152152
spring-boot-plus/generator/src/main/java/io/geekidea/springbootplus/generator/SpringBootPlusGenerator.java
153153
```
154154

155-
```java
156-
/**
157-
* spring-boot-plus Code Generator
158-
*
159-
* @author geekidea
160-
* @date 2019-10-22
161-
**/
162-
public class SpringBootPlusGenerator {
163-
164-
public static void main(String[] args) {
165-
CodeGenerator codeGenerator = new CodeGenerator();
166-
// Common configuration
167-
// Database configuration
168-
codeGenerator
169-
.setUserName("root")
170-
.setPassword("root")
171-
.setDriverName("com.mysql.jdbc.Driver")
172-
.setDriverUrl("jdbc:mysql://localhost:3306/spring_boot_plus?useUnicode=true&characterEncoding=UTF-8&useSSL=false");
173-
174-
// Configuration package information
175-
codeGenerator
176-
.setProjectPackagePath("io/geekidea/springbootplus")
177-
.setParentPackage("io.geekidea.springbootplus");
178-
179-
// Configuration of component author, etc.
180-
codeGenerator
181-
.setModuleName("foobar")
182-
.setAuthor("geekidea")
183-
.setPkIdColumnName("id");
184-
185-
// Generation strategy
186-
codeGenerator
187-
.setGeneratorStrategy(CodeGenerator.GeneratorStrategy.ALL)
188-
.setPageListOrder(true)
189-
.setParamValidation(true);
190-
191-
// Customize which files are generated automatically
192-
codeGenerator
193-
.setGeneratorEntity(true)
194-
.setGeneratorPageParam(true)
195-
.setGeneratorQueryVo(true);
196-
197-
// Generate business related codes
198-
codeGenerator
199-
.setGeneratorController(true)
200-
.setGeneratorService(true)
201-
.setGeneratorServiceImpl(true)
202-
.setGeneratorMapper(true)
203-
.setGeneratorMapperXml(true);
204-
205-
// Generated RequiresPermissions Annotation
206-
codeGenerator.setRequiresPermissions(false);
207-
208-
// Overwrite existing file or not
209-
codeGenerator.setFileOverride(true);
210-
211-
// Initialize common variables
212-
codeGenerator.init();
213-
214-
// Table array to be generated
215-
String[] tables = {
216-
"foo_bar"
217-
};
218-
219-
// Cycle generation
220-
for (String table : tables) {
221-
// Set the name of the table to be generated
222-
codeGenerator.setTableName(table);
223-
// Generate code
224-
codeGenerator.generator();
225-
}
226-
227-
}
228-
229-
}
230-
```
231-
232-
#### Code Generator Templates
233-
> Use Velocity template to generate code, you can customize and modify the code to generate template
234-
235-
```text
236-
spring-boot-plus/generator/src/main/resources
237-
```
238-
```text
239-
└── templates
240-
├── controller.java.vm controller generator template
241-
├── entity.java.vm entity generator template
242-
├── mapper.java.vm mapper generator template
243-
├── mapper.xml.vm mapper xml generator template
244-
├── pageParam.java.vm page param generator template
245-
├── queryVo.java.vm query vo generator template
246-
├── service.java.vm service generator template
247-
└── serviceImpl.java.vm service implement generator template
248-
```
249-
250155
```java
251156
/**
252157
* spring-boot-plus Code Generator Main Class
@@ -324,7 +229,25 @@ public class SpringBootPlusGenerator {
324229
}
325230
```
326231

327-
> Generated code structure
232+
#### Code Generator Templates
233+
> Use Velocity template to generate code, you can customize and modify the code to generate template
234+
235+
```text
236+
spring-boot-plus/generator/src/main/resources
237+
```
238+
```text
239+
└── templates
240+
├── controller.java.vm controller generator template
241+
├── entity.java.vm entity generator template
242+
├── mapper.java.vm mapper generator template
243+
├── mapper.xml.vm mapper xml generator template
244+
├── pageParam.java.vm page param generator template
245+
├── queryVo.java.vm query vo generator template
246+
├── service.java.vm service generator template
247+
└── serviceImpl.java.vm service implement generator template
248+
```
249+
250+
#### Generated code structure
328251

329252
```text
330253
└── src
@@ -355,35 +278,12 @@ public class SpringBootPlusGenerator {
355278

356279
### 3. Startup Project
357280
> Project Main Class
281+
358282
```text
359283
spring-boot-plus/bootstrap/src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java
360284
```
361285

362286
```java
363-
/**
364-
* spring-boot-plus Project Main Class
365-
* @author geekidea
366-
* @since 2018-11-08
367-
*/
368-
@EnableAsync
369-
@EnableScheduling
370-
@EnableTransactionManagement
371-
@EnableConfigurationProperties
372-
@EnableAdminServer
373-
@MapperScan({"io.geekidea.springbootplus.**.mapper"})
374-
@SpringBootApplication
375-
public class SpringBootPlusApplication {
376-
377-
public static void main(String[] args) {
378-
// Run spring-boot-plus
379-
ConfigurableApplicationContext context = SpringApplication.run(SpringBootPlusApplication.class, args);
380-
// Print Project Info
381-
PrintApplicationInfo.print(context);
382-
}
383-
384-
}
385-
386-
387287
/**
388288
* spring-boot-plus Project Main Class
389289
*
@@ -409,7 +309,6 @@ public class SpringBootPlusApplication {
409309
}
410310

411311
}
412-
413312
```
414313

415314
### 4. Access Swagger Docs

0 commit comments

Comments
 (0)