1. 程式人生 > >mybatis引入分頁插件

mybatis引入分頁插件

alias ati esp arr org page span 引入 mysq

1、pom引入jar

<dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper</artifactId>
            <version>4.1.6</version>
        </dependency>

2、jdbc中配置

<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean
"> <property name="configLocation" value="classpath:spring/mybatis-config.xml"/> <property name="dataSource" ref="dataSource" /> <property name="typeAliasesPackage" value="com.ybd.demo.model" /> <property name="mapperLocations" value="classpath*:com/xx/demo/mapper/*.xml
" /> <property name="plugins"> <array> <bean class="com.github.pagehelper.PageHelper"> <property name="properties"> <value> dialect=mysql
</value> </property> </bean> </array> </property> </bean>

mybatis引入分頁插件