File tree Expand file tree Collapse file tree 5 files changed +10
-12
lines changed Expand file tree Collapse file tree 5 files changed +10
-12
lines changed Original file line number Diff line number Diff line change 1
1
<?xml version =" 1.0" encoding =" UTF-8" ?>
2
- <project xmlns =" http://maven.apache .org/POM/4.0.0 "
3
- xmlns : xsi =" http://www.w3 .org/2001/XMLSchema-instance "
2
+ <project xmlns : xsi =" http://www.w3 .org/2001/XMLSchema-instance "
3
+ xmlns =" http://maven.apache .org/POM/4.0.0 "
4
4
xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
5
5
<modelVersion >4.0.0</modelVersion >
6
6
20
20
<mybatis .version>3.3.1</mybatis .version>
21
21
<mybatis .spring.version>1.2.4</mybatis .spring.version>
22
22
<mapper .version>3.3.6</mapper .version>
23
- <pagehelper .version>4.1.1 </pagehelper .version>
23
+ <pagehelper .version>5.0.0-rc2 </pagehelper .version>
24
24
</properties >
25
25
26
26
<dependencies >
Original file line number Diff line number Diff line change 24
24
25
25
package tk .mybatis .autoconfigure ;
26
26
27
- import com .github .pagehelper .PageHelper ;
27
+ import com .github .pagehelper .PageInterceptor ;
28
28
import org .apache .ibatis .plugin .Interceptor ;
29
29
import org .apache .ibatis .session .SqlSessionFactory ;
30
30
import org .mybatis .spring .SqlSessionFactoryBean ;
@@ -67,16 +67,16 @@ public SqlSessionFactory sqlSessionFactoryBean() {
67
67
bean .setTypeAliasesPackage ("tk.mybatis.springboot.model" );
68
68
69
69
//分页插件
70
- PageHelper pageHelper = new PageHelper ();
70
+ PageInterceptor interceptor = new PageInterceptor ();
71
71
Properties properties = new Properties ();
72
72
properties .setProperty ("reasonable" , "true" );
73
73
properties .setProperty ("supportMethodsArguments" , "true" );
74
74
properties .setProperty ("returnPageInfo" , "check" );
75
75
properties .setProperty ("params" , "count=countSql" );
76
- pageHelper .setProperties (properties );
76
+ interceptor .setProperties (properties );
77
77
78
78
//添加插件
79
- bean .setPlugins (new Interceptor []{pageHelper });
79
+ bean .setPlugins (new Interceptor []{interceptor });
80
80
81
81
//添加XML目录
82
82
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver ();
Original file line number Diff line number Diff line change 28
28
import org .springframework .beans .factory .annotation .Autowired ;
29
29
import org .springframework .stereotype .Service ;
30
30
import tk .mybatis .springboot .mapper .CityMapper ;
31
- import tk .mybatis .springboot .mapper .CountryMapper ;
32
31
import tk .mybatis .springboot .model .City ;
33
- import tk .mybatis .springboot .model .Country ;
34
32
35
33
import java .util .List ;
36
34
@@ -46,7 +44,7 @@ public class CityService {
46
44
47
45
public List <City > getAll (City city ) {
48
46
if (city .getPage () != null && city .getRows () != null ) {
49
- PageHelper .startPage (city .getPage (), city .getRows (), "id" );
47
+ PageHelper .startPage (city .getPage (), city .getRows ());
50
48
}
51
49
return cityMapper .selectAll ();
52
50
}
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public class CountryService {
44
44
45
45
public List <Country > getAll (Country country ) {
46
46
if (country .getPage () != null && country .getRows () != null ) {
47
- PageHelper .startPage (country .getPage (), country .getRows (), "id" );
47
+ PageHelper .startPage (country .getPage (), country .getRows ());
48
48
}
49
49
return countryMapper .selectAll ();
50
50
}
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ public class UserInfoService {
44
44
45
45
public List <UserInfo > getAll (UserInfo UserInfo ) {
46
46
if (UserInfo .getPage () != null && UserInfo .getRows () != null ) {
47
- PageHelper .startPage (UserInfo .getPage (), UserInfo .getRows (), "id" );
47
+ PageHelper .startPage (UserInfo .getPage (), UserInfo .getRows ());
48
48
}
49
49
return userInfoMapper .selectAll ();
50
50
}
You can’t perform that action at this time.
0 commit comments