1
1
<p align =" center " >
2
2
<a href =" https://github.com/geekidea/spring-boot-plus " >
3
- <img alt =" spring-boot-plus logo " src =" https://raw.githubusercontent.com/geekidea/spring-boot- plus/master/docs /img/logo.png " >
3
+ <img alt =" spring-boot-plus logo " src =" https://springboot. plus/img/logo.png " >
4
4
</a >
5
5
</p >
6
6
<p align =" center " >
@@ -102,45 +102,44 @@ mvn clean package -Plocal
102
102
103
103
### 1. 创建数据库表
104
104
``` sql
105
-
106
105
-- ----------------------------
107
- -- Table structure for sys_user
106
+ -- Table structure for foo_bar
108
107
-- ----------------------------
109
- drop table if exists ` sys_user ` ;
110
- create table sys_user
108
+ DROP TABLE IF EXISTS ` foo_bar ` ;
109
+ CREATE TABLE ` foo_bar `
111
110
(
112
- id bigint not null comment ' 主键'
113
- primary key ,
114
- username varchar (20 ) not null comment ' 用户名' ,
115
- nickname varchar (20 ) null comment ' 昵称' ,
116
- password varchar (64 ) not null comment ' 密码' ,
117
- salt varchar (32 ) null comment ' 盐值' ,
118
- remark varchar (200 ) null comment ' remark' ,
119
- status int default 1 not null comment ' 状态,0:禁用,1:启用' ,
120
- create_time timestamp default CURRENT_TIMESTAMP null comment ' 创建时间' ,
121
- update_time timestamp null comment ' 修改时间' ,
122
- constraint sys_user_username_uindex
123
- unique (username)
124
- )
125
- comment ' 系统用户' ;
111
+ ` id` bigint (20 ) NOT NULL COMMENT ' 主键' ,
112
+ ` name` varchar (20 ) NOT NULL COMMENT ' 名称' ,
113
+ ` foo` varchar (20 ) DEFAULT NULL COMMENT ' Foo' ,
114
+ ` bar` varchar (20 ) NOT NULL COMMENT ' Bar' ,
115
+ ` remark` varchar (200 ) DEFAULT NULL COMMENT ' 备注' ,
116
+ ` state` int (11 ) NOT NULL DEFAULT ' 1' COMMENT ' 状态,0:禁用,1:启用' ,
117
+ ` version` int (11 ) NOT NULL DEFAULT ' 0' COMMENT ' 版本' ,
118
+ ` create_time` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT ' 创建时间' ,
119
+ ` update_time` timestamp NULL DEFAULT NULL COMMENT ' 修改时间' ,
120
+ PRIMARY KEY (` id` )
121
+ ) ENGINE = InnoDB
122
+ DEFAULT CHARSET = utf8mb4
123
+ COLLATE = utf8mb4_general_ci COMMENT = ' FooBar' ;
126
124
127
125
-- ----------------------------
128
- -- Records of sys_user
126
+ -- Records of foo_bar
129
127
-- ----------------------------
130
- INSERT INTO spring_boot_plus . sys_user (id, username, nickname, password, salt, remark, state, create_time, update_time)
131
- VALUES (1 , ' admin ' , ' 管理员 ' , ' 751ade2f90ceb660cb2460f12cc6fe08268e628e4607bdb88a00605b3d66973c ' , ' e4cc3292e3ebc483998adb2c0e4e640e ' , ' Administrator Account ' , 1 , ' 2019-08-26 00:52:01 ' , null );
132
- INSERT INTO spring_boot_plus . sys_user (id, username, nickname, password, salt, remark, state, create_time, update_time)
133
- VALUES (2 , ' test ' , ' 测试人员 ' , ' 751ade2f90ceb660cb2460f12cc6fe08268e628e4607bdb88a00605b3d66973c ' , ' 99952b31c18156169a26bec80fd211f6 ' , ' Tester Account ' , 1 , ' 2019-10-05 14:04:27 ' , null );
128
+ INSERT INTO foo_bar (id, name, foo, bar, remark, state, version , create_time, update_time)
129
+ VALUES (1 , ' FooBar ' , ' foo ' , ' bar ' , ' remark... ' , 1 , 0 , ' 2019-11-01 14:05:14 ' , null );
130
+ INSERT INTO foo_bar (id, name, foo, bar, remark, state, version , create_time, update_time)
131
+ VALUES (2 , ' HelloWorld ' , ' hello ' , ' world ' , null , 1 , 0 , ' 2019-11-01 14:05:14 ' , null );
134
132
135
133
```
136
134
135
+
137
136
### 2.使用代码生成器生成增删改查代码
138
137
> 修改数据库信息
139
138
140
139
> 修改组件名称/作者/数据库表名称/主键id
141
140
142
141
``` text
143
- /src/test/java/io/geekidea/springbootplus/test/CodeGenerator .java
142
+ /src/test/java/io/geekidea/springbootplus/test/SpringBootPlusGenerator .java
144
143
```
145
144
146
145
``` java
@@ -169,7 +168,7 @@ public class SpringBootPlusGenerator {
169
168
170
169
// 组件作者等配置
171
170
codeGenerator
172
- .setModuleName(" system " )
171
+ .setModuleName(" foobar " )
173
172
.setAuthor(" geekidea" )
174
173
.setPkIdColumnName(" id" );
175
174
@@ -195,7 +194,7 @@ public class SpringBootPlusGenerator {
195
194
.setGeneratorMapperXml(true );
196
195
197
196
// 是否生成Shiro RequiresPermissions注解
198
- codeGenerator. setRequiresPermissions(true );
197
+ codeGenerator. setRequiresPermissions(false );
199
198
200
199
// 是否覆盖已有文件
201
200
codeGenerator. setFileOverride(true );
@@ -206,9 +205,7 @@ public class SpringBootPlusGenerator {
206
205
// 需要生成的表数组
207
206
// xxx,yyy,zzz为需要生成代码的表名称
208
207
String [] tables = {
209
- " xxx" ,
210
- " yyy" ,
211
- " zzz" ,
208
+ " foo_bar"
212
209
};
213
210
214
211
// 循环生成
@@ -227,31 +224,30 @@ public class SpringBootPlusGenerator {
227
224
> 生成的代码结构
228
225
229
226
``` text
230
- /src/main/java/io/geekidea/springbootplus/system
227
+ /src/main/java/io/geekidea/springbootplus/foobar
231
228
```
232
229
233
230
``` text
234
- └── system
231
+ └── foobar
232
+ ├── controller
233
+ │ └── FooBarController.java
235
234
├── entity
236
- │ └── SysUser .java
235
+ │ └── FooBar .java
237
236
├── mapper
238
- │ └── SysUserMapper.java
237
+ │ └── FooBarMapper.java
238
+ ├── param
239
+ │ └── FooBarQueryParam.java
239
240
├── service
240
- │ ├── SysUserService .java
241
+ │ ├── FooBarService .java
241
242
│ └── impl
242
- │ └── SysUserServiceImpl.java
243
- └── web
244
- ├── controller
245
- │ └── SysUserController.java
246
- ├── param
247
- │ └── SysUserQueryParam.java
248
- └── vo
249
- └── SysUserQueryVo.java
243
+ │ └── FooBarServiceImpl.java
244
+ └── vo
245
+ └── FooBarQueryVo.java
250
246
```
251
247
252
248
> Mapper XML
253
249
``` text
254
- /src/main/resources/mapper/system/SysUserMapper .xml
250
+ /src/main/resources/mapper/foobar/FooBarMapper .xml
255
251
```
256
252
257
253
### 3. 启动项目
@@ -350,6 +346,49 @@ sh deploy.sh
350
346
tail -f -n 1000 /root/spring-boot-plus-server/logs/spring-boot-plus.log
351
347
` ` `
352
348
349
+
350
+ # # spring-boot-plus Views
351
+
352
+ # ## spring-boot-plus IDEA Sources Views
353
+
354
+ ! [spring-boot-plus-idea](https://spring-boot-plus.gitee.io/img/home/spring-boot-plus-idea.png)
355
+
356
+ # ## [Spring Boot Admin Instances](http://47.105.159.10:8888/instances/e211ba082db8/details)
357
+ < p>
358
+ < a href=" http://47.105.159.10:8888/instances/e211ba082db8/details" >
359
+ < img src=" https://spring-boot-plus.gitee.io/img/home/spring-boot-admin.png" alt=" spring-boot-admin instances" >
360
+ < /a>
361
+ < /p>
362
+
363
+ # ## [Spring Boot Admin Statistics](http://47.105.159.10:8888/instances/e211ba082db8/details)
364
+ < p>
365
+ < a href=" http://47.105.159.10:8888/instances/e211ba082db8/details" >
366
+ < img src=" https://spring-boot-plus.gitee.io/img/home/spring-boot-admin-1.png" alt=" spring-boot-admin statistics" >
367
+ < /a>
368
+ < /p>
369
+
370
+ # ## [Spring Boot Admin Log](http://47.105.159.10:8888/instances/e211ba082db8/logfile)
371
+ < p>
372
+ < a href=" http://47.105.159.10:8888/instances/e211ba082db8/logfile" >
373
+ < img src=" https://spring-boot-plus.gitee.io/img/home/spring-boot-admin-log.png" alt=" spring-boot-admin log" >
374
+ < /a>
375
+ < /p>
376
+
377
+ # ## [spring-boot-plus Swagger文档](http://47.105.159.10:8888/swagger-ui.html)
378
+ < p>
379
+ < a href=" http://47.105.159.10:8888/swagger-ui.html" >
380
+ < img src=" https://spring-boot-plus.gitee.io/img/home/spring-boot-plus-swagger.png" alt=" spring-boot-plus swagger docs" >
381
+ < /a>
382
+ < /p>
383
+
384
+ # ## [spring-boot-plus Java Api Docs](http://geekidea.io/spring-boot-plus-apidocs/)
385
+ < p>
386
+ < a href=" http://geekidea.io/spring-boot-plus-apidocs/" >
387
+ < img src=" https://spring-boot-plus.gitee.io/img/home/spring-boot-plus-java-apidocs.png" alt=" spring-boot-plus Java Api Docs" >
388
+ < /a>
389
+ < /p>
390
+
391
+
353
392
# # spring-boot-plus 视频 :movie_camera:
354
393
- [5分钟完成增删改查](https://www.bilibili.com/video/av67401204)
355
394
- [CentOS 快速安装 JDK/Git/Maven/Redis/MySQL](https://www.bilibili.com/video/av67218836/)
0 commit comments