需求:mybatis中传入一个List集合作为查询条件的参数:
参数:map.put(“deptids”,new String["111","22"]);
期望:
where dept_id in ( ?, ? )
实现:
<if test='deptIds!=null and deptIds.size>0'> <!--关联部门 --> AND wa.dept_id in <foreach collection="deptIds" index="index" item="item" open="(" separator="," close=")"> #{item} </foreach> </if>
参考博客:http://blog.csdn.net/qq_24084925/article/details/53790287