ibatis mybatis传入List参数

Posted jamsbwo

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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> 

 

以上是关于ibatis mybatis传入List参数的主要内容,如果未能解决你的问题,请参考以下文章

Mybatis 传入List类型参数,报错:There is no getter for property named '__frch_item_0' in

dtree这么从ibatis中取List集合

Mybatis-- 传入多个参数(方法有多个参数)

MyBatis传入多个参数 ,List集合

ibatis取数据,有执行,但拿不到结果,怎么办

Spring JdbcTemplate 查询绑定list参数