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>

 

转载于:https://www.cnblogs.com/livon/p/3293214.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值