<update id="addYearPlan" parameterType="List">
<foreach collection="list" separator=";" item="item">
update yearplan_header
<set>
plannedSalesTarget=#{item.plannedSalesTarget,jdbcType=DECIMAL},
plannedProfitTarget=#{item.plannedProfitTarget,jdbcType=DECIMAL}
</set>
<where>
id=#{item.id,jdbcType=VARCHAR}
</where>
</foreach>
</update>
以上为mybatis mapper代码,数据传过来的是一个list集合里面是实体类,运行程序后台不报错,同时数据也没有插进去,数据库链接的时候加入了allowMultiQueries=true

mybatis批量更新的问题
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- minge0001 2016-07-23 06:43关注
mapper里的表名、字段名都写对了吗,或者update有没有传id
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报