提供一个oracle分页的格式提供参考
与mybaitis结合写动态SQL时候,需要先写条件再写分页,先写排序再写分页。
select *
from (select t.*, rownum r
from (select * from t_user t
<where>
<if test="userId != null and userId != '' ">
t.user_id = #{userId}
</if>
<if test="userId != null and userId != '' ">
and t.user_name = #{userName}
</if>
</where>
) t
where rownum <= 10)
where r > 0