Python 官方文档:入门教程 => 点击学习
目录需求单list的情况多参数+list用map传参参考资料需求 foreach中要传两个参数,一个是id,一个是list。怎么传呢? 单list的情况 Mapper.java
foreach中要传两个参数,一个是id,一个是list。怎么传呢?
Mapper.java
public int batchDeleteBizTeam(List<BizTeam> teamList);
Mapper.xml
<delete id="batchDeleteBizTeam">
delete from biz_team where id in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
</delete>
因为我们只传了一个参数,所以这里的collection="list"会自动对应List teamList
传参地方:
Map params = new HashMap();
params.put("matchId", matchIdLong);
params.put("oeList", oddsEuropeList)
Mapper.java
public int batchDeleteOddsEurope(Map params);
Mapper.xml
<delete id="batchDeleteOddsEurope">
delete from biz_odds_europe where match_id=#{matchId} and company_id in
<foreach item="item" collection="oeList" separator="," open="(" close=")" index="">
#{item.companyId}
</foreach>
</delete>
这里的 collection="#{oeList}"
就对应Map中的key为oeList的值了。
https://www.cnblogs.com/fnlingnzb-learner/p/10566452.html
到此这篇关于mybatis foreach 批量删除 传两个参数的文章就介绍到这了,更多相关mybatis foreach 批量删除内容请搜索编程网以前的文章或继续浏览下面的相关文章希望大家以后多多支持编程网!
--结束END--
本文标题: mybatis foreach传两个参数批量删除
本文链接: https://www.lsjlt.com/news/208919.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0