File tree Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Expand file tree Collapse file tree 3 files changed +35
-3
lines changed Original file line number Diff line number Diff line change 10
10
11
11
项目使用的mysql数据库,根据需要可以切换为其他数据库
12
12
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
+
13
45
##Spring Boot集成MyBatis的基础项目
14
46
15
47
###https://github.com/abel533/MyBatis-Spring-Boot
Original file line number Diff line number Diff line change 24
24
<!-- 依赖版本 -->
25
25
<mybatis .version>3.3.1</mybatis .version>
26
26
<mapper .version>3.3.6</mapper .version>
27
- <pagehelper .version>4.2.1 </pagehelper .version>
27
+ <pagehelper .version>5.0.0 </pagehelper .version>
28
28
<mysql .version>5.1.29</mysql .version>
29
29
<spring .version>4.1.2.RELEASE</spring .version>
30
30
<mybatis .spring.version>1.2.4</mybatis .spring.version>
Original file line number Diff line number Diff line change 73
73
<property name =" typeAliasesPackage" value =" com.isea533.mybatis.model" />
74
74
<property name =" plugins" >
75
75
<array >
76
- <bean class =" com.github.pagehelper.PageHelper " >
76
+ <bean class =" com.github.pagehelper.PageInterceptor " >
77
77
<!-- 这里的几个配置主要演示如何使用,如果不理解,一定要去掉下面的配置 -->
78
78
<property name =" properties" >
79
79
<value >
80
- dialect =mysql
80
+ helperDialect =mysql
81
81
reasonable=true
82
82
supportMethodsArguments=true
83
83
params=count=countSql
You can’t perform that action at this time.
0 commit comments