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 分页 ...
随机推荐
- Chapter 5 Blood Type——17
"I'll be coming around with a dropper of water to prepare your cards, so please don't start unt ...
- ReentrantLock原理学习
上文我们学习了ReentrantLock的基本用法,在最后我们留下了一个问题,ReentrantLock获取的锁是什么锁呢?本文我们就从源码的角度来一探究竟.本文涉及到的源码对应JDK版本为1.8. ...
- kubernetes进阶之七:Service
1.概述 Service也是Kubernetes里的最核心的资源对象之一,Kubernetes里的每个Service其实就是我们经常提起的微服务架构中的一个“微服务”,之前我们所说的Pod.RC等资源 ...
- 杭电ACM2014--青年歌手大奖赛_评委会打分
青年歌手大奖赛_评委会打分 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- web中的——作者也不知道这里面写的啥
1.使用超链接<a href="/Default/Index">添加</a><a href="#">返回显示信息</a ...
- Linux下Redis服务器搭建
系统环境 操作系统:CentOS 6.9 redis版本:redis-4.0.2 安装步骤 1,安装预环境 运行以下命令安装预环境. [root@redis02 redis-4.0.2]# yum - ...
- 微信小程序picker的坑
js文件: Companyarr: [{ id: '公司id1', companyname: "公司1的名字" }, { id: '公司id2', companyname: &qu ...
- mac IDE输入光标变成块状 改为竖线
mac下安装IDE后,出现“输入光标变成块状”的情况,是因为安装的时候装了ideaVim插件,改为竖线光标的方法:把ideaVim插件去掉
- python 练习 simple_server 判断路径及返回函数
函数 routers 返回一个 urlpatterns 元组,里面包含了路径名和函数名:在 函数 application 中遍历 urlpatterns 元组,路径存在则返回函数名,不存在则返回 40 ...
- 小tips:JS之for in、Object.keys()和Object.getOwnPropertyNames()的区别
for..in循环 使用for..in循环时,返回的是所有能够通过对象访问的.可枚举的属性,既包括存在于实例中的属性,也包括存在于原型中的实例.这里需要注意的是使用for-in返回的属性因各个浏览器厂 ...