mybatis插件

Mybatis的分页插件PageHelper4.1.6的使用

那年仲夏 提交于 2019-12-10 17:41:10
1、引入jar包 这里以maven为例(如果下载jar,还需要下载pageHelper的依赖com.github.jsqlparser): <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.6</version> </dependency> 2、添加配置 在mybatis的全局配置文件里<configuration>标签下添加下面的配置 <!-- plugins在配置文件中的位置必须符合要求,否则会报错,顺序如下: properties?, settings?, typeAliases?, typeHandlers?, objectFactory?,objectWrapperFactory?, plugins?, environments?, databaseIdProvider?, mappers? --> <plugins> <!-- com.github.pagehelper为PageHelper类所在包名 --> <plugin interceptor="com.github.pagehelper.PageHelper"> <!-- 4.0.0以后版本可以不设置该参数 --> <property name=