本人执行sql时,如果在 close=”end;” 后添加separator=“;” ,而where条件没有添加;时,执行的sql语句中最后一个update无法添加分号,所以正确执行就在where条件后面加分号,不添加separator=“;”。

<update id=”” parameter=”list”>

update 表名

       <foreach collection=”list” item=”item” index=”index”  open=”begin”  close=”end;” >

            <set>

                name=#{item.name}

           </set>

         where id=#{item.id};

    </foreach>

</select>


版权声明:本文为Gr_lbxx原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
原文链接:https://blog.csdn.net/Gr_lbxx/article/details/81088803