分页查询

oracle中分页查询的基本语法:

  select *from (真正的查询) where rownum<=n;

 1 <select id="getDevCurActInfo" parameterType="java.util.HashMap" resultMap="curActMap">
 2         select * from 
 3             (
 4                 select A.*,rownum rn from 
 5                 (
 6                     select * from bsec_dev_act t where t.dev_id=#{devCurAct.devId,jdbcType=NUMERIC} and t.act_type=#{devCurAct.actType,jdbcType=VARCHAR} 
 7                     and t.act_time between to_timestamp(#{devCurAct.beginDate,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss')  and to_timestamp(#{devCurAct.endDate,jdbcType=VARCHAR},'yyyy-mm-dd hh24:mi:ss')
 8                     order by t.act_id desc 
 9                 ) A
10             )where rn between #{pagination.startIndex} and #{pagination.endIndex}
11     </select>

 

posted @ 2018-03-23 14:24  根须  阅读(134)  评论(0)    收藏  举报