Mybatis foreach標籤
事例記錄一,傳參map, 用到key和value 記錄如下:
<foreach collection="param.entrySet()" separator=";" item="val">
update m set a=1,b=#{val.key}
<where>
<if test="val.value != null and val.value.size() >0">
and id in
<foreach collection="val.value" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</where>
</foreach>