mybatis中sqlserver數據庫分頁和多條件查詢

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()該函數是拼音字頭函數,根據拼音查詢,可有可無。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章