oracle分页条件查询语句

<select id="queryJgPageList" resultType="com.zjpcpy.myproj.bean.PbTemplate" parameterType="hashMap">
SELECT * FROM(
SELECT row_.*, rownum rownum_
from
(
select t.*,up.user_name as updaterName,ap.user_name as approverName from B_PB_JGTEMP t
left join t_user up on up.user_id=t.updater
left join t_user ap on ap.user_id=t.approver
where 1=1
<if test="temp_name != null and temp_name != ''">
and temp_name like '%' || #{temp_name,jdbcType=VARCHAR} || '%'
</if>
order by to_number(t.sort )
)row_
<if test="lastrownum != null and lastrownum != ''" >
<![CDATA[ WHERE rownum <= #{lastrownum} ]]>
</if>
)
<if test="firstrownum != null and firstrownum != ''" >
<![CDATA[ WHERE rownum_ > #{firstrownum} ]]>
</if>
</select>

 

<select id="queryJgPageTotal" resultType="Integer" parameterType="hashMap">
SELECT COUNT(0) from (
select t.* from B_PB_JGTEMP t
where 1=1
<if test="temp_name != null and temp_name != ''">
and temp_name like '%' || #{temp_name,jdbcType=VARCHAR} || '%'
</if>

)

posted @ 2018-01-22 10:01  为伊喝得老陈醋  阅读(205)  评论(0编辑  收藏  举报