zoukankan      html  css  js  c++  java
  • Oracle 的分页查询,myBatis 配置文件

    前端送的参数:

    start - 开始记录数,rowStart ,从 0 开始

    limit - 每页记录数,pageSize

     1     <!-- Oracle 11g -->
     2     
     3     <select id="selectList" parameterType="category.Bean"
     4         resultType="category.Bean">
     5         
     6         <![CDATA[  
     7         
     8         SELECT * FROM 
     9         (
    10             SELECT A.*, ROWNUM rowNumber 
    11             FROM (
    12                 SELECT 
    13                     "id",
    14                     "groupCode",
    15                     "parentId",
    16                     "number",
    17                     "name",
    18                     "description",
    19                     "value",
    20                     "status",
    21                     "insertedDatetime",
    22                     "insertUserId",
    23                     "checkedDatetime",
    24                     "checkerId",
    25                     "comment"
    26                 FROM "t_category"
    27                 where 1=1                
    28                     ]]>
    29                 
    30                     <if test="id!=null and id != '' and id != '0'"> and "id" = #{id}</if>
    31                     <if test="groupCode!=null and groupCode != ''"> and "groupCode" = #{groupCode}</if>
    32                     <if test="parentId!=null and parentId != ''"> and "parentId" = #{parentId}</if>
    33                     <if test="number!=null and number != ''"> and "number like '%${number}%'</if>
    34                     <if test="name!=null and name != ''"> and "name" like '%${name}%'</if>
    35                     <if test="description!=null and description != ''"> and "description" = #{description}</if>
    36                     <if test="value!=null and value != ''"> and "value" = #{value}</if>
    37                     <if test="status!=null and status != ''"> and "status" = #{status}</if>
    38                     <if test="insertedDatetime!=null and insertedDatetime != ''"> and "insertedDatetime" = #{insertedDatetime}</if>
    39                     <if test="insertUserId!=null and insertUserId != ''"> and "insertUserId" = #{insertUserId}</if>
    40                     <if test="checkedDatetime!=null and checkedDatetime != ''"> and "checkedDatetime" = #{checkedDatetime}</if>
    41                     <if test="checkerId!=null and checkerId != ''"> and "checkerId" = #{checkerId}</if>
    42                     <if test="comment!=null and comment != ''"> and "comment" = #{comment}</if>
    43                     
    44                     <![CDATA[ 
    45                     
    46                 ) A   
    47             WHERE ROWNUM <= ( #{start} + #{limit} )
    48         )
    49         WHERE rowNumber > #{start}
    50         
    51         ]]>
    52         
    53     </select>
  • 相关阅读:
    C#发送邮件的实现实例解析
    抄录一下别人的经验
    centos学习一
    关于百度地图API批量转换成坐标的方法
    js和PHP等脚本语言for循环和if语句里面定义变量的作用域
    关于js中去取数组中的重复字符串
    关于handler返回的数据处理
    通过定义任务委托的方法处理 action
    关于点击按钮图片左右切换的随笔
    关于网站内容分享到新浪微博等的代码
  • 原文地址:https://www.cnblogs.com/livon/p/3293214.html
Copyright © 2011-2022 走看看