批量新增

<insert id="savePatientEmr" parameterType="java.util.List" useGeneratedKeys="false">insert into PATIENT_EMR_DATA(ID, INP_NO, INP_FREQ,OUT_PATIENT_NO, PATIENT_INDEX, MEDICAL_TYPE,CMT, WRITING_DOCTOR_CODE, WRITING_DOCTOR_NAME,WRITING_TIME, DEPT_CODE, DEPT_NAME,SIGN_DOCTOR_CODE, SIGN_DOCTOR_NAME, SIGN_TIME,CDR_TIME, CDR_SOURCE, IS_DELETE,CREATER, CREATETIME, UPDATER,UPDATETIME, MEDICAL_VALUE)<foreach item="item" index="index" collection="saves" separator="union all">(SELECT#{item.id,jdbcType=VARCHAR}, #{item.inpNo,jdbcType=VARCHAR}, #{item.inpFreq,jdbcType=DECIMAL},#{item.outPatientNo,jdbcType=VARCHAR}, #{item.patientIndex,jdbcType=VARCHAR}, #{item.medicalType,jdbcType=DECIMAL},#{item.cmt,jdbcType=VARCHAR},#{item.writingDoctorCode,jdbcType=VARCHAR}, #{item.writingDoctorName,jdbcType=VARCHAR},#{item.writingTime,jdbcType=TIMESTAMP}, #{item.deptCode,jdbcType=VARCHAR}, #{item.deptName,jdbcType=VARCHAR},#{item.signDoctorCode,jdbcType=VARCHAR}, #{item.signDoctorName,jdbcType=VARCHAR}, #{item.signTime,jdbcType=TIMESTAMP},#{item.cdrTime,jdbcType=TIMESTAMP}, #{item.cdrSource,jdbcType=VARCHAR}, #{item.isDelete,jdbcType=DECIMAL},#{item.creater,jdbcType=VARCHAR}, #{item.createtime,jdbcType=TIMESTAMP}, #{item.updater,jdbcType=VARCHAR},#{item.updatetime,jdbcType=TIMESTAMP}, #{item.medicalValue,jdbcType=NVARCHAR}FROM DUAL)</foreach>
</insert>

批量更新(多条件)

<update id="updatePatientEmr" parameterType="PatientEmrDataModel"><foreach collection="list" item="item" index="index" open="begin" close=";end;" separator=";">update PATIENT_EMR_DATA<set><if test="item.inpFreq != null">INP_FREQ = #{item.inpFreq,jdbcType=DECIMAL},</if><if test="item.outPatientNo != null and item.outPatientNo !='' ">OUT_PATIENT_NO = #{item.outPatientNo,jdbcType=VARCHAR},</if><if test="item.patientIndex != null and item.patientIndex !='' ">PATIENT_INDEX = #{item.patientIndex,jdbcType=VARCHAR},</if><if test="item.medicalType != null">MEDICAL_TYPE = #{item.medicalType,jdbcType=DECIMAL},</if><if test="item.cmt != null and item.cmt !='' ">CMT = #{item.cmt,jdbcType=VARCHAR},</if><if test="item.writingDoctorCode != null and item.writingDoctorCode !='' ">WRITING_DOCTOR_CODE = #{item.writingDoctorCode,jdbcType=VARCHAR},</if><if test="item.writingDoctorName != null and item.writingDoctorName !='' ">WRITING_DOCTOR_NAME = #{item.writingDoctorName,jdbcType=VARCHAR},</if><if test="item.writingTime != null">WRITING_TIME = #{item.writingTime,jdbcType=TIMESTAMP},</if><if test="item.deptCode != null and item.deptCode !='' ">DEPT_CODE = #{item.deptCode,jdbcType=VARCHAR},</if><if test="item.deptName != null and item.deptName !='' ">DEPT_NAME = #{item.deptName,jdbcType=VARCHAR},</if><if test="item.signDoctorCode != null and item.signDoctorCode !='' ">SIGN_DOCTOR_CODE = #{item.signDoctorCode,jdbcType=VARCHAR},</if><if test="item.signDoctorName != null and item.signDoctorName !='' ">SIGN_DOCTOR_NAME = #{item.signDoctorName,jdbcType=VARCHAR},</if><if test="item.signTime != null">SIGN_TIME = #{item.signTime,jdbcType=TIMESTAMP},</if><if test="item.cdrTime != null">CDR_TIME = #{item.cdrTime,jdbcType=TIMESTAMP},</if><if test="item.cdrSource != null  and item.cdrSource !='' ">CDR_SOURCE = #{item.cdrSource,jdbcType=VARCHAR},</if><if test="item.isDelete != null">IS_DELETE = #{item.isDelete,jdbcType=DECIMAL},</if><if test="item.creater != null">CREATER = #{item.creater,jdbcType=VARCHAR},</if><if test="item.createtime != null">CREATETIME = #{item.createtime,jdbcType=TIMESTAMP},</if><if test="item.updater != null  and item.updater !='' ">UPDATER = #{item.updater,jdbcType=VARCHAR},</if><if test="item.updatetime != null">UPDATETIME = #{item.updatetime,jdbcType=TIMESTAMP},</if><if test="item.medicalValue != null  and item.medicalValue !='' ">MEDICAL_VALUE = #{item.medicalValue,jdbcType=NVARCHAR},</if><if test="item.inpNo != null and item.inpNo !='' ">INP_NO = #{item.inpNo,jdbcType=VARCHAR}</if></set><where>1 = 1<if test="item.inpNo != null and  item.inpNo !='' ">and INP_NO=#{item.inpNo}</if><if test="item.inpFreq != null and  item.inpFreq !='' ">and INP_FREQ=#{item.inpFreq}</if><if test="item.outPatientNo != null and  item.outPatientNo !='' ">and OUT_PATIENT_NO=#{item.outPatientNo}</if><if test="item.medicalType != null and  item.medicalType !='' ">and MEDICAL_TYPE=#{item.medicalType}</if></where></foreach>
</update>

orcal 批量新增,批量更新多条件相关推荐

  1. mybatis-plus的批量新增/批量更新以及问题

    批量新增/删除 1.代码中foreach insert/update 2.多线程foreach insert/update 3.mybatis xml中foreach 4.通过自定义 SQL注入器扩展 ...

  2. linq to object 、linq to sql 、linq to entity 批量 新增、更新、删除功能扩展

    最近在codeplex上找到了一个功能比较全的linq to object .linq to sql .linq to entity新增.修改.删除功能扩展的控件--magiq. 以linq to s ...

  3. oracle merge into 批量新增或更新

    mapper.java /*** 批量插入或更新* @param stpos* @author fengjia* @date 2022/5/9 19:50*/void mergeInto(List&l ...

  4. oracle批量将id更新为uuid,oracle批量新增更新数据

    本博客介绍一下Oracle批量新增数据和更新数据的sql写法,业务场景是这样的,往一张关联表里批量新增更新数据,然后,下面介绍一下批量新增和更新的写法: 批量新增数据 对于批量新增数据,介绍两种方法 ...

  5. oracle应用之批量新增更新数据

    本博客介绍一下Oracle批量新增数据和更新数据的sql写法,业务场景是这样的,往一张关联表里批量新增更新数据,然后,下面介绍一下批量新增和更新的写法: 批量新增数据 对于批量新增数据,介绍两种方法 ...

  6. mybatis批量新增和批量更新的效率对比

    今天,为了更多了解下,mybatis批量新增和批量更新在simple/batch模式 + MySQL的rewriteBatchedStatements下效率有什么区别,做了一次实验. 实验结果,让人意 ...

  7. ORACLE 数据同步时,批量进行新增和更新操作的SQL写法

    场景模拟:比如自己项目的一张EMP员工信息表,数据来源需要从第三方系统获取,随时可手动同步更新,也可以定时自动同步.一般情况下,通过创建时间或者最后更新时间,获取自上次同步后的数据增量,全部插入本地的 ...

  8. 基于ruoyi+vue+elementUI实现列表,新增,附件上传,tab+springBoot+mybatis+oracle序列+批量新增

    基于ruoyi+vue+elementUI实现列表,新增,附件上传,tab+springBoot+mybatis+oracle序列+批量新增 页面效果 列表页面 新增页面 详情页面 代码实现 列表+新 ...

  9. Mybatis Plus重写批量新增和批量删除

    批量新增: import com.baomidou.mybatisplus.core.injector.AbstractMethod; import com.baomidou.mybatisplus. ...

最新文章

  1. 孪生网络图像相似度_生成对抗网络的进步多大,请看此文
  2. 哪些编程语言需要修复?
  3. MainWindow 简介
  4. Android 系统Dimension和间距参数详解
  5. QT的QScopedPointer类的使用
  6. python利用opencv标注bounding box
  7. Docker教程(四) Docker镜像构建
  8. SprinBoot-data-jpa整合Vue使用Swagger2实现前后端分离
  9. 拆分工作簿为多个文件_如何批将Excel的多个Sheet工作表拆分为独立的工作簿?...
  10. Netty工作笔记0035---Reactor模式图剖析
  11. JavaScript高级程序设计笔记 事件冒泡和事件捕获
  12. 关于正则表达式中^和$
  13. [直观学习排序算法] 视觉直观感受若干常用排序算法
  14. 软考中常见的英文缩写
  15. python的开发环境
  16. 大学生数学竞赛资料目录20190403更新
  17. 基于c#的IE 代理服务器设置
  18. springboot 自定义starter
  19. K8S—pv和pvs
  20. Low-Code is Low—— 低代码的使用

热门文章

  1. 悲痛!武汉一副教授遇袭身亡!
  2. 发朋友圈显示来自html5,朋友圈说说动态怎么显示来自iPhone XS 装逼技能get
  3. 论文投稿指南——中文核心期刊推荐(国家财政)
  4. 腾讯云TcaplusDB X 大主宰·大千世界|万道争锋,独领其风
  5. python运用在大数据中精准生活_在大数据中“精准”生活阅读答案
  6. 一文弄懂二叉树的三种遍历方式
  7. 遍历二叉树的递归算法
  8. 移动app开发的几种方式
  9. python三维图俯视图_二叉排序树 查找 python实现二叉树的俯视图
  10. 什么是框架,框架有什么用?C常用的框架有哪些?