<!-- 批量添加派车单子表数据 -->
<insert id="addBatch" parameterType="java.util.List" >
insert into hylm_shipment_item
(
ship_number,
order_number,
pre_number,
goods_id,
real_num,
real_weight,
real_cubage,
cost,
creater,
createDate,
finalOperator,
operatTime,
pId,
uId,
orgId,
roleId
)
values
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.shipnumber,jdbcType=VARCHAR},
#{item.ordernumber,jdbcType=VARCHAR},
#{item.prenumber,jdbcType=VARCHAR},
#{item.goodsid,jdbcType=FLOAT},
#{item.realnum,jdbcType=VARCHAR},
#{item.realweight,jdbcType=VARCHAR},
#{item.realcubage,jdbcType=VARCHAR},
#{item.cost,jdbcType=VARCHAR},
#{item.creater,jdbcType=VARCHAR},
#{item.createDate,jdbcType=VARCHAR},
#{item.finalOperator,jdbcType=VARCHAR},
#{item.operatTime,jdbcType=VARCHAR},
#{item.pId,jdbcType=VARCHAR},
#{item.uId,jdbcType=VARCHAR},
#{item.orgId,jdbcType=VARCHAR},
#{item.roleId,jdbcType=VARCHAR}
)
</foreach>
</insert> <!-- 批量删除中转地数据 -->
<delete id = "deleteBatch" parameterType = "java.util.List">
<![CDATA[
delete from hylm_shipment_item where id in
]]>
<foreach collection="list" item="model" open="(" separator="," close=")">
#{model.id}
</foreach>
</delete> <!-- 批量更新派车单子表数据 -->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index" separator=";">
update hylm_shipment_item
<trim prefix="set" prefixOverrides=",">
<if test="item.id != null and item.id != ''">
,id = #{item.id}
</if>
<if test="item.shipnumber != null and item.shipnumber != ''">
,ship_number = #{item.shipnumber}
</if>
<if test="item.ordernumber != null and item.ordernumber != ''">
,order_number = #{item.ordernumber}
</if>
<if test="item.prenumber != null and item.prenumber != ''">
,pre_number = #{item.prenumber}
</if>
<if test="item.goodsid != null and item.goodsid != ''">
,goods_id = #{item.goodsid}
</if>
<if test="item.realnum != null and item.realnum != ''">
,real_num = #{item.realnum}
</if>
<if test="item.realweight != null and item.realweight != ''">
,real_weight = #{item.realweight}
</if>
<if test="item.realcubage != null and item.realcubage != ''">
,real_cubage = #{item.realcubage}
</if>
<if test="item.cost != null and item.cost != ''">
,cost = #{item.cost}
</if>
<if test="item.creater != null and item.creater != ''">
,creater = #{item.creater}
</if>
<if test="item.createDate != null and item.createDate != ''">
,createDate = #{item.createDate}
</if>
<if test="item.finalOperator != null and item.finalOperator != ''">
,finalOperator = #{item.finalOperator}
</if>
<if test="item.operatTime != null and item.operatTime != ''">
,operatTime = #{item.operatTime}
</if>
<if test="item.pId != null">
,pId = #{item.pId,jdbcType=VARCHAR}
</if>
<if test="item.uId != null">
,uId = #{item.uId,jdbcType=VARCHAR}
</if>
<if test="item.orgId != null">
,orgId = #{item.orgId,jdbcType=VARCHAR}
</if>
<if test="item.roleId != null">
,roleId = #{item.roleId,jdbcType=VARCHAR}
</if>
</trim>
where 1 = 1
<if test="item.id != null and item.id != ''">
and id = #{item.id}
</if>
<if test="item.ordernumber != null and item.ordernumber != ''">
and order_number = #{item.ordernumber}
</if>
<if test="item.uId != null and item.uId != ''">
and uId = #{item.uId}
</if>
</foreach>
</update>

MyBatis常用批量方法的更多相关文章

  1. Mybatis 实现批量插入和批量删除源码实例

    Mybatis 实现批量插入数据和批量删除数据 学习内容: 准备工作 1.数据库新建表 2.新建 Maven 项目和设置编译版本及添加依赖 3.新建 db.properties 4.新建 mybati ...

  2. mybatis执行批量更新update

    Mybatis的批量插入这里有http://ljhzzyx.blog.163.com/blog/static/38380312201353536375/.目前想批量更新,如果update的值是相同的话 ...

  3. 161102、MyBatis中批量插入

    方法一: <insert id="insertbatch" parameterType="java.util.List"> <selectKe ...

  4. Elasticsearch java api 常用查询方法QueryBuilder构造举例

    转载:http://m.blog.csdn.net/u012546526/article/details/74184769 Elasticsearch java api 常用查询方法QueryBuil ...

  5. Mybatis+mysql批量插入性能分析测试

    前言 今天在网上看到一篇文章(后文中的文章指的就是它) https://www.jianshu.com/p/cce617be9f9e 发现了一种有关于mybatis批量插入的新方法,而且看了文章发现我 ...

  6. Mybatis 常用注解

    Mybatis常用注解对应的目标和标签如表所示: 注解 目标 对应的XML标签 @CacheNamespace 类 <cache> @CacheNamespaceRef 类 <cac ...

  7. ETL流程介绍及常用实现方法

    ETL是英文Extract-Transform-Load 的缩写,用来描述将数据从来源端经过抽取(extract).转换(transform).加载(load)至目的端的过程.常见于数据仓库开发中将数 ...

  8. mysql基础---->mybatis的批量插入(一)

    这里面记录一下使用mybatis处理mysql的批量插入的问题,测试有可能不准.只愿世间风景千般万般熙攘过后,字里行间,人我两忘,相对无言. mybatis的批量插入 我们的测试主体类是springb ...

  9. 170829、mybatis使用oracle和mybatis中批量更新

    一.mybatis执行批量更新batch update 的方法(mysql数据库) 1.数据库连接必须配置:&allowMultiQueries=true(切记一定要加上这个属性,否则会有问题 ...

随机推荐

  1. 【JAVA】编程(2)---时间管理

    作业要求: 定义一个名为 MyTime 的类,其中私有属性包括天数,时,分,秒:定义一个可以初始化时,分,秒的构造方法,并对初始化数值加以限定,以防出现bug:定义一个方法,可以把第几天,时,分,秒打 ...

  2. c++学习笔记(八)

    内联函数 概念 内联(inline)函数是c++为提高程序运行速度所做得一项改进. 与常规函数的区别不在于编写方式,而在于被调用时的运行机制不同----编译器使用函数代码替换函数调用. 引用内联函数时 ...

  3. <互联网时代>观感

    <互联网时代>这部纪录片描绘了互联网从上世纪70年代到现在的整个发展过程,讲述了互联网带给我们生活的方方面面的变化,互联网技术在短短二,三十年的商业化浪潮中,以前所未有的速度谱写着改变世界 ...

  4. Json跨域登录问题的之Access-Control-Allow-Origin 站点跨域请求的问题

    跨域调用json问题 闲暇之时,做了一个博客站点,站点发布网络之后程序功能完成,最后发现了一个跨域的问题,比如我使用abc.com打开系统,一切正常,后台没有任何文件请求报错问题,然后我又使用了www ...

  5. 【linux系统】命令学习(七)进阶命令 curl jq

    curl 支持dict file ftp ftps gopher http https imap 1.实现代理 curl -x 129.3.3.3:8888 https://baidu.com 2.g ...

  6. SQL Server学习之路:建立数据库、建立表

    1.前言 配置是win10+SQL Server 2012,使用的GUI管理工具是SQL Server 2012自带的SQL Server Management Studio(以下简称SSMS).本系 ...

  7. 关于如何在MyEclipse下修改项目名包名,以及类

    1.修改项目名,右键选择properties->web->web-Context-root修改名称或者直接按F2修改.2,修改包名,右键选择Refactor->rename修改名称即 ...

  8. [bzoj5295]染色

    将这张图化简,不断删掉度为1的点(类似于拓扑排序),构成了一张由环组成的图考虑一个连通块中,设点数为n,边数为m(已经删掉了度为1的点),那么一共只有三种情况:1.一个环($n=m$),一定为YES2 ...

  9. 大厂技术实现 | 腾讯信息流推荐排序中的并联双塔CTR结构 @推荐与计算广告系列

    作者:韩信子@ShowMeAI,Joan@腾讯 地址:http://www.showmeai.tech/article-detail/tencent-ctr 声明:版权所有,转载请联系平台与作者并注明 ...

  10. 洛谷 P4088 [USACO18FEB] Slingshot P(线段树+二维数点)

    题目链接 题意:有一个数轴,上面有 \(n\) 个传送门,使用第 \(i\) 个传送门,你可以从 \(x_i\) 走到 \(y_i\),花费的时间为 \(t_i\) 秒.你的速度为 \(1\) 格/秒 ...