zoukankan      html  css  js  c++  java
  • java oracle的2种分页方法

    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/

  • 相关阅读:
    Leetcode86.分隔链表
    Leetcode39.组合总和
    Leetcode31.下一个排列
    剑指Offer35.复杂链表复制
    剑指Offer14-I.剪绳子
    剑指Offer38.字符串的排序
    Leetcode29.两数相除
    232. Implement Queue using Stacks
    程序员跳槽指南
    226. Invert Binary Tree
  • 原文地址:https://www.cnblogs.com/achengmu/p/11174524.html
Copyright © 2011-2022 走看看