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
     
    每天多努力一点,你将会变得更好。
  • 相关阅读:
    OPENGL_三角形带GL_TRIANGLE_STRIP详解
    OPENGL_单位长度对应屏幕像素
    OPENGL2_基本框架
    WINDOWS编程基础-最简单的windows程序
    着色语言(Shader Language)
    Ogre 学习记录
    Ogre RT Shader System
    Perception Neuron系统,让动作捕捉技术不再高冷
    Ogre 中基于蒙皮骨骼的OBB碰撞检测
    Ogre 绘制基本图形
  • 原文地址:https://www.cnblogs.com/lidar/p/14330800.html
Copyright © 2011-2022 走看看