sqlserver分页模糊查询sql语句
<select id = "queryUserCount" resultType="int" >
select count(*) from sys_user
<where>
<if test = "userName!= null"> userName like '%' + #{userName}+ '%' </if>
</where>
</select>
<select id = "queryUserList" resultType="sys_user">
select top ${pagesize}*
from sys_user
<where>
<if test = "userName!=null">userName like '%' + #{userName}+ '%'
and id not in
(select top ${startIndex} id from t_user order by id)
order by id
</if>
</where>
<where>
<if test = "userName==null">
id not in
(select top ${startIndex} id from t_user order by id)
order by id
</if>
</where>
</select>