拉着猪逛街 2016-07-22 10:02 采纳率: 20%
浏览 1185
已采纳

mybatis批量更新的问题

<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
  • 写回答

2条回答 默认 最新

  • minge0001 2016-07-23 06:43
    关注

    mapper里的表名、字段名都写对了吗,或者update有没有传id

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?