首页 > 技术文章 > oracle的分页查询,mabatis的sql配置

YuyuanNo1 2017-12-06 14:37 原文

<select id="getCardcaseByPage" resultType="Cardcase" >
select * from (
select a.*,rownum rn from (
select * from TAB_SYS_CARDCASE
where oper_id = #{operId}
and status = 1
<if test="serchKey != null and serchKey != '' and serchKey != 'null' ">
and (phone like '%' || #{serchKey} || '%' or user_name like '%' || #{serchKey} || '%' )
</if>
order by id desc
<![CDATA[
) a where rownum <= #{end}
) where rn >= #{start}
]]>
</select>

推荐阅读