踩坑记:在传递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 stationswhere is_native in <foreach collection="typeIds" item="id" open="(" close=")" separator=",">#{id}</foreach></select>
路漫漫其修远兮,吾将上下而求索
译文:在追寻真理方面,前方的道路还很漫长,但我将百折不挠,不遗余力地去追求和探索 。
推荐阅读
- 9 个你可能从未使用过的很棒的 CSS 属性
- Spring Boot 使用自定义注解实现防止表单重复提交
- Nginx高可用HA
- 使用 Docker Buildx 构建多种系统架构镜像
- 翡翠|使用其他光源就能看判断翡翠真假,暴露原来面貌,要针对性使用
- 手机测亩仪使用方法是什么?
- docker背后的原理
- 除去衣服上的铁锈使用哪种试剂?
- MyBatis自动生成工具,开发编码好帮手
- 保姆级教程:内网穿透工具使用总结
