Controller层传入map形式的参数给mybais处理时,如果其中一个参数数组,则涉及到xml文件如何读取该数组进行遍历
如:
controller层:
String district="章贡区";
String [] ids={"1","2","3"};
map.put("district",district);
map.put("ids",ids);
xml:
<select id="queryByDistrictList" resultType="io.renren.modules.mall.entity.SpuGoodsEntity">
select * from spu_goods spu,shop s
where spu.shop_id=s.id and s.town=#{district} and spu.ext1='no' and spu.goods_state=0 and spu.category_id in
<foreach item="ids" collection="ids" open="(" separator="," close=")">
#{ids}
</foreach>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>