最近公司用ibatis开发项目,本来可以用存储过程处理批量插入,批量修改及多组条件查询;但由于使用模块相对较小,暂时就在xml中配置,以前没有在xml做过类似处理,有必要记录一下;好了,代码如下:

<!-- 批量插入 -->
<insert id="saveNotificationPushInfo" parameterClass="java.util.List">
<![CDATA[INSERT ALL]]>
<iterate conjunction="" >
into notification_push_info(
push_log_no,
business_book,
employee_id,
notification_no,
push_flag,
push_time
)values
(
bep_seq_package.fetch_seq('NOTIFICATION_PUSH_INFO','PUSH_LOG_NO','BEPDATA'),
#list[].businessBook:varchar#,
#list[].employeeId:varchar#,
#list[].notificationNo:varchar#,
#list[].pushFlag:varchar#,
sysdate
)
</iterate>
<![CDATA[SELECT * FROM dual]]>
</insert> <!-- 多组条件查询-->
<select id="getSameNotificationList" parameterClass="java.util.List" resultClass="java.util.HashMap">
select distinct employee_id "employeeId",
notification_no "notificationNo"
from notification_push_info npi
where npi.invalid_flag = 'N'
<iterate conjunction="or" open="and" close="">
npi.employee_id = #notiList[].employeeId#
and npi.business_book = #notiList[].businessBook#
and npi.notification_no = #notiList[].notificationNo#
</iterate>
</select> <!-- 批量修改-->
<update id="updateNotiList" parameterClass="java.util.List">
begin
<iterate conjunction="">
update notification_push_info set
push_flag = #list[].FLAG#,
push_time = sysdate
where invalid_flag = 'N'
and employee_id = #list[].employeeId#
and notification_no = #notiList[].notificationNo#;
</iterate>
end;
</update>

如有问题,请大家指出来,谢谢!

oracle 在xml中批量插入,批量修改及多组条件查询的更多相关文章

  1. oracle数据库表中,插入数据的时候如何产生一个 字母+数字 编号?

    Oracle 语句中“||”代表什么啊? oracle数据库表中,插入数据的时候如何产生一个 字母+数字 编号? 排序的话,用order by来处理即可.比如:cola123a234b999b335s ...

  2. java 实现mongoDB 增加,删除,修改,查看,多条件查询,聚合查询,分组查询(史上最全)

    首先idea创建一手springboot项目 引入如下依赖 <dependency> <groupId>org.mongodb</groupId> <arti ...

  3. SQL Server 2012中快速插入批量数据的示例及疑惑

    SQL Server 2008中SQL应用系列--目录索引 今天在做一个案例演示时,在SQL Server 2012中使用Insert语句插入1万条数据,结果遇到了一个奇怪的现象,现将过程分享出来,以 ...

  4. 【mybatis】mybatis中批量插入 批量更新 batch 进行insert 和 update,或者切割LIst进行批量操作

    ================================================================== 分别展示 mybatis 批量新增  和 批量更新   的操作: ...

  5. mongodb 批量改变某一列类型 比如 String改为double,insert into select 批量插入 批量修改

    //type:2代表String 1.String变Double db.集合.find({"列":{$type:2}}).forEach(function(x){ x.列=pars ...

  6. springMVC 接收数组参数,mybatis 接收数组参数,mybatis批量插入/批量删除案例

    案例是给一个用户赋予多个权限,多个权限用其对应的主键 id 为参数,组成了 一个id数组,传给springMVC,然后springMVC传给mybatis,然后mybatis批量插入.其实类似的场景还 ...

  7. Dapper, 批量插入,批量更新, 以及in, like

    1. 批量插入 public async Task CreateBusinessItemAsync(IEnumerable<BusinessItemsEntity> businessIte ...

  8. Mysql慢查询开启和查看 ,存储过程批量插入1000万条记录进行慢查询测试

    首先登陆进入Mysql命令行  执行sql      show variables like 'slow_query%';  结果为OFF 说明还未开启慢查询 执行sql     show varia ...

  9. Java:批量插入、修改数据到数据库中的用法

    在java中使用JDBC实现批处理的对象一般是使用PrepareStatement对象. 如何使用: Class.forName("Oracle.jdbc.driver.OracleDriv ...

随机推荐

  1. spring启动加载类,手动加载bean

    方法一: public final class Assembler implements BeanFactoryPostProcessor { private static ConfigurableL ...

  2. Carrier-Grade Mirantis OpenStack (the Mirantis NFV Initiative), Part 1: Single Root I/O Virtualization (SR-IOV)

    The Mirantis NFV initiative aims to create an NFV ecosystem for OpenStack, with validated  hardware ...

  3. 关于Javascript没有块级作用域和变量声明提升

    Javascript是没有块级作用域的,在语句块中声明的变量将成为语句块所在代码片段的局部变量.例如: if(true){ var x=3; } console.log(x); 结果输出3. 再如: ...

  4. jquery自定义window事件

    <body> <a href='https://www.baidu.com/'>百度</a> </body> <script type=" ...

  5. [thinkphp使用phpspreadsheet时出现]Cannot redeclare xxxxxx() (previously declared in C:\WWW\xxx.xxx:xxx)

    [thinkphp使用phpspreadsheet时出现]Cannot redeclare xxxxxx() (previously declared in C:\WWW\xxx.xxx:xxx) 一 ...

  6. 51nod 1686 二分+离散化

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1686 1686 第K大区间 基准时间限制:1 秒 空间限制:131072 ...

  7. HTTP通道

    通过httptunnel技术进行入侵示例 httptunnel是通过HTTP通道来传输其他协议数据的工具软件,下载地址为:www.http-tunnel. com,目前最新版本3.0.5 工具/原料 ...

  8. 达观数据分析平台架构和Hive实践——TODO

    转自: http://www.infoq.com/cn/articles/hadoop-ten-years-part03 编者按:Hadoop于2006年1月28日诞生,至今已有10年,它改变了企业对 ...

  9. IDEA提交Git时忽略文件【ignore文件备份】

    IntellJ IDEA设置ignore文件忽略,需: 第一步:下载idea的ignore插件,链接:https://pan.baidu.com/s/14_cfq56g1s7Lc6LdiolvWA 密 ...

  10. Ubuntu 安装arm-linux-gcc编译器

    /********************************************************************************** * Ubuntu 安装arm-l ...