java oracle的2种分页方法

一物理分页:

    <!-- 分页查询所有的博客信息 -->
<select id="findBlogs" resultType="java.util.HashMap" parameterType="Params">
SELECT * FROM(
SELECT ROWNUM WN,RN.* FROM (
SELECT
id,
title,
create_time as createTime,
musictor,
musictitle
FROM
krry_blog
ORDER BY create_time desc
)RN
)WN
WHERE WN <= #{pageSize} AND WN > #{pageNo}
</select>

  

二逻辑分页,利用pagehelper插件

<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>4.0.0</version>
</dependency>

  

https://blog.csdn.net//u013142781/article/details/50410243

三逻辑分页,利用mybatis-paginator

<dependency>
<groupId>com.github.miemiedev</groupId>
<artifactId>mybatis-paginator</artifactId>
<version>1.2.10</version>
</dependency>

  

xml

<select id="queryListBlur" flushCache="true" resultType="WxReplyPO">
select
reply_id,
reply_classify,
reply_type,
reply_keyword,
reply_text,
reply_image,
is_enable,
is_delete,
match_mode,
create_time,
update_time
from ta_wx_reply_c
WHERE 1=1
<if test="isEnable != null">
AND is_enable = #{isEnable}
</if>
<if test="isDelete != null">
AND is_delete = #{isDelete}
</if>
<if test="replyClassify != null and replyClassify.trim() != ''">
AND reply_classify = #{replyClassify}
</if>
<if test="replyType != null and replyType.trim() != ''">
AND reply_type = #{replyType}
</if>
<if test="replyKeyword != null and replyKeyword.trim() != ''">
AND reply_keyword LIKE concat(#{replyKeyword},'%')
</if>
<if test="matchMode != null and matchMode.trim() != ''">
AND match_mode = #{matchMode}
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by reply_id desc
</otherwise>
</choose>
<!--<if test="offset != null and limit != null">-->
<!--limit #{offset}, #{limit}-->
<!--</if>-->
</select>

  

IWxReplyService

 List<WxReplyPO> queryListBlur(Map<String, Object> map, PageBounds pageBounds);

  

IWxReplyServiceImpl

@Override
public List<WxReplyPO> queryListBlur(Map<String, Object> map, PageBounds pageBounds) {
return taWxReplyCDao.queryListBlur(map, pageBounds);
}

  

controller

wxReplyService.queryListBlur(attentionPO,
new PageBounds(
Integer.valueOf(request.getPageNo()), //页码
Integer.valueOf(request.getPageSize()), //条数
Order.formString("attention_dept_date.desc")) //排序
);

  

https://blog.csdn.net/szwangdf/article/details/27859847/

最新文章

  1. YII 的源码分析(-)
  2. Subsonic简单的语法整理
  3. linux学习中遇到的各种故障与解决方法
  4. 重装Ubuntu系统并配置开发环境
  5. js的体会
  6. NYOJ--21--bfs--三个水杯
  7. python进行md5加密
  8. Intellij Idea15 快捷键设置大全
  9. Python Day 8
  10. swagger2的接口文档
  11. 超越LLMNR /NBNS欺骗 - 利用Active Directory集成的DNS
  12. ASP.NET MVC 3 Performance – on par with MVC 2
  13. java网络编程之Socket编程
  14. geek网工作室主页------我的第一个小项目
  15. [Java多线程]-ThreadLocal源码及原理的深入分析
  16. WCF学习记录(一)
  17. JSP、Java和Servlet获取当前工程的路径
  18. 基于C#的UDP协议的异步实现
  19. nfs 文件共享 服务
  20. python匿名函数 与 内置函数

热门文章

  1. 超简单的react和typescript和引入scss项目搭建流程
  2. python 之 Django框架(模板系统、过滤器、simple_tag、inclusion_tag、Tags、母版、组件)
  3. maven打包spring boot项目及跳过test文件
  4. go 学习笔记(4) import
  5. Mycat分布式数据库架构解决方案--Server.xml详解
  6. 禁止迅雷极速版被强制升级为迅雷x
  7. springboot超级详细的日志配置(基于logback)
  8. MySQL5.7.16安装及配置
  9. Oracle 创建数据表
  10. 关于vue-svg-icon的使用方式