zoukankan      html  css  js  c++  java
  • SpringBoot集成分页插件PageHelper与SSM的区别

    转载地址:https://blog.csdn.net/weixin_42145761/article/details/103951029

    SpringBoot和PageHelper的集成与SSM框架的集成有一些不一样,在这里主要说一下jar包和配置。
    SSM框架与PageHelper的集成:
    1、添加jar包

    <!--分页插件 -->
    <dependency>
    	<groupId>com.github.pagehelper</groupId>
    	<artifactId>pagehelper</artifactId>
    	<version>5.1.2</version>
    </dependency>
    

    2、配置mybatis.xml文件

    <!--配置分页插件-->
    	<plugins>
    		<!-- com.github.pagehelper为PageHelper类所在包名 -->
    		<plugin interceptor="com.github.pagehelper.PageInterceptor">
    			<!-- 合理化物理分页 -->
    			<property name="reasonable" value="true"/>
    		</plugin>
    	</plugins>
    

    3、在applicationContext.xml中配置工厂

    <!--SqlSessionFactory-->
    	<bean id="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    		<!--连接池-->
    		<property name="dataSource" ref="dataSource"/>
    		<!--个性配置文件,在这里主要把mybatis.xml引入-->
    		<property name="configLocation" value="classpath:mybatis.xml"/>
    		<!--别名-->
    		<property name="typeAliasesPackage" value="com.jzh.crm2.domain"/>
    		<!--管理的mapper文件-->
    		<property name="mapperLocations" value="classpath:com/jzh/crm2/mapper/*Mapper.xml"/>
    	</bean>
    

    Spring Boot与PageHelper的集成
    1、添加jar包(这里是最主要的,比SSM多添加了两个依赖jar包)

    <!--分页插件 -->
    	<dependency>
    		<groupId>com.github.pagehelper</groupId>
    		<artifactId>pagehelper</artifactId>
    		<version>5.1.2</version>
    	</dependency>
    	<dependency>
    		<groupId>com.github.pagehelper</groupId>
    		<artifactId>pagehelper-spring-boot-autoconfigure</artifactId>
    		<version>1.2.3</version>
    	</dependency>
    	<dependency>
    		<groupId>com.github.pagehelper</groupId>
    		<artifactId>pagehelper-spring-boot-starter</artifactId>
    		<version>1.2.3</version>
    	</dependency>
    

    2、在application.peoperties中添加一些配置

    #pagehelper分页插件配置
    pagehelper.helperDialect=mysql
    pagehelper.reasonable=true
    pagehelper.supportMethodsArguments=true
    pagehelper.params=count=countSql
     
    每天多努力一点,你将会变得更好。
  • 相关阅读:
    一千亿亿亿字节
    分布式发布订阅消息系统
    Google Chrome 的内核引擎 WebKit 介绍
    找项目网站C# 下写入视频的简单实现
    学ios开发:Delegate,Action Sheet, Alert
    Web服务器
    Google Chrome Source Code 源码下载
    大数据处理的趋势五种开源技术介绍
    MDA项目思路小结
    重新发布本人所有博客文章中涉及的代码与工具(大部分是C++和Java)
  • 原文地址:https://www.cnblogs.com/lidar/p/14330800.html
Copyright © 2011-2022 走看看