mybatis注解实现对象批量更改
一、介绍
当有多个对象需要进行更改时,批量修改对象集合List
二、代码
@Update("<script>"
+ "<foreach collection='listUserAnswerRecord' item='item' open='' close='' separator=';'> "
+ " update t_qb_record_201910"
+ " set answered = 0, progress = 1, answer_sheet = null, gmt_update = #{item.gmtUpdate}"
+ " <where>"
+ "<choose>"
+ "<when test='item.unionid !=null'> unionid=#{item.unionid}</when>"
+ "<otherwise> openid= #{item.openid} </otherwise>"
+ "</choose>"
+ " and goods_id = #{item.goodsId} and charpter_id = #{item.charpterId} and type = #{item.type}"
+ "</where>"
+ "</foreach>"
+ "</script>")
Integer deleteUserAnswerSheet(@Param("listUserAnswerRecord") List<UserAnswerRecordNew> listUserAnswerRecord);
MyBatis注解实现对象批量更改
博客介绍了使用MyBatis注解实现对象批量更改的方法。当有多个对象需要更改时,可对对象集合List进行批量修改,并给出了相关代码。
5036

被折叠的 条评论
为什么被折叠?



