声明一个value为map的map,然后在foreach的时候
collection="key"
controller层:
String district="章贡区";
String [] ids={"1","2","3"};
map.put("district",district);
map.put("idArr",ids);
xml:注意ids一定要和map中的key一致
<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="idArr" collection="idArr" open="(" separator="," close=")"> #{idArr} </foreach> <if test="offset != null and limit != null"> limit #{offset}, #{limit} </if> </select>