- 当查询的参数只有一个时
findByIds(List ids)
1.1 如果参数的类型是List, 则在使用时,collection属性要必须指定为 list(要是Repository 层指定参数必须与参数一致)
Xml代码 收藏代码
<select id="findByIdsMap" resultMap="BaseResultMap">
Select
<include refid="Base_Column_List" />
from jria where ID in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
</select>
findByIds(Long[] ids)
1.2 如果参数的类型是Array,则在使用时,collection属性要必须指定为 array(要是Repository 层指定参数必须与参数一致)
Xml代码 收藏代码
<select id="findByIdsMap" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from tabs where ID