orcal分页查询带条件排序

<select id="queryInjuredCase" resultMap="BaseResultMap">
SELECT aa.* FROM (SELECT a.*,rownum rn FROM
(SELECT *
FROM INJURED_CASE
where 1 = 1 AND status = 1
<if test="qicp != null">
<if test="qicp.vinNum != null and qicp.vinNum != ''">
and VIN like '%${qicp.vinNum}%'
</if>
<if test="qicp.plateNum != null and qicp.plateNum != ''">
and PLATE_NUM like '%${qicp.plateNum}%'
</if>
</if>
order by create_date desc)a)aa
WHERE aa.rn &lt;= #{endRow} and aa.rn > #{startRow}
</select>

猜你喜欢

转载自www.cnblogs.com/lazyli/p/12160733.html