pagehelper

Java-Class-C:com.github.pagehelper.PageInfo

天涯浪子 提交于 2019-11-27 18:33:16
ylbtech-Java-Class-C:com.github.pagehelper.PageInfo 1. 返回顶部 2. 返回顶部 1.1、 import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; 1.2、 @ApiOperation(value = "查询拼团情况列表") @PostMapping("/selectGroupSituationListById") public Result selectGroupSituationListById(HttpServletRequest request, @RequestBody() Map pa) { try { String organizationId = TokenUtils.getOrganizationId(request, jwtUtil); int pno = (int) pa.get("pno"); int psize = (int) pa.get("psize"); PageHelper.startPage(pno, psize); pa.put("organizationId",organizationId); List<Map> list = grouactivityMapper

Mybatis的分页插件com.github.pagehelper

烂漫一生 提交于 2019-11-27 18:32:58
1. 需要引入PageHelper的jar包   如果没有使用maven,那直接把jar包导入到lib文件夹下即可,这个PageHelper插件在github上有开源, 地址为: https://github.com/pagehelper/Mybatis-PageHelper/tree/master/src/main/java/com/github/pagehelper 。 如果使用了maven,那么只要在pom.xml中引入该插件即可,引入如下: <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.4</version> </dependency> 2. 在mybatis的全局配置文件SqlMapConfig.xml中配置该插件 <?xmlversion="1.0" encoding="UTF-8" ?> <!DOCTYPEconfiguration PUBLIC"-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> <configuration> <!-- 配置分页插件 --> <plugins> <plugin

Java-Class-C:com.github.pagehelper.PageHelper

≯℡__Kan透↙ 提交于 2019-11-27 18:30:44
ylbtech-Java-Class-C:com.github.pagehelper.PageHelper 1. 返回顶部 2. 返回顶部 1.1、 import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; 1.2.1、List集合 /** * showdoc * * @catalog 管理平台 * @title 在学列表 * @description 在学列表 * @method post * @url ip:port/order/orderList * @return_param pno 必选 num 分页页码 * @return_param psize 必选 num 分页大小 * @return_param organizationID 必选 string 机构id * @return {"code":200,"data":{"endRow":5,"hasNextPage":false,"hasPreviousPage":false,"isFirstPage":true,"isLastPage":true,"list":[{"buyTime":"2019-02-19 17:47:09","channel":4,"comment":"test","courseID":

Spring Boot 2.0 常见问题总结(二)

时间秒杀一切 提交于 2019-11-27 17:00:00
使用 IDEA 生成 POJO 实体类 a. 使用 idea 连接上需要操作的数据库。 b. 选中要生成实体类的数据库表:右键 ---> Scripted Extensions ---> Generate POJOs.groovy。 c. 在弹出的窗口选择生成的位置即可。 application.properties 属性自动映射实体类配置 a. 在 application.properties 文件中定义的属性如下 wxpay.appid=wx5beac15ca207cdd40c wxpay.appsecret=5548012f33417fdsdsdd6f96b382fe548215e9 b.使用 @PropertySource(value = "classpath:application.properties") 即可。 @Getter @Setter @Configuration @PropertySource(value = "classpath:application.properties") public class WeChatConfig { @Value("${wxpay.appid}") private String appId; // 公众号 appid @Value("${wxpay.appsecret}") private String appsecret

springboot整合PageHelper

旧巷老猫 提交于 2019-11-27 08:08:30
最近一直在学习,刚好看到pagehelper,在网上查了些资料,觉得不错,放在自己博客上。 原文地址: https://www.cnblogs.com/zhenghengbin/p/9368518.html 我之所以会发现这个PageHelper这个东东 是因为公司在使用 ,刚开始我也没太注意这个插件,感觉不就是个分页插件吗?也就那样,直到一天,我在网上找了个代码生成器,用来构建代码,因为它是针对mysql的,我们公司使用的是pgsql,它们的分页是不同的。我下载的代码生成器的是针对mysql的。所以我又修改了它的分页语句。忽然想到了这个PageHelper、感觉这个东西还是很方便的,不用再去改sql了 引入依赖 这里我直接那我之前用来整合mybatis的项目简单演示下 <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<

pagehelper/Mybatis-PageHelper

孤街醉人 提交于 2019-11-27 07:57:14
Mybatis分页插件 - PageHelper 如果你也在用Mybatis,建议尝试该分页插件,这一定是 最方便 使用的分页插件。 分页插件支持任何复杂的单表、多表分页,部分特殊情况请看 重要提示 。 想要使用分页插件?请看 如何使用分页插件 。 物理分页 该插件目前支持以下数据库的 物理分页 : Oracle Mysql MariaDB SQLite Hsqldb PostgreSQL DB2 SqlServer(2005+) Informix 配置dialect属性时,使用小写形式: oracle,mysql,mariadb,sqlite,hsqldb,postgresql,db2,sqlserver,informix MyBatis工具网站: http://mybatis.tk 分页插件支持MyBatis3.2.0~3.3.0(包含) 分页插件最新版本为4.0.0 Maven坐标 < dependency > < groupId >com.github.pagehelper</ groupId > < artifactId >pagehelper</ artifactId > < version >4.0.0</ version > </ dependency > 下载JAR包 分页插件pagehelper.jar: https://oss.sonatype.org

springboot集成pagehelper分页插件

梦想的初衷 提交于 2019-11-26 22:48:28
之前写的项目都是在前端进行分页,最近涉及到后台分页查询,回看自己之前练习的项目里发现自己写了分页给忘了,作为初级程序员拿来记录一下 引入pagehelper的pom依赖     <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.0</version> </dependency> 书写pagehelper的配置类 /** * mybatis分页插件配置 * @author xWang * @Date 2019-07-12 */ @Configuration public class MyBatisConfig { @Bean public PageHelper pageHelper(){ PageHelper pageHelper = new PageHelper(); Properties p = new Properties(); p.setProperty("offsetAsPageNum","true"); p.setProperty("rowBoundsWithCount","true"); p.setProperty("reasonable","true"); pageHelper.setProperties(p);

spring boot 配置PageHelper

痴心易碎 提交于 2019-11-26 20:45:28
1、引用pom <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper</artifactId> <version>4.1.1</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatisplus-spring-boot-starter</artifactId> <version>1.0.1</version> </dependency> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus</artifactId> <version>2.1-gamma</version> </dependency> 2、编写配置类 package com.forezp.config; import com.github.pagehelper.PageHelper; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import

Java Web -【分页功能】详解

佐手、 提交于 2019-11-26 18:45:14
分页简介 分页功能在网页中是非常常见的一个功能, 其作用也就是将数据分割成多个页面来进行显示。 使用场景: 当取到的数据量达到一定的时候,就需要使用分页来进行数据分割。 当我们不使用分页功能的时候,会面临许多的问题: 客户端的问题: 如果数据量太多,都显示在同一个页面的话,会因为页面太长 严重影响到用户的体验,也不便于操作 ,也会出现 加载太慢 的问题。 服务端的问题: 如果数据量太多,可能会造成 内存溢出 ,而且一次请求携带的数据太多, 对服务器的性能也是一个考验。 分页的分类 分页的实现分为真分页和假分页两种,也就是物理分页和逻辑分页。 1.真分页(物理分页): 实现原理: SELECT * FROM xxx [WHERE...] LIMIT #{param1}, #{param2} 第一个参数是开始数据的索引位置 第二个参数是要查询多少条数据 优点: 不会造成内存溢出 缺点: 翻页的速度比较慢 2.假分页(逻辑分页): 实现原理: 一次性将所有的数据查询出来放在内存之中 ,每次需要查询的时候就直接从内存之中去取出相应索引区间的数据 优点: 分页的速度比较快 缺点: 可能造成内存溢出 传统的分页方式 对于假分页的实现方式很简单,只需要准备一个集合保存从数据库中取出的所有数据,然后根据当前页面的码数,取出对应范围的数据显示就好了, 我们这里基于物理分页来实现。 分页的原理

com.github.pagehelper.PageHelper cannot be cast to org.apache.ibatis.plugin.Interceptor

为君一笑 提交于 2019-11-25 23:44:17
在MyBatis的配置文件中修改对pageHelper的配置 修改前 <plugins> <plugin interceptor="com.github.pagehelper.PageHelper"> <!-- 配置数据库的方言 --> <!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库--> <property name="dialect" value="mysql"/> </plugin> </plugins> 修改后 <plugins> <plugin interceptor="com.github.pagehelper.PageInterceptor"> <!-- 配置数据库的方言 --> <!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL六种数据库--> <!-- <property name="dialect" value="mysql"/> --> </plugin> </plugins> 来源: https://www.cnblogs.com/wanerhu/p/11931439.html