关于xml文件中写sql遍历List集合实例
先看Mapper层代码
传入map,map里面有个list集合
<select id="list" parameterType="map" resultType="map">
select * from 表
<where>
<if test="map.organIdList != null and map.organIdList != ''">
and c.organ_id IN
<foreach collection="map.organIdList" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>
</if>
</where>
</select>