分页查询
Oracle+Mybits:第一条是纯sql,第二条是map
select *
from (select rownum rw, a.*
from(
select * from eb_item t
where t.brand_id = 1003
and t.show_status = 0
and t.audit_status = 1
and t.item_name like '%%'
) a
where rownum < 10) b
where b.rw > 0;
------------------------------------------------
select *
from (select rownum rw, a.*
from (
select * from eb_item t
<where>
<if test="brandId != null">
t.brand_id = #{brandId}
</if>
<if test="auditStatus != null">
and t.audit_status = #{auditStatus}
</if>
<if test="showStatus != null">
and t.show_status = #{showStatus}
</if>
<if test="itemName != null and itemName != ''">
and t.item_name like '%${itemName}%'
</if>
</where>
order by t.item_id desc
<![CDATA[
) a
where rownum < #{endNum}) b
where b.rw > #{startNum}
]]>