MyBatis-Oracle分页
Posted JAVA之家TY
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MyBatis-Oracle分页相关的知识,希望对你有一定的参考价值。
<select id="selectListPage" resultType="User">
SELECT id,name,password FROM(
SELECT id,name,password,ROWNUM rn FROM t_user
<where>
<if test="id!=null and id!=‘‘">AND id=#{id}
</if>
<if test="
name!=null and name!=‘‘">
AND name like #{name}
</if>
<if test="password!=null and password!=‘‘">
AND password like #{password}
</if>
</where>
<if test="columnName!=null and columnName!=‘‘">
ORDER BY ${columnName} ${sortType}
</if>
) WHERE rn>(#{page}-1)*#{pageSize} AND rn<=#{page}*#{pageSize}
</select>
<select id="selectListPage" resultMap="rm">
SELECT id,name,password,role FROM(
SELECT id,name,password,role,ROWNUM rn FROM t_user
<where>
<if test="id!=null and id!=‘‘">AND id=#{id}
</if>
<if test="
name!=null and name!=‘‘">
AND name like #{name}
</if>
<if test="password!=null and password!=‘‘">
AND password like #{password}
</if>
</where>
<if test="columnName!=null and columnName!=‘‘">
ORDER BY ${columnName} ${sortType}
</if>
)
<![CDATA[
WHERE rn>(#{page}-1)*#{pageSize} AND rn<=#{page}*#{pageSize}
]]>
</select>
以上是关于MyBatis-Oracle分页的主要内容,如果未能解决你的问题,请参考以下文章
modx - 当我在同上片段中使用“&documents =”参数时,分页不起作用
FragmentStatePagerAdapter 视图分页器片段在活动重新创建后不显示