@@ -152,101 +152,6 @@ INSERT INTO foo_bar (id, name, foo, bar, remark, state, version, create_time, up
152152spring-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
359283spring-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