springboot + mybatis +pageHelper分页排序
今天下午写查出来的数据的排序,原来的数据没有排序,现在把排序功能加上。。。原来用的,是xml中的sql动态传参 ,,1个小数没有弄出来,果断放弃。。。
网上百度一下,发现用pageHelper 可以实现自动排序,参考了一些 博友的文章,终于实现了排序功能。。
这里做下记录怎么排序把:
一 首先上代码
String orderBy = "cec_three.business_income desc";
if (page != 0 && rows != 0){
PageHelper.startPage(page, rows, orderBy);
}
上面首先定义按哪个字段排序,是升序还是降序。
二 注意事项:
1 pagehelper 的版本要高的
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.5</version>
</dependency>
我原来用 的是 1.2.3 结果不仅不能排序,而且 连分页也不能用了,所以注意版本,要用高版本的。
2 上面分页条件中的 红色背景的字段是 数据库中表中的字段,不是接受的实体类的字段名。
参考的各位博友的文章:
https://blog.csdn.net/liuyuanjiang109/article/details/78955881
https://blog.csdn.net/walk_man_wubiao/article/details/84949191
https://blog.csdn.net/kalnon/article/details/79559627
springboot + mybatis +pageHelper分页排序的更多相关文章
- SpringBoot+Mybatis+Pagehelper分页
1.pom.xml <!-- mybatis分页插件 --> <dependency> <groupId>com.github.pagehelper</gro ...
- springboot mybatis pagehelper 分页问题
1:添加依赖 compile group: 'com.github.pagehelper', name: 'pagehelper-spring-boot-starter', version: '1.2 ...
- SpringBoot+MyBatis+PageHelper分页无效
POM.XML中的配置如下:<!-- 分页插件 --><!-- https://mvnrepository.com/artifact/com.github.pagehelper/pa ...
- SpringBoot+Mybatis+PageHelper实现分页
SpringBoot+Mybatis+PageHelper实现分页 mybatis自己没有分页功能,我们可以通过PageHelper工具来实现分页,非常简单方便 第一步:添加依赖 <depend ...
- springboot+mybatis+pagehelper
springboot+mybatis+pagehelper整合 springboot 版本2.1.2.RELEASE mybatis 版本3.5 pagehelper 版本5.18 支持在map ...
- Springboot+Mybatis+Pagehelper+Aop动态配置Oracle、Mysql数据源
本文链接:https://blog.csdn.net/wjy511295494/article/details/78825890 Springboot+Mybatis+Pagehelper+Aop ...
- spring-boot + mybatis +pagehelper 使用分页
转自:https://segmentfault.com/a/1190000015668715?utm_medium=referral&utm_source=tuicool 最近自己搭建一个sp ...
- springboot + mybatis配置分页插件
一:使用pagehelper配置分页插件 1:首先配置springboot +mybatis框架 参考:http://www.cnblogs.com/liyafei/p/7911549.html 2 ...
- mybatis pagehelper 分页 失效
pagehelper 不分页几种情况的解决方法 - web洋仔 - CSDN博客https://blog.csdn.net/csdn___lyy/article/details/77160488 分页 ...
随机推荐
- Android--加载大分辨率图片到内存
前言 在使用ImageView显示图片的时候,直接加载一个图片资源到内存中,经常会出现内存溢出的错误,这是因为有些图片的分辨率比较高,把它直接加载到内存中之后,会导致堆内存溢出的问题.这篇博客就来讲解 ...
- 道路运输车辆卫星定位系统JT/T808服务实现和压测
在工作上的需要接触道路运输车辆卫星定位系统相关应用,由于自己对网络服务的编写比较感兴趣,所以利用空闲时间实现了JT/T808的一些协议和相关服务(不得不说这种协议的设计在解释的确导致性能上的损耗,特别 ...
- 【单例模式】java实现
概述:确保一个类只有一个实例,而且自行实例化并向整个系统提供这个实例. 关键点: 构造函数不对外开放,一般为private. 通过一个静态方法或者枚举返回单例类对象. 确保单例类的对象有且只有一个,尤 ...
- Spring系列之手写一个SpringMVC
目录 Spring系列之IOC的原理及手动实现 Spring系列之DI的原理及手动实现 Spring系列之AOP的原理及手动实现 Spring系列之手写注解与配置文件的解析 引言 在前面的几个章节中我 ...
- 使用mpvue开发小程序教程(一)
前段时间,美团开源了mpvue这个项目,使得我们又多了一种用来开发小程序的框架选项.由于mpvue框架是完全基于Vue框架的(重写了其runtime和compiler),因此在用法上面是高度和Vue一 ...
- LeetCode专题-Python实现之第26题:Remove Duplicates from Sorted Array
导航页-LeetCode专题-Python实现 相关代码已经上传到github:https://github.com/exploitht/leetcode-python 文中代码为了不动官网提供的初始 ...
- Python全栈开发之---assert断言
一.python assert的作用: 根据Python 官方文档解释(https://docs.python.org/3/reference/simple_stmts.html#assert), & ...
- java servlet的执行流程
1.先附上代码如下 Servlet1.java public class Servlet1 implements Servlet { @Override public void init(Servle ...
- 20190328-CSS样式一:字体样式font-、文本样式text-、背景图样式background-
目录 CSS参考手册:http://css.doyoe.com/ 1.字体简写:font:font-style || font-variant || font-weight || font-size ...
- form表单中多个button按钮必须声明type类型
最近在做一个后台管理系统,发现了一个小bug: 问题描述:form表单中有多个button按钮(以下图为例),如果第一个button不写type属性,那么点击第一个button按钮会触发submit事 ...