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()该函数是拼音字头函数,根据拼音查询,可有可无。