当前位置: 首页 > wzjs >正文

安利的网站谁做的seo培训学院官网

安利的网站谁做的,seo培训学院官网,沈阳有什么服务网站,麦三佰日文网站建设### Error updating database. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 传入的表格格式数据流(TDS)远程过程调用(RPC)协议流不正确。此 RPC 请求中提供了过多的参数。最多应为 2100。 这是因为集合数据量过大,需要对集合进行拆分操作&#xff0…

### Error updating database.  Cause: com.microsoft.sqlserver.jdbc.SQLServerException: 传入的表格格式数据流(TDS)远程过程调用(RPC)协议流不正确。此 RPC 请求中提供了过多的参数。最多应为 2100。

这是因为集合数据量过大,需要对集合进行拆分操作,就是将大集合折分成几个小集合,再进行分批操作,如:[1,2,3,4,5,6,7] 按三个一组拆分成 [[1,2,3]、[4,5,6]、[7]]

// 批量增加受理样品@Overridepublic void addBatch(List<ApplySample> applySampleList) {// 如果样品过多,SQL语句的参数大于2100,会报错【此 RPC 请求中提供了过多的参数。最多应为 2100】// applySampleMapper.insertBatch(applySampleList);/*这是插入一条样品信息的SQL语句,用到参数29个,2100 / 29 = 72.4,所以单次最多插入72条样品信息,最好插入50条样品信息<!--批量增加受理样品--><insert id="insertBatch"><foreach collection="list" item="item">if not exists(select as_ID from ApplySampleInfoC where as_OuterApplyId = #{item.outerApplyId} and as_ApplyID = #{item.applyId} and as_SampleNo = #{item.sampleNo})insert into ApplySampleInfoC(as_OuterApplyID, as_ApplyID, as_SampleNo,as_SampleName, as_SampleType, as_YCDD, as_SCDW,as_SCDWDZ, as_BatchNo, as_TradeMark, as_Packing,as_Property, as_Specs, as_CheckCondition, as_Amount, as_Unit,as_Gerder, as_Age, as_SJRQ, as_Vocation,as_nationality, as_Ethnics, as_Marriage, as_Education,as_IdentityCard, as_Telephone, as_Address,as_IdentityAddress, as_TakeMedicineSolutions)values(#{item.outerApplyId}, #{item.applyId}, #{item.sampleNo},#{item.sampleName}, #{item.sampleType}, #{item.location}, #{item.scdwName},#{item.scdwAddress}, #{item.batchNo}, #{item.trademark}, #{item.packing},#{item.property}, #{item.specs}, #{item.condition}, #{item.amount}, #{item.unit},#{item.gender}, #{item.age}, #{item.peopleGroup}, #{item.vocation},#{item.nationality}, #{item.ethnics}, #{item.marriage}, #{item.education},#{item.identityNumber}, #{item.telephone}, #{item.residenceAddress},#{item.identityAddress}, #{item.previousMedicalHistory})</foreach></insert>*/// 批处理,拆分数据,满50条,执行批量插入if (applySampleList != null && applySampleList.size() > 50) {List<ApplySample> applySampleNewList = new ArrayList<>();// 遍历提取数据for (int i = 0; i < applySampleList.size(); i++) {applySampleNewList.add(applySampleList.get(i));// 满50条数据,提交一次if ((i + 1) % 50 == 0) {applySampleMapper.insertBatch(applySampleNewList);applySampleNewList.clear();}}// 最后一次提交if (!applySampleNewList.isEmpty()) {applySampleMapper.insertBatch(applySampleNewList);applySampleNewList.clear();}} else{ // 不够50条数据,不需要分批,直接插入// 列表有数据才进行插入,否则不执行任何操作。这样写代码才健壮if (applySampleList != null && !applySampleList.isEmpty()) {applySampleMapper.insertBatch(applySampleList);}}}

对上面代码进行优化:

// 批量增加受理样品@Overridepublic void addBatch(List<ApplySample> applySampleList) {// 如果样品过多,SQL语句的参数大于2100,会报错【此 RPC 请求中提供了过多的参数。最多应为 2100】// applySampleMapper.insertBatch(applySampleList);/*这是插入一条样品信息的SQL语句,用到参数29个,2100 / 29 = 72.4,所以单次最多插入72条样品信息,最好插入50条样品信息<!--批量增加受理样品--><insert id="insertBatch"><foreach collection="list" item="item">if not exists(select as_ID from ApplySampleInfoC where as_OuterApplyId = #{item.outerApplyId} and as_ApplyID = #{item.applyId} and as_SampleNo = #{item.sampleNo})insert into ApplySampleInfoC(as_OuterApplyID, as_ApplyID, as_SampleNo,as_SampleName, as_SampleType, as_YCDD, as_SCDW,as_SCDWDZ, as_BatchNo, as_TradeMark, as_Packing,as_Property, as_Specs, as_CheckCondition, as_Amount, as_Unit,as_Gerder, as_Age, as_SJRQ, as_Vocation,as_nationality, as_Ethnics, as_Marriage, as_Education,as_IdentityCard, as_Telephone, as_Address,as_IdentityAddress, as_TakeMedicineSolutions)values(#{item.outerApplyId}, #{item.applyId}, #{item.sampleNo},#{item.sampleName}, #{item.sampleType}, #{item.location}, #{item.scdwName},#{item.scdwAddress}, #{item.batchNo}, #{item.trademark}, #{item.packing},#{item.property}, #{item.specs}, #{item.condition}, #{item.amount}, #{item.unit},#{item.gender}, #{item.age}, #{item.peopleGroup}, #{item.vocation},#{item.nationality}, #{item.ethnics}, #{item.marriage}, #{item.education},#{item.identityNumber}, #{item.telephone}, #{item.residenceAddress},#{item.identityAddress}, #{item.previousMedicalHistory})</foreach></insert>*/// 集合不为空if (!applySampleList.isEmpty()) {// 批处理,拆分数据,满50条,执行批量插入List<List<ApplySample>> lists = splitList(applySampleList, 50);for (List<ApplySample> list: lists) {applySampleMapper.insertBatch(list);}}// 集合分割,将一个大集合分割成多个小集合,数据示例:[1,2,3,4,5,6,7] 按3个元素一组分割成 [[1,2,3],[4,5,6],[7]]public List<List<ApplySample>> splitList(List<ApplySample> list, int chunkSize) {List<List<ApplySample>> result = new ArrayList<>();for (int i = 0; i < list.size(); i += chunkSize) {int end = Math.min(i + chunkSize, list.size());result.add(list.subList(i, end));}return result;}}

对上面代码再一步优化:

1、提取集合拆分的逻辑,做成集合拆分通用工具

package com.weiyu.utils;import java.util.ArrayList;
import java.util.Collection;
import java.util.List;public class PublicUtils {/*** 集合分割,将一个大集合分割成多个小集合,数据示例:[1,2,3,4,5,6,7] 按3个元素一组分割成 [[1,2,3],[4,5,6],[7]]* @param list 集合* @param chunkSize 分割大小* @return 返回分割集合*/public static <E> Collection<List<E>> splitList(List<E> list, int chunkSize) {List<List<E>> result = new ArrayList<>();for (int i = 0; i < list.size(); i += chunkSize) {int end = Math.min(i + chunkSize, list.size());result.add(list.subList(i, end));}return result;}
}

2、使用集合拆分通用工具

// 批量增加受理样品@Overridepublic void addBatch(List<ApplySample> applySampleList) {// 如果样品过多,SQL语句的参数大于2100,会报错【此 RPC 请求中提供了过多的参数。最多应为 2100】// applySampleMapper.insertBatch(applySampleList);/*这是插入一条样品信息的SQL语句,用到参数29个,2100 / 29 = 72.4,所以单次最多插入72条样品信息,最好插入50条样品信息<!--批量增加受理样品--><insert id="insertBatch"><foreach collection="list" item="item">if not exists(select as_ID from ApplySampleInfoC where as_OuterApplyId = #{item.outerApplyId} and as_ApplyID = #{item.applyId} and as_SampleNo = #{item.sampleNo})insert into ApplySampleInfoC(as_OuterApplyID, as_ApplyID, as_SampleNo,as_SampleName, as_SampleType, as_YCDD, as_SCDW,as_SCDWDZ, as_BatchNo, as_TradeMark, as_Packing,as_Property, as_Specs, as_CheckCondition, as_Amount, as_Unit,as_Gerder, as_Age, as_SJRQ, as_Vocation,as_nationality, as_Ethnics, as_Marriage, as_Education,as_IdentityCard, as_Telephone, as_Address,as_IdentityAddress, as_TakeMedicineSolutions)values(#{item.outerApplyId}, #{item.applyId}, #{item.sampleNo},#{item.sampleName}, #{item.sampleType}, #{item.location}, #{item.scdwName},#{item.scdwAddress}, #{item.batchNo}, #{item.trademark}, #{item.packing},#{item.property}, #{item.specs}, #{item.condition}, #{item.amount}, #{item.unit},#{item.gender}, #{item.age}, #{item.peopleGroup}, #{item.vocation},#{item.nationality}, #{item.ethnics}, #{item.marriage}, #{item.education},#{item.identityNumber}, #{item.telephone}, #{item.residenceAddress},#{item.identityAddress}, #{item.previousMedicalHistory})</foreach></insert>*/// 集合不为空if (!applySampleList.isEmpty()) {// 批处理,拆分数据,满50条,执行批量插入List<List<ApplySample>> lists = (List<List<ApplySample>>)PublicUtils.splitList(applySampleList, 50);for (List<ApplySample> list: lists) {applySampleMapper.insertBatch(list);}}}

http://www.dtcms.com/wzjs/105523.html

相关文章:

  • php 做网站免费网站可以下载
  • 企业网站优化公司免费推广方法
  • 泉州网站建设报价徐州seo代理计费
  • 永川区网站建设咨询海外市场推广策略
  • 超市型网站开发网络推广员的工作内容
  • 自己做淘宝返利网站吗宁波网站推广方案
  • 菏泽网站建设哪家好十大搜索引擎网站
  • 网站开发+.net+开源搜索引擎营销的概念
  • 公司建设一个网站需要多少钱网页制作用什么软件做
  • 如何做的网站排第一新闻最新消息今天
  • 小说网站建设需要什么站长工具seo综合
  • asp网站知道用户名是admin口碑营销的优势有哪些
  • 网站内容架构整站优化系统厂家
  • 深圳搜豹网站建设公司15个常见关键词
  • 网站建设管理软件网页设计制作教程
  • 成都学校网站制作免费域名服务器
  • 增城住房和建设局网站北京做网页的公司
  • wordpress清新文艺主题游戏优化
  • 提供手机自适应网站建设维护网络推广网络营销和网站推广的区别
  • 做网站标题seo与网络推广的区别和联系
  • 宽屏网站设计自助建站网站哪个好
  • 如何做微信个人网站网站维护需要多长时间
  • 郑州平台类网站电工培训技术学校
  • 免费mac做ppt模板下载网站怎样建立网站平台
  • 专业网站建设哪家更好网络媒体推广报价
  • 网站建设方案总结语痘痘怎么去除效果好
  • 哪些网站做魔兽地图关键词推广优化
  • 搞网站开发的程序员属于哪一类百度关键词搜索热度查询
  • 公司网站模板中英文舆情网站入口
  • 企业网站流量seo网站优化培训多少价格