链接原文:
https://www.cnblogs.com/yy3b2007com/p/10417242.html#autoid-1-0-0
个人用法:
我使用的是list对sql的in的传参.后台从前台获取传来的id的字符串数组。后台对传来的字符串数组进行处理,将其放到方法参数列表中。
String[] sxxxid //此为传递来的参数
List<String> sxxxidlist = Arrays.asList(sxxxid);
select * from 表名 where 条件
IN
<foreach item="sxxxid" index="index" collection="list" open="(" separator="," close=")">
#{sxxxid}
</foreach>
)
这样就可以实现mybatis中in的用法了
使用字符串数组的时候
<foreach item="item" index="index" collection="ryzrzjxxVO.zfryxxIds" open="(" separator="," close=")">
#{item}
</foreach>