转:http://www.cnblogs.com/xusir/archive/2013/07/24/3210286.html

当查询的参数只有一个时 

 a 如果参数的类型是List, 则在使用时,collection属性要必须指定为 list

findByIds(List<Long> ids)

 

<select >
         Select
         <include ref>
         from jria where ID in
                  <foreach item="item" index="index" collection="list" 
                         open="(" separator="," close=")">
                        #{item}
                </foreach>
  </select>

b 如果参数的类型是Array,则在使用时,collection属性要必须指定为 array

findByIds(Long[] ids)
<select >
                 select
                 <include ref>
          from jria where ID in
                  <foreach item="item" index="index" collection="array" 
                         open="(" separator="," close=")">
                        #{item}
                </foreach>
  </select>

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-06
猜你喜欢
  • 2021-10-31
  • 2021-05-20
  • 2021-12-13
  • 2022-12-23
  • 2021-10-02
  • 2021-08-06
相关资源
相似解决方案