MyBatis多条件查询,并进行排序
<select id="findidentityByPage" resultType="com.entity.Identity">
SELECT id,Name,CardNo,department,number,member,rank,sex,nation FROM cake
<where>
<!--where标签自动去掉满足条件的第一个and -->
<if test="cardNo != null and cardNo != ''">
and cardNo LIKE CONCAT('%',#{cardNo},'%' )
</if>
<if test="ip != null and ip != ''">
and ip LIKE CONCAT('%',#{ip},'%' )
</if>
</where>
order by cardNo desc limit #{start},#{perPageUsers}
</select>