批量新增

<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. 10.5 考试 (感觉比较难)
  2. C++设计模式之装饰模式
  3. 移植uboot之修改代码支持NorFlash记录续集二
  4. jquery动态插入行,不用拼写html,简洁版
  5. Windows下Weblogic 12c单机安装与部署
  6. 【仿某公司前台】 asp安全查询系统
  7. MFC MessageBox使用教程
  8. Windows10最常用的软件推荐V1.7
  9. [连接机顶盒]-使用 adb 命令行无线连接 EC6108V9 华为悦盒
  10. vivado下载地址和ISE下载地址
  11. robots协议限制爬虫
  12. SQL Server 2000 数据库安装与配置图文教程
  13. Linux关闭防火墙命令总结
  14. C语言输出4*5的矩阵
  15. 输入命题p和q的真值,求p、q的合取、析取、异或、蕴含和等值命题的真值
  16. 关于Typora的markdown编辑器行间距过大、不一致的问题
  17. 一碗猪油————————特别鲜香的猪油什锦炒饭
  18. 基于STM32的电机--直流有刷电机H桥驱动的不同模式分析
  19. python coding style why_python coding style guide 的快速落地实践——业内python 编码风格就pep8和谷歌可以认作标准...
  20. 公务员想辞职转行做程序员?

热门文章

  1. 怎么提取音频中的文字?这篇文章告诉你
  2. 涨姿势:10 大主宰世界的算法!
  3. 微型计算机拆卸安装的注意事项,微型计算机使用注意事项及保养的一般方法.doc...
  4. 华为HCIP-DATACOM(821)361-390
  5. 结构化、非结构化和半结构化数据 数据清洗
  6. 分清什么是库,什么是框架
  7. unity打包 winodws打包pc启动分辨率设置
  8. 关键词instanceof、重写、继承、多态
  9. 大数据之数据的压缩与存储
  10. Synopsys逻辑工艺库(DC综合)