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
     
    每天多努力一点,你将会变得更好。
  • 相关阅读:
    Net学习日记_SQL_1
    Net学习日记_基础提高_11_俄罗斯方块_代码篇
    Net学习日记_基础提高_11_俄罗斯方块_整理概括篇
    Net学习日记_基础提高_10
    C#抽象类和接口
    RSS大全
    如何使用deparam.js抓参数
    h5页面解决软键盘与100%X100%的页面的冲突
    29、数据库三大范式精要总结
    28、数据库三大范式精讲
  • 原文地址:https://www.cnblogs.com/lidar/p/14330800.html
Copyright © 2011-2022 走看看