support Mysql、MSSQL、Oracle、MSSQL2005、Postgre SQL、DB2.
in the Mybatis config, add the plugin.
<plugins>
<plugin interceptor="org.mybatis.pagination.PaginationInterceptor">
<property name="dbms" value="mysql"/>
<property name="sqlRegex" value=".*findAll.*"/>
</plugin>
</plugins>
dbms
,database type. MYSQL\MSSQL\ORACLE\MSSQL2005\DB2sqlRegex
the mapper method/ sql mapper xml's id, regex string.- example
.*findAll.*
containfindAll
query sql
- example
<select id="findAllDict"
resultType="org.noo.module.Dict">
SELECT
ID,CREATORTIME,DATASOURCE,DATATYPE,DICTNAME,DICTNUMBER,ENABLE,RENEWTIME,SORT
from CD_DICT ORDER BY SORT
</select>
-
add repositories into you project
pom.xml
<repositories> <repository> <id>yfyang-mvn-repo</id> <url>https://raw.github.com/yfyang/mybatis-pagination/mvn-repo/</url> <snapshots> <enabled>true</enabled> <updatePolicy>always</updatePolicy> </snapshots> </repository> </repositories>
-
add propertie into
pom.xml
:properties<properties> <org.mybatis.pagination.version>0.0.3</org.mybatis.pagination.version> </properties>
-
add dependency into
pom.xml
<dependency> <groupId>org.mybatis</groupId> <artifactId>mybatis-pagination</artifactId> <version>${org.mybatis.pagination.version}</version> </dependency>