踩坑记:在传递
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>
最后
以上就是文静手机最近收集整理的关于MyBatis 使用数组作为参数的全部内容,更多相关MyBatis内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复