zoukankan      html  css  js  c++  java
  • 批量更新update、批量插入insert

    1、批量更新update

      int updateBatch(Map<String, Object> m);
    
      <update id="updateBatch">
        update fc_naturaldanger_item_t
        set checkret_bigd =
        <foreach collection="list" item="item" index="index" separator=" " open="case ID" close="end">
          when #{item.id} then #{item.checkretBigd}
        </foreach>
          where id in
        <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
          #{item.id,jdbcType=INTEGER}
        </foreach>
      </update>

    2、批量插入insert

      int insertBath(Map<String, Object> m);
    
      <insert id="insertBath">
        insert into fc_naturaldanger_item_t (dangerstudyid,dangerid, checkret)
        values 
        <foreach collection="list" item="item" separator=",">
          (#{dangerstudyid}, #{item.dangerid}, #{item.checkret})
        </foreach>
      </insert>        //id为自增长状态
    我驰骋天下,守你盛世繁华
  • 相关阅读:
    poj2774
    GDOI2012 字符串
    poj3261
    poj1743
    bzoj 2565 manacher
    归档-ios
    学习
    ViewPager动态加载、删除页面
    android:ScrollView嵌套ListView的问题
    Android学习笔记进阶之在图片上涂鸦(能清屏)
  • 原文地址:https://www.cnblogs.com/lotuses/p/11356052.html
Copyright © 2011-2022 走看看