批量修改,每500条数据更新一次

更新时间:2023-07-12 12:37:27 阅读: 评论:0

批量修改,每500条数据更新⼀次// 商品信息,每500条批量更新⼀次
大麦的功效和作用if(null != updateItemList && updateItemList.size() > 0){
Map<Integer,List<Item>> itemMap = new HashMap<Integer, List<Item>>();
itemMap.put(1, new ArrayList<Item>());
for(Item item : updateItemList){
List<Item> groupItemList = (itemMap.size());
感恩节的小故事if(groupItemList.size() == 500){
groupItemList = new ArrayList<Item>();
itemMap.put(itemMap.size() + 1, groupItemList);
}
groupItemList.add(item);
}
for (Integer key : itemMap.keySet()) {
List<Item> groupItemList = (key);
itemDao.batchUpdate(groupItemList);
}
}
sql:
<!-- 批量修改商品信息 -->
<update id="batchUpdate" parameterType="java.util.List">
UPDATE tbl_item
<trim prefix="t" suffixOverrides=",">
<trim prefix="description = ca" suffix="end,">
<foreach collection="updateItemList" item="item" index="index">凯仕乐
<if test="item.description != null">
when item_no=#{item.itemNo} then #{item.description}
</if>
</foreach>
</trim>
<trim prefix="shelf_life = ca" suffix="end,">
七嘴八舌是什么意思<foreach collection="updateItemList" item="item" index="index">
<if test="item.shelfLife != null">
when item_no=#{item.itemNo} then #{item.shelfLife}
</if>
</foreach>
</trim>
<trim prefix="update_by = ca" suffix="end,">
<foreach collection="updateItemList" item="item" index="index">
when item_no=#{item.itemNo} then #{updateBy}丹麦大学排名
婴儿澡盆
</foreach>
</trim>
<trim prefix="update_date = ca" suffix="end,">
<foreach collection="updateItemList" item="item" index="index">
郦道元水经注
when item_no=#{item.itemNo} then now()
</foreach>
</trim>
</trim>
where item_no inyuanxiao
<foreach collection="updateItemList" parator="," item="item" index="index" open="(" clo=")">
#{item.itemNo}
</foreach>
</update>

本文发布于:2023-07-12 12:37:27,感谢您对本站的认可!

本文链接:https://www.wtabcd.cn/fanwen/fan/82/1092548.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:大麦   批量   澡盆   功效   修改   婴儿   作用
相关文章
留言与评论(共有 0 条评论)
   
验证码:
推荐文章
排行榜
Copyright ©2019-2022 Comsenz Inc.Powered by © 专利检索| 网站地图