mybatis語法slqserver數據庫分頁和多條件查詢
<!-- 多條件查詢退款記錄,帶有分頁功能-->
<select id="selectByParams" parameterType="Map" resultType="java.util.HashMap">
select top ${rows} * from TB_TKJL t left join TB_ZFJL z on t.ZFJL_ID=z.ZFJL_ID
where 1=1
and t.TKJL_ID not in (select top ${start} TKJL_ID from TB_TKJL)
<if test="frxm != null and frxm != ''">
and dbo.fnGetPY(z.FRXM) like '%'+#{frxm}+'%'
</if>
<if test="startDate != null or endDate != null">
and t.TKRQ between #{startDate} and #{endDate}
</if>
</select>
說明:dbo.fnGetPY()該函數是拼音字頭函數,根據拼音查詢,可有可無。