Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dc713fe

Browse files
committed
去掉通用Mapper和分页插件,就是一个干净的spring+mybatis
1 parent c6d5727 commit dc713fe

18 files changed

+546
-532
lines changed

pom.xml

-29
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@
1919
<!-- XML生成路径 -->
2020
<targetResourcesProject>${basedir}/src/main/resources</targetResourcesProject>
2121
<targetXMLPackage>mapper</targetXMLPackage>
22-
<!-- 编译jdk版本 -->
23-
<jdk.version>1.6</jdk.version>
24-
<!-- 依赖版本 -->
25-
<mapper.version>3.1.3</mapper.version>
26-
<pagehelper.version>4.0.0</pagehelper.version>
2722
<mysql.version>5.1.29</mysql.version>
2823
<spring.version>4.1.2.RELEASE</spring.version>
2924
</properties>
@@ -181,18 +176,6 @@
181176
<scope>compile</scope>
182177
<optional>true</optional>
183178
</dependency>
184-
<!--分页插件-->
185-
<dependency>
186-
<groupId>com.github.pagehelper</groupId>
187-
<artifactId>pagehelper</artifactId>
188-
<version>${pagehelper.version}</version>
189-
</dependency>
190-
<!--通用Mapper-->
191-
<dependency>
192-
<groupId>tk.mybatis</groupId>
193-
<artifactId>mapper</artifactId>
194-
<version>${mapper.version}</version>
195-
</dependency>
196179
</dependencies>
197180
<dependencyManagement>
198181
<dependencies>
@@ -253,13 +236,6 @@
253236
</resource>
254237
</resources>
255238
<plugins>
256-
<plugin>
257-
<artifactId>maven-compiler-plugin</artifactId>
258-
<configuration>
259-
<source>${jdk.version}</source>
260-
<target>${jdk.version}</target>
261-
</configuration>
262-
</plugin>
263239
<plugin>
264240
<groupId>org.mybatis.generator</groupId>
265241
<artifactId>mybatis-generator-maven-plugin</artifactId>
@@ -275,11 +251,6 @@
275251
<artifactId>mysql-connector-java</artifactId>
276252
<version>${mysql.version}</version>
277253
</dependency>
278-
<dependency>
279-
<groupId>tk.mybatis</groupId>
280-
<artifactId>mapper</artifactId>
281-
<version>${mapper.version}</version>
282-
</dependency>
283254
</dependencies>
284255
</plugin>
285256
</plugins>

src/main/java/com/isea533/mybatis/controller/demo/DemoController.java

+3-7
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,8 @@ public String index() {
4949
}
5050

5151
@ResponseBody
52-
@RequestMapping("test3")
53-
public List<Country> requestTest7(
54-
@RequestParam(value = "pageNum", required = false, defaultValue = "1") int pageNum,
55-
@RequestParam(value = "pageSize", required = false, defaultValue = "10") int pageSize
56-
) {
57-
demoService.test();
58-
return demoService.selectPage(pageNum, pageSize);
52+
@RequestMapping("test")
53+
public List<Country> selectAll() {
54+
return demoService.selectAll();
5955
}
6056
}
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,46 @@
1-
/*
2-
* The MIT License (MIT)
3-
*
4-
* Copyright (c) 2014 [email protected]
5-
*
6-
* Permission is hereby granted, free of charge, to any person obtaining a copy
7-
* of this software and associated documentation files (the "Software"), to deal
8-
* in the Software without restriction, including without limitation the rights
9-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
* copies of the Software, and to permit persons to whom the Software is
11-
* furnished to do so, subject to the following conditions:
12-
*
13-
* The above copyright notice and this permission notice shall be included in
14-
* all copies or substantial portions of the Software.
15-
*
16-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
* THE SOFTWARE.
23-
*/
24-
251
package com.isea533.mybatis.mapper;
262

27-
import tk.mybatis.mapper.common.Mapper;
283
import com.isea533.mybatis.model.Country;
4+
import java.util.List;
5+
6+
public interface CountryMapper {
7+
/**
8+
* This method was generated by MyBatis Generator.
9+
* This method corresponds to the database table country
10+
*
11+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
12+
*/
13+
int deleteByPrimaryKey(Integer id);
14+
15+
/**
16+
* This method was generated by MyBatis Generator.
17+
* This method corresponds to the database table country
18+
*
19+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
20+
*/
21+
int insert(Country record);
22+
23+
/**
24+
* This method was generated by MyBatis Generator.
25+
* This method corresponds to the database table country
26+
*
27+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
28+
*/
29+
Country selectByPrimaryKey(Integer id);
30+
31+
/**
32+
* This method was generated by MyBatis Generator.
33+
* This method corresponds to the database table country
34+
*
35+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
36+
*/
37+
List<Country> selectAll();
2938

30-
public interface CountryMapper extends Mapper<Country> {
39+
/**
40+
* This method was generated by MyBatis Generator.
41+
* This method corresponds to the database table country
42+
*
43+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
44+
*/
45+
int updateByPrimaryKey(Country record);
3146
}
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,46 @@
1-
/*
2-
* The MIT License (MIT)
3-
*
4-
* Copyright (c) 2014 [email protected]
5-
*
6-
* Permission is hereby granted, free of charge, to any person obtaining a copy
7-
* of this software and associated documentation files (the "Software"), to deal
8-
* in the Software without restriction, including without limitation the rights
9-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
* copies of the Software, and to permit persons to whom the Software is
11-
* furnished to do so, subject to the following conditions:
12-
*
13-
* The above copyright notice and this permission notice shall be included in
14-
* all copies or substantial portions of the Software.
15-
*
16-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
* THE SOFTWARE.
23-
*/
24-
251
package com.isea533.mybatis.mapper;
262

27-
import tk.mybatis.mapper.common.Mapper;
283
import com.isea533.mybatis.model.UserInfo;
4+
import java.util.List;
5+
6+
public interface UserInfoMapper {
7+
/**
8+
* This method was generated by MyBatis Generator.
9+
* This method corresponds to the database table user_info
10+
*
11+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
12+
*/
13+
int deleteByPrimaryKey(Integer id);
14+
15+
/**
16+
* This method was generated by MyBatis Generator.
17+
* This method corresponds to the database table user_info
18+
*
19+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
20+
*/
21+
int insert(UserInfo record);
22+
23+
/**
24+
* This method was generated by MyBatis Generator.
25+
* This method corresponds to the database table user_info
26+
*
27+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
28+
*/
29+
UserInfo selectByPrimaryKey(Integer id);
30+
31+
/**
32+
* This method was generated by MyBatis Generator.
33+
* This method corresponds to the database table user_info
34+
*
35+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
36+
*/
37+
List<UserInfo> selectAll();
2938

30-
public interface UserInfoMapper extends Mapper<UserInfo> {
39+
/**
40+
* This method was generated by MyBatis Generator.
41+
* This method corresponds to the database table user_info
42+
*
43+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
44+
*/
45+
int updateByPrimaryKey(UserInfo record);
3146
}
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,47 @@
1-
/*
2-
* The MIT License (MIT)
3-
*
4-
* Copyright (c) 2014 [email protected]
5-
*
6-
* Permission is hereby granted, free of charge, to any person obtaining a copy
7-
* of this software and associated documentation files (the "Software"), to deal
8-
* in the Software without restriction, including without limitation the rights
9-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
* copies of the Software, and to permit persons to whom the Software is
11-
* furnished to do so, subject to the following conditions:
12-
*
13-
* The above copyright notice and this permission notice shall be included in
14-
* all copies or substantial portions of the Software.
15-
*
16-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
* THE SOFTWARE.
23-
*/
24-
251
package com.isea533.mybatis.mapper;
262

27-
import tk.mybatis.mapper.common.Mapper;
283
import com.isea533.mybatis.model.UserLoginInfo;
4+
import java.util.List;
5+
import org.apache.ibatis.annotations.Param;
6+
7+
public interface UserLoginInfoMapper {
8+
/**
9+
* This method was generated by MyBatis Generator.
10+
* This method corresponds to the database table user login info
11+
*
12+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
13+
*/
14+
int deleteByPrimaryKey(@Param("id") Integer id, @Param("username") String username);
15+
16+
/**
17+
* This method was generated by MyBatis Generator.
18+
* This method corresponds to the database table user login info
19+
*
20+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
21+
*/
22+
int insert(UserLoginInfo record);
23+
24+
/**
25+
* This method was generated by MyBatis Generator.
26+
* This method corresponds to the database table user login info
27+
*
28+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
29+
*/
30+
UserLoginInfo selectByPrimaryKey(@Param("id") Integer id, @Param("username") String username);
31+
32+
/**
33+
* This method was generated by MyBatis Generator.
34+
* This method corresponds to the database table user login info
35+
*
36+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
37+
*/
38+
List<UserLoginInfo> selectAll();
2939

30-
public interface UserLoginInfoMapper extends Mapper<UserLoginInfo> {
40+
/**
41+
* This method was generated by MyBatis Generator.
42+
* This method corresponds to the database table user login info
43+
*
44+
* @mbggenerated Wed Aug 26 20:55:40 CST 2015
45+
*/
46+
int updateByPrimaryKey(UserLoginInfo record);
3147
}

0 commit comments

Comments
 (0)