批量插入

This commit is contained in:
2025-11-28 18:08:12 +08:00
parent e80bf9a39e
commit 403c872ee3
12 changed files with 22 additions and 27 deletions

View File

@@ -121,7 +121,7 @@
consInfo.setStockNumber(consStockFlow.getAfterNumber());
updateStockList.add(consInfo);
}
super.saveBatch(insertList);
mapper.insertBatchSelective(insertList, 50);
for (ConsInfo consInfo : updateStockList) {
consInfoMapper.update(consInfo);
}
@@ -158,7 +158,7 @@
consInfo.setStockNumber(entity.getAfterNumber());
updateStockList.add(consInfo);
}
super.saveBatch(insertList);
mapper.insertBatchSelective(insertList, 50);
for (ConsInfo consInfo : updateStockList) {
consInfoMapper.update(consInfo);
}

View File

@@ -36,7 +36,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
private QueryWrapper buildQueryWrapper(ProdConsRelationDTO param) {
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
queryWrapper.eq(ProdConsRelation::getShopId, shopId);
return queryWrapper;
}
@@ -50,7 +50,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
@Override
@Transactional(rollbackFor = Exception.class)
public void saveProdConsRelation(ProdConsBindDTO dto) {
Long shopId = StpKit.USER.getShopId(0L);
Long shopId = StpKit.USER.getShopId();
long count = productMapper.selectCountByQuery(query().eq(Product::getShopId, shopId).eq(Product::getId, dto.getId()));
if (count == 0) {
throw new CzgException("商品不存在");
@@ -72,7 +72,7 @@ public class ProdConsRelationServiceImpl extends ServiceImpl<ProdConsRelationMap
throw new CzgException("非法操作,绑定关系商品不一致");
}
List<ProdConsRelation> entityList = BeanUtil.copyToList(consList, ProdConsRelation.class);
super.saveBatch(entityList);
mapper.insertBatchSelective(entityList, 50);
}
}

View File

@@ -733,7 +733,7 @@ public class ShopSyncServiceImpl implements ShopSyncService {
}
}
if (CollUtil.isNotEmpty(addList)) {
prodGroupRelationService.saveBatch(addList, 100);
prodGroupRelationService.getMapper().insertBatchSelective(addList, 100);
}
if (CollUtil.isNotEmpty(upList)) {
prodGroupRelationService.updateBatch(addList, 100);

View File

@@ -157,7 +157,7 @@ public class ShopVendorServiceImpl extends ServiceImpl<ShopVendorMapper, ShopVen
throw new CzgException("批量付款应全部付款");
}
consPayRecordService.saveBatch(records);
consPayRecordService.getMapper().insertBatchSelective(records, 50);
return consStockFlowService.updateBatch(stockFlows);
}else {
ConsStockFlow stockFlow = consStockFlowMapper.selectOneByQuery(new QueryWrapper().eq(ConsStockFlow::getShopId, shopId).eq(ConsStockFlow::getId, payDTO.getFlowIdList().getFirst()));