MyBatis 允许您使用它每个批处理驱动程序更新多行。要使用这个功能,您需要使用 mapper XML 文件中的 <foreach>。例如,如下所示:
<update id="batchUpdateAccount" parameterType="java.util.Map">
update ACCOUNT set
ACC_EMAIL = #{emailAddress}
where
ACC_ID in
<foreach item="Account" collection="list" open="(" close=")" separator=",">
#{Account.id}
</foreach>
</update>
<update id="batchUpdateAccount" parameterType="java.util.Map">
update ACCOUNT set
ACC_EMAIL = #{emailAddress}
where
ACC_ID in
<foreach item="Account" collection="list" open="(" close=")" separator=",">
#{Account.id}
</foreach>
</update>
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow
from("direct:start")
.to("mybatis:batchUpdateAccount?statementType=UpdateList")
.to("mock:result");
from("direct:start")
.to("mybatis:batchUpdateAccount?statementType=UpdateList")
.to("mock:result");
Copy to Clipboard
Copied!
Toggle word wrap
Toggle overflow