Skip to content

Commit fd19691

Browse files
committed
升级分页插件 5.0.0
1 parent f0bc2b3 commit fd19691

File tree

3 files changed

+40
-4
lines changed

3 files changed

+40
-4
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,38 @@
1010

1111
项目使用的hsqldb内存数据库,根据需要可以切换为其他支持的数据库
1212

13+
集成分页插件 5.0.0 版本,注意配置变化:
14+
```xml
15+
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
16+
<property name="dataSource" ref="dataSource"/>
17+
<property name="mapperLocations">
18+
<array>
19+
<value>classpath:mapper/*.xml</value>
20+
</array>
21+
</property>
22+
<property name="typeAliasesPackage" value="com.isea533.mybatis.model"/>
23+
<property name="plugins">
24+
<array>
25+
<bean class="com.github.pagehelper.PageInterceptor">
26+
<!-- 这里的几个配置主要演示如何使用,如果不理解,一定要去掉下面的配置 -->
27+
<property name="properties">
28+
<value>
29+
helperDialect=mysql
30+
reasonable=true
31+
supportMethodsArguments=true
32+
params=count=countSql
33+
autoRuntimeDialect=true
34+
</value>
35+
</property>
36+
</bean>
37+
</array>
38+
</property>
39+
</bean>
40+
```
41+
- 拦截器 `com.github.pagehelper.PageInterceptor`
42+
- 原来的 `dialect` 变成了 `helperDialect`,这是基于 PageHelper 方式的分页
43+
- 具体变化看文档
44+
1345
##MyBatis工具
1446

1547
###http://www.mybatis.tk

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<targetProject>${basedir}/src/main/java</targetProject>
1515
<!-- 依赖版本 -->
1616
<mybatis.version>3.3.0</mybatis.version>
17-
<mapper.version>3.3.0</mapper.version>
18-
<pagehelper.version>4.0.3</pagehelper.version>
17+
<mapper.version>3.3.9</mapper.version>
18+
<pagehelper.version>5.0.0</pagehelper.version>
1919
<spring.version>3.2.12.RELEASE</spring.version>
2020
</properties>
2121

src/main/resources/applicationContext.xml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@
3434
<property name="typeAliasesPackage" value="com.isea533.mybatis.model"/>
3535
<property name="plugins">
3636
<array>
37-
<bean class="com.github.pagehelper.PageHelper">
37+
<bean class="com.github.pagehelper.PageInterceptor">
38+
<!-- 这里的几个配置主要演示如何使用,如果不理解,一定要去掉下面的配置 -->
3839
<property name="properties">
3940
<value>
40-
dialect=hsqldb
41+
helperDialect=mysql
4142
reasonable=true
43+
supportMethodsArguments=true
44+
params=count=countSql
45+
autoRuntimeDialect=true
4246
</value>
4347
</property>
4448
</bean>

0 commit comments

Comments
 (0)