java中使用事务控制循环更新插入数据与sqlMap中使用iterate循环union all效率比较

来源:互联网 发布:佳能1880清零软件 编辑:程序博客网 时间:2024/05/17 23:30

应用环境:读取excel中数据持久化写入数据库

涉及框架:spring+struts+ibatis

思路1:读取导入excel数据到hashMap中使用foreach遍历单条写入数据库

思路2:读取导入excel数据到hashMap中使用ibatis的iterate遍历hashMap使用union all拼接sql

总共测试数据:7575条

采用思路1:15分钟;

思路2:未知,一直测试中;

代码片段:

dao.update("datacheck.resultaudit.mergeAllFeedMess", bo);
// for (HashMap<String,String> oneMess:bo.getFeedMess())
// {
// bo.setOneFeedMess(oneMess);
//// //更新工单回复信息
//// dao.update("datacheck.resultaudit.updateFeedData", bo);
//// //插入工单回复信息
//// dao.insert("datacheck.resultaudit.saveFeedMess", bo);
//
// //更新插入工单回复信息
// dao.update("datacheck.resultaudit.mergeFeedMess", bo);
// }
Date date2 = new Date();


<!-- 插入更新所有工单回复信息 -->
<update id="mergeAllFeedMess" parameterClass="com.bonc.datacheck.bo.resultaudit.ResultAuditBO">
merge into busi_check_feed_back_detail t1
using (
<iterate conjunction="union all" property="feedMess" >
select 
#configId# "configId",
   d.acct_month,
d.rule_id,
d.rec_ord,




1 0
原创粉丝点击