| | |
| | | |
| | | List<Device> deviceList = response.getList(); |
| | | |
| | | // 清空id,让数据库自动生成 |
| | | deviceList.forEach(d -> d.setId(null)); |
| | | |
| | | List<String> uidList = deviceList.stream().map(Device::getDevNo).collect(Collectors.toList()); |
| | | |
| | | LambdaUpdateWrapper<Device> wrapper = new LambdaUpdateWrapper<>(); |
| | | wrapper.in(Device::getDevNo, uidList); |
| | | deviceService.remove(wrapper); |
| | | return deviceService.saveOrUpdateBatch(deviceList); |
| | | |
| | | // SQL Server 批量插入兼容性问题,改用逐条插入 |
| | | for (Device device : deviceList) { |
| | | deviceService.save(device); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | //为我复制一份这个方法出来,把用到的DEVICE_STATUS实体类改为DEVICE_STATUS_BYCL,MES_NUMERICAL实体改为MES_NUMERICAL_BYCL,其他的逻辑不变并给我注释 |