oracle批量更新操作,对应的dao层xml文件

<update id="updateBatch" parameterType="java.util.List">
 begin  
<foreach collection="list" item="item" index="index" separator=";" > 
    UPDATE USER_INFO
    <set>
        <if test="null != item.name">
            <![CDATA[name = #{item.name,jdbcType=VARCHAR}]]>
        </if>
    </set>
	<![CDATA[
		WHERE  ID = #{item.id,jdbcType=VARCHAR} 
	]]>
  </foreach>
   ;end;
</update>


<update id="batchUpdate"  parameterType="java.util.List">
   <foreach collection="list" item="item" index="index" open="begin" close="end;" separator=";">
update test <set> test=${item.test}+1 </set> where id = ${item.id}
   </foreach> 
</update>


<update id="updateBatch" parameterType="Map">  
        update aa   set   
            a=#{fptm},  
            b=#{csoftrain}  
        where c in   
        <foreach collection="cs" index="index" item="item" open="("separator=","close=")">  
            #{item}  
        </foreach>  
</update> 


<update id="batchUpdateUser" parameterType="java.util.ArrayList"> 
 <foreach collection="list" item="userlist" index="index" open="begin" close=";end;" separator=";"> 
  UPDATE USERINFO T 
   <set> 
   T.USERID = #{userlist.userid,jdbcType=VARCHAR}, 
   T.USERNAME = #{userlist.username,jdbcType=VARCHAR}, 
   </set> 
   WHERE 
   T.USERID = #{userlist.userid,jdbcType=VARCHAR} 
 </foreach> 
</update>


<update id="updateBatch" parameterType="java.util.List">  
     begin    
         <foreach collection="list" item="item" index="index" separator=";" >  
             update table_name  
             <set>  
                 name= #{item.name}  
             </set>  
             where id = #{item.id}  
         </foreach>  
         ;end;  
</update> 


<update id="updateBatch" parameterType="java.util.List">  
   <foreach collection="list" item="item" index="index" open="begin" close="end;" separator=";">  
      update table_name  
      <set>  
         name= #{item.name}  
      </set>  
         where id = #{item.id}  
   </foreach>  
</update> 

 

已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页