踩坑记:在传递
List<Integer>
typeIds作为参数时,MyBatis foreach不能获取到参数,使用Integer[] typeIds就可以了。
主要代码:
1、接口
List<Station> getList(@Param("typeIds") Integer[] typeIds);
2、xml文件
<select id="getList" resultType="Station">
select id, `name`, lon, lat, city, county, town, is_native isNative, type, `describe`
from stations
where is_native in <foreach collection="typeIds" item="id" open="(" close=")" separator=",">#{id}</foreach>
</select>