声明一个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 >
        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>

 

相关文章:

  • 2021-09-23
  • 2021-04-07
  • 2021-09-26
  • 2021-12-11
  • 2022-03-03
  • 2022-12-23
  • 2021-06-08
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-05
  • 2022-12-23
  • 2021-07-02
相关资源
相似解决方案