一、加依赖:

   <dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>

二、加配置:

  <plugins>
<!-- 分页查询插件 -->
<plugin interceptor="com.baomidou.mybatisplus.plugins.PaginationInterceptor">
<property name="dialectType" value="mysql" />
</plugin>
</plugins>

三、controller使用:

     @PostMapping("orderlist.api")
@ApiOperation(value = "分页查询", produces = MediaType.APPLICATION_JSON_VALUE)
public Object memberOrderlist(@RequestBody DriverDto dto, HttpServletRequest request, HttpServletResponse response) {
Page<BizOrderlist> page = new Page<BizOrderlist>(dto.getPage() == null ? : dto.getPage() , dto.getPageSize() == null ? : dto.getPageSize()); //初始化分页条数,如果传入的值为空在默认第一页,15条。
Parameter orderparameter = new Parameter(getService(), "getOrderlist").setParam(page,params); //在servie中获取list,传递分页Page和查询参数
Page<BizOrderlist> orderList = (Page<BizOrderlist>) provider.execute(orderparameter).getResult();

四、service中使用:

  public Page<BizOrderlist> getOrderlist(Page<BizOrderlist> page,Map<String, Object> params) {

         List<BizOrderlist> orderlist = (List<BizOrderlist>) ((OrderListMapper) mapper).getOrderList(page,param1,params2,params3);
page = page.setRecords(orderlist); //查出的list调用setRecords
return page;

五、Mapper:

   public interface OrderListMapper extends BaseMapper<BizOrderlist> {

     List<BizOrderlist> getOrderList(Pagination  page,@Param("param1") Double param1...........);

Mybatisplus分页插件的使用的更多相关文章

  1. mybatis-plus分页插件

    package com.tanhua.server.config; import com.baomidou.mybatisplus.extension.plugins.PaginationInterc ...

  2. MyBatisPlus分页插件在SpringBoot中的使用

    文章目录 1.目录结构 2.新增配置 3.编写测试类 4.测试结果 5.数据库中的表 文件的创建: https://blog.csdn.net/weixin_43304253/article/deta ...

  3. Mybatis-plus的两种分页插件的配置方式

    第一种: package com.paic.ocss.gateway.admin.config; import com.baomidou.mybatisplus.plugins.PaginationI ...

  4. Mybatis-Plus的分页插件

    使用的是:Mybatis-Plus的分页插件https://baomidou.gitee.io/mybatis-plus-doc/#/?id=%E7%AE%80%E4%BB%8B 1.Mapper.j ...

  5. PageHelper分页插件及通用分页js

     分页概述 1.物理分页 物理分页依赖的是某一物理实体,这个物理实体就是数据库,比如MySQL数据库提供了limit关键字,程序员只需要编写带有limit关键字的SQL语句,数据库返回的就是分页结果. ...

  6. spring boot项目自定义数据源,mybatisplus分页、逻辑删除无效解决方法

    Spring Boot项目中数据源的配置可以通过两种方式实现: 1.application.yml或者application.properties配置 2.注入DataSource及SqlSessio ...

  7. spring boot 整合mybatis 的xml版本【包括逆向工程以及分页插件】

    逆向工程很方便,可以直接根据数据库和配置文件生成pojo,mapper接口和相应的映射文件. xml版本和全注解版本其实差不多,大部分情况下,都会保留xml文件方便其他人去扩展新的dml方法. 文章旨 ...

  8. SpringBoot整合MybatisPlus3.X之分页插件(四)

    注:详细请看2.X博客中,3.X直接上代码. 建议装一个MybatisX插件,可以在Mapper和Xml来回切换 pom.xml <dependencies> <dependency ...

  9. SpringBoot2 配置多数据源,整合MybatisPlus增强插件

    本文源码:GitHub·点这里 || GitEE·点这里 一.项目案例简介 1.多数据简介 实际的项目中,经常会用到不同的数据库以满足项目的实际需求.随着业务的并发量的不断增加,一个项目使用多个数据库 ...

随机推荐

  1. C# Redis辅助类封装与简单聊天室的实现思路说明

    虽然redis api的功能比较齐全,但个人觉得为了更好的方便学习和使用,还是很有必有做一个类似DBHelper的帮助类 辅助类主要功能(代码会在最后放出来) 1. 事件监听: 重新配置广播时(主从同 ...

  2. Android 开发权限设置中英对照说明详解

    android.permission.ACCESS_CHECKIN_PROPERTIES 允许读写访问 "properties"表在checkin数据库中,改值可以修改上传( Al ...

  3. centos6和7的防火墙开关

    CentOS6.5查看防火墙的状态: 1 [linuxidc@localhost ~]$service iptable status 显示结果: 1 2 3 4 5 [linuxidc@localho ...

  4. easyui引入

    <% String path = request.getContextPath()+"/"; out.println("<link href='"+ ...

  5. 【总结】 伸展树Splay

    挖坑待补 前言 感觉我在联赛还差4天的时候学习Splay有点慌,但还是要学一下. 定义 我们先对Splay的数组进行一些定义: struct node{ int ff,siz,cnt,ch[2],va ...

  6. 874. Walking Robot Simulation

    A robot on an infinite grid starts at point (0, 0) and faces north.  The robot can receive one of th ...

  7. 【OCP-12c】CUUG最新考试原题整理及答案(071-9)

    9.(5-5) choose the best answerView the Exhibit and examine the structure of the SALES and STORES tab ...

  8. “全栈2019”Java第二十八章:数组详解(上篇)

    难度 初级 学习时间 10分钟 适合人群 零基础 开发语言 Java 开发环境 JDK v11 IntelliJ IDEA v2018.3 文章原文链接 "全栈2019"Java第 ...

  9. iOS开发之静态库.a 以及合并

    静态库和动态库 静态库和动态库的存在形式静态库: .a 和 .framework 动态库: .dylib 和 .framework 静态库和动态库在使用上的区别静态库:链接时,静态库会被完整地复制到可 ...

  10. sizeWithFont:的替代方法

    sizeWithFont:的替代方法 -(CGFloat)changeStationWidth:(NSString *)string{ UIFont * textFont = [UIFont syst ...