<pre>List<Integer></pre>
讯享网

讯享网Long[]

![]()


1. findByIds(List<Integer> ids) 传入参数为单一list参数时的写法
<foreach item=“id” index=“index” collection=“list” open=“(” separator=“,” close=“)”>
#{id}
</foreach>
2. findByIds(Integer[] ids) 传入参数为单一数组时的写法
<foreach item=“id” index=“index” collection=“array” open=“(” separator=“,” close=“)”>
#{id}
</foreach>
3. search(Integer[] ids,String title) 传入参数为多个类型的查询条件时
Map<String, Object> params = new HashMap<String, Object>();
params.put(“title”, title);
params.put(“ids”, ids);
<foreach item=“id” index=“index” collection=“ids” open=“(” separator=“,” close=“)”>
#{id}
</foreach>
4.search(Person person) 传入参数为bean对象
<foreach item=“id” index=“index” collection=“person.ids” open=“(” separator=“,” close=“)”>
#{id}
</foreach>
四种方式应用不同的场景,主要是collection的参数不同————————————————
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/gavin5033/article/details/

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容,请联系我们,一经查实,本站将立刻删除。
如需转载请保留出处:https://51itzy.com/kjqy/207121.html