Skip to content

Commit c5d2db5

Browse files
committed
丰富ApiBoot Mybatis Enhance示例
1 parent b1f7cd9 commit c5d2db5

File tree

13 files changed

+921
-201
lines changed

13 files changed

+921
-201
lines changed

api-boot-samples/api-boot-sample-mybatis-enhance/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
<groupId>mysql</groupId>
4747
<artifactId>mysql-connector-java</artifactId>
4848
</dependency>
49+
<dependency>
50+
<groupId>org.springframework.boot</groupId>
51+
<artifactId>spring-boot-starter-test</artifactId>
52+
</dependency>
4953
</dependencies>
5054

5155
<dependencyManagement>

api-boot-samples/api-boot-sample-mybatis-enhance/src/main/java/org/minbox/framework/api/boot/sample/mybatis/enhance/ApiBootMybatisEnhanceApplication.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,49 +38,8 @@
3838
* GitHub:https://github.com/hengboy
3939
*/
4040
@SpringBootApplication
41-
@RestController
4241
public class ApiBootMybatisEnhanceApplication {
43-
44-
4542
public static void main(String[] args) {
4643
SpringApplication.run(ApiBootMybatisEnhanceApplication.class, args);
4744
}
48-
49-
@Autowired
50-
private UserMapper userMapper;
51-
52-
@Autowired
53-
private UserService userService;
54-
55-
/**
56-
* 查询全部用户
57-
*
58-
* @return
59-
*/
60-
@GetMapping(value = "/users")
61-
public List<UserEntity> list() {
62-
return userMapper.selectAll();
63-
}
64-
65-
/**
66-
* 查询用户详情
67-
*
68-
* @param userId
69-
* @return
70-
*/
71-
@GetMapping(value = "/{userId}")
72-
public UserEntity one(@PathVariable String userId) {
73-
return userMapper.selectOne(userId);
74-
}
75-
76-
/**
77-
* 示例:动态查询用户详情
78-
*
79-
* @param userId 用户编号
80-
* @return
81-
*/
82-
@GetMapping(value = "/dynamic/{userId}")
83-
public UserEntity dynamic(@PathVariable String userId) {
84-
return userService.dynamicSelectOne(userId);
85-
}
8645
}

api-boot-samples/api-boot-sample-mybatis-enhance/src/main/java/org/minbox/framework/api/boot/sample/mybatis/enhance/DUserEntity.java

Lines changed: 0 additions & 55 deletions
This file was deleted.

api-boot-samples/api-boot-sample-mybatis-enhance/src/main/java/org/minbox/framework/api/boot/sample/mybatis/enhance/UserService.java

Lines changed: 0 additions & 88 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*
2+
* Copyright [2019] [恒宇少年 - 于起宇]
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
package org.minbox.framework.api.boot.sample.mybatis.enhance.dsl;
19+
20+
import com.gitee.hengboy.mybatis.enhance.dsl.expression.ColumnExpression;
21+
import com.gitee.hengboy.mybatis.enhance.dsl.expression.TableExpression;
22+
import org.minbox.framework.api.boot.sample.mybatis.enhance.entity.SystemUser;
23+
24+
/**
25+
* 系统用户信息表
26+
*
27+
* @author ApiBoot Mybatis Enhance Codegen
28+
*/
29+
public class DSystemUser extends TableExpression<SystemUser> {
30+
31+
public DSystemUser(String root) {
32+
super(root);
33+
}
34+
35+
public static DSystemUser DSL() {
36+
return new DSystemUser("iot_system_user");
37+
}
38+
39+
/**
40+
* 主键
41+
*/
42+
public ColumnExpression id = new ColumnExpression("SU_ID", this);
43+
/**
44+
* 用户名
45+
*/
46+
public ColumnExpression userName = new ColumnExpression("SU_USER_NAME", this);
47+
/**
48+
* 用户昵称
49+
*/
50+
public ColumnExpression nickName = new ColumnExpression("SU_NICK_NAME", this);
51+
/**
52+
* 年龄
53+
*/
54+
public ColumnExpression age = new ColumnExpression("SU_AGE", this);
55+
/**
56+
* 用户密码
57+
*/
58+
public ColumnExpression password = new ColumnExpression("SU_PASSWORD", this);
59+
/**
60+
* 用户状态,1:正常,0:冻结,-1:已删除
61+
*/
62+
public ColumnExpression status = new ColumnExpression("SU_STATUS", this);
63+
/**
64+
* 创建时间
65+
*/
66+
public ColumnExpression createTime = new ColumnExpression("SU_CREATE_TIME", this);
67+
/**
68+
* 备注信息
69+
*/
70+
public ColumnExpression mark = new ColumnExpression("SU_MARK", this);
71+
72+
@Override
73+
public ColumnExpression[] getColumns() {
74+
return new ColumnExpression[]{id, userName, nickName, age, password, status, createTime, mark};
75+
}
76+
77+
}
78+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* Copyright [2019] [恒宇少年 - 于起宇]
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*
16+
*/
17+
18+
package org.minbox.framework.api.boot.sample.mybatis.enhance.dsl;
19+
20+
import com.gitee.hengboy.mybatis.enhance.dsl.expression.ColumnExpression;
21+
import com.gitee.hengboy.mybatis.enhance.dsl.expression.TableExpression;
22+
import org.minbox.framework.api.boot.sample.mybatis.enhance.entity.SystemUserRole;
23+
24+
/**
25+
* 系统用户角色关联表
26+
* @author ApiBoot Mybatis Enhance Codegen
27+
*/
28+
public class DSystemUserRole extends TableExpression<SystemUserRole> {
29+
30+
public DSystemUserRole(String root) {
31+
super(root);
32+
}
33+
34+
public static DSystemUserRole DSL() {
35+
return new DSystemUserRole("iot_system_user_role");
36+
}
37+
38+
/**
39+
* 主键自增
40+
*/
41+
public ColumnExpression id = new ColumnExpression("SUR_ID", this);
42+
/**
43+
* 角色编号,关联iot_system_role主键
44+
*/
45+
public ColumnExpression roleId = new ColumnExpression("SUR_ROLE_ID", this);
46+
/**
47+
* 用户编号,关联iot_system_user主键
48+
*/
49+
public ColumnExpression userId = new ColumnExpression("SUR_USER_ID", this);
50+
/**
51+
* 创建时间
52+
*/
53+
public ColumnExpression createTime = new ColumnExpression("SUR_CREATE_TIME", this);
54+
@Override
55+
public ColumnExpression[] getColumns() {
56+
return new ColumnExpression[]{id, roleId, userId, createTime};
57+
}
58+
59+
}
60+

0 commit comments

Comments
 (0)