废话不说,直接上代码:
<if test="type != null and type != ''">
AND a.`type` IN
<foreach item="typeArray" collection="type.split(',')" open="(" separator="," close=")">
#{typeArray}
</foreach>
</if>
注:这种方法是把传入的字符串用逗号分割成数组,然后进行条件查询,非常方便
废话不说,直接上代码:
<if test="type != null and type != ''">
AND a.`type` IN
<foreach item="typeArray" collection="type.split(',')" open="(" separator="," close=")">
#{typeArray}
</foreach>
</if>
注:这种方法是把传入的字符串用逗号分割成数组,然后进行条件查询,非常方便