ibatis mybatis传入List参数

--ibatis
<select id="getWzlb"  parameterClass="map" resultClass="java.util.HashMap">  
        select ... from wz09
        where 1=1
    <isNotEmpty prepend="AND" property="ids"> <!-- ids是map的一个key -->
        id in  
            <iterate property="ids" open="(" conjunction="," close=")">  
                #ids[]#  
            </iterate>             
    </isNotEmpty>
</select>  

--mybatis
select id, city_id, owner_id  
  from item 
 where id in  
<foreach item="item" index="index" collection="list"  open="(" separator="," close=")">  
     #{item}  
</foreach>  
select r.id, r.info_id, r.item_id,    
  from rent_content r  
 where r.id NOT IN (SELECT rent_content_id FROM rent_calendar WHERE rent_content_id = r.id AND begin_time <#{endDate}  AND end_time > #{startDate})  
   and r.car_item_id in  
  <foreach item="item" index="index" collection="list"  open="(" separator="," close=")">  
       #{item}  
  </foreach> 

 

posted @ 2016-03-27 19:43  jamsbwo  阅读(2003)  评论(0编辑  收藏  举报
©2014 to