<!-- 批量添加派车单子表数据 -->
<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. linux下c语言实现简单----线程池

    这两天刚好看完linux&c这本书的进程线程部分,学长建议可以用c语言实现一个简单的线程池,也是对线程知识的一个回顾与应用.线程的优点有好多,它是"轻量级的进程",所需资源 ...

  2. 通过t-sql定期自动备份SQL Server 上的所有数据库

    项目背景 解决方案 方案一,是采用SQL的定时备份,建立作业来操作,这里有完整的使用手册: 方案二:基于t-sql方法进行查询备份 方案思路: 1.1 在 Master 数据库上创建一个备份所有数据库 ...

  3. python实现超大图像的二值化方法

    一,分块处理超大图像的二值化问题   (1) 全局阈值处理  (2) 局部阈值 二,空白区域过滤 三,先缩放进行二值化,然后还原大小 np.mean() 返回数组元素的平均值 np.std() 返回数 ...

  4. <C#任务导引教程>练习十

    /*83,使用接口完成多继承问题 简化版*/using System;interface ITeacher{    string Name    {        get;        set;   ...

  5. 宝藏好物gRPCurl

    宝物简介 grpcur是一个与grpc服务器交互的命令行工具,可认为是gRPC的curl工具. grpcurl用于从命令行调用gRPC服务器支持的RPC方法,gRPC使用二进制编码(protobuf) ...

  6. 【Vue.js】SPA

    SPA 2019-11-13  23:20:48  by冲冲 1.概念 (1)MPA(multi-page application) 特点:每一次页面跳转的时候,后台服务器都会返回一个新的html文档 ...

  7. iNeuOS工业互联网操作系统,分布式云端控制安全策略和增加实时日志功能

    目       录 1.      概述... 2 2.      平台演示... 2 3.      云端控制策略和应用过程... 2 3.1           云端控制策略... 2 3.2   ...

  8. 洛谷 P3307 - [SDOI2013]项链(Burnside 引理+数论)

    题面传送门 看到题目我们显然可以将题目拆分成两部分:首先求出有多少个符合要求的珠子 \(c\),这样我们就可以将每种珠子看成一种颜色,题目也就等价于有多少种用 \(c\) 种颜色染长度为 \(n\) ...

  9. 关闭 IDEA 自动更新

    关闭 IDEA 的自动检查更新(截图idea 2020 2.x) idea 右下角会有这样的更新提示 2. 关闭 idea 自动检查更新 取消勾选 Automatically check update ...

  10. mysql端口查看与修改-netstat命令使用

    linux上使用netstat察看mysql端口和连接 linux上使用netstat察看mysql端口和连接 近日发现写的一个java程序的数据库连接在大压力下工作不打正常,因此研究了一下dbcp, ...