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 分页 ...
随机推荐
- VR开发相关资源
1. VRTK(StreamVR TOOLKIT):https://github.com/thestonefox/VRTK 2. StrangeIoc 专为c#和Unity写的框架 3. Frame ...
- windows git 上传
1.打开git.bash 2. 告诉要传的git的用户名字 和邮箱地址 git config --global user.name "CardLove" git config -- ...
- 基于 Zookeeper 的分布式锁实现
1. 背景 最近在学习 Zookeeper,在刚开始接触 Zookeeper 的时候,完全不知道 Zookeeper 有什么用.且很多资料都是将 Zookeeper 描述成一个“类 Unix/Linu ...
- 微服务架构:Eureka参数配置项详解
版权声明:本文为博主原创文章,转载请注明出处,欢迎交流学习! Eureka涉及到的参数配置项数量众多,它的很多功能都是通过参数配置来实现的,了解这些参数的含义有助于我们更好的应用Eureka的各种功能 ...
- 免费报名 | 腾讯云自研数据库CynosDB交流会
本文由云+社区发表 作者:技术沙龙 All in 云+时代,数据库的高可用性.按需付费.按需扩展等属性解放了大批开发者.腾讯发布的自研数据库CynosDB作为国内首款同时兼容MySQL和PG的云原生数 ...
- linux centos6.5安装KVM
1.安装kvm,vnc软件 http://www.server110.com/kvm/201404/10467.html yum install kvm,缺啥补啥 yum install kvm km ...
- javascript sort 函数用法
sort 函数 博客地址:https://ainyi.com/41 简单的说,sort() 在没有参数时,返回的结果是按升序来排列的.即字符串的Unicode码位点(code point)排序 [5, ...
- C#如何发送邮件
准备工作: 1.开启Smtp服务 2.如果邮件设置中有“客户端授权码"(以163邮箱为例,有的邮箱不需要),需要开启“客户端授权码" 发送邮件: using (MailMessag ...
- year 和 weak year 的区别
java 中使用 SimpleDateFormat 时,会遇到 year 和 week year 这两个概念,特此记录. google 答案: A week year is in sync with ...
- Android破解学习之路(九)—— 练手破解游戏集合
1.魔塔50层 https://www.taptap.com/app/48859 选择需要购买的东西,之后在支付宝支付界面点击取消,即可支付成功 2.布布合丁丁 https://www.coolapk ...