原始写法

在这里插入图片描述

sql批量插入

在这里插入图片描述
报错:
An I/O error occurred while sending to the backend.

解决办法

	//递归插入
	public void add (List<CarTrajectoryInfo> all,long start,long limit){
		//截取 从start开始截取 截取limit条
		List<CarTrajectoryInfo> collect = all.stream().skip(start).limit(limit).collect(Collectors.toList());
		if(CollUtil.isEmpty(collect)){
			return;
		}
		//批量插入数据的方法
		//保存车辆轨迹数据
		carTrajectoryInfoMapper.addCarTrajectoryInfoList(collect, sRid);
		//递归 每次插入limit条数据
		add(all,start+limit,limit);
	}
add(carTrajectoryInfoList,0L,1500L); //放到上面if (carTrajectoryInfoList.size() > 0)判断里面

在这里插入图片描述
在这里插入图片描述

Logo

一站式 AI 云服务平台

更多推荐