核心jar 和 配置信息网盘地址:

https://pan.baidu.com/s/1tNhTNMPZWCVNLgyeAjeiew

 

1.引入jar,主要就俩个jar

spring + mybatis + eclipse + pagehelper

2.修改配置文件applicationContext-mybatis.xml:

    <!-- define the SqlSessionFactory, notice that configLocation is not needed when you use MapperFactoryBean -->  
        <bean id="sqlSessionFactoryBean" class="org.mybatis.spring.SqlSessionFactoryBean">  
            <property name="dataSource" ref="dataSource" />  
       
            <property name="configLocation" value="classpath:mybatis-config.xml" />  
             <property name="plugins">
    <array>
      <bean class="com.github.pagehelper.PageInterceptor">
        <property name="properties">
          <!-- config params as the following -->
          <value>
            param1=value1
          </value>
        </property>
      </bean>
    </array>
  </property>

 </bean> 

3.测试:

默认已经写好了mapper,service ,所以在controller中直接调用

spring + mybatis + eclipse + pagehelper

测试结果:原mapper中sql语句自动添加了limit ? ,代表托管分页成功!!

spring + mybatis + eclipse + pagehelper

分类:

技术点:

相关文章: