mybatis批量新增和批量修改 柔情只为你懂 2022-09-08 13:00 269阅读 0赞 批量新增 <insert id="saveBatch"> INSERT INTO tb_test(chapterId,parentId,coursesId,insertTime) VALUES <foreach collection="list" item="item" separator=","> ( #{item.chapterId},#{item.parentId},#{item.coursesId},now() ) </foreach> </insert> 批量修改 <update id="updateAll"> <foreach collection="list" item="item" index="index" open="" close="" separator=";"> update tb_test <set> code=#{item.code}, status = 2 </set> where id = #{item.id} </foreach> </update>
还没有评论,来说两句吧...