| | |
| | | |
| | | for (ProductMaterialSku sku : list) { |
| | | |
| | | ProductMaterialSku exist = |
| | | productMaterialSkuService.getOne(new LambdaQueryWrapper<ProductMaterialSku>() |
| | | .eq(ProductMaterialSku::getMaterialId, sku.getMaterialId()) |
| | | .eq(ProductMaterialSku::getSpecification, sku.getSpecification())); |
| | | LambdaQueryWrapper<ProductMaterialSku> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(ProductMaterialSku::getMaterialId, sku.getMaterialId()) |
| | | .eq(ProductMaterialSku::getSpecification, sku.getSpecification()); |
| | | |
| | | if (StringUtils.isNotEmpty(sku.getMaterialCode())) { |
| | | wrapper.eq(ProductMaterialSku::getMaterialCode, sku.getMaterialCode()); |
| | | } else { |
| | | wrapper.isNull(ProductMaterialSku::getMaterialCode); |
| | | } |
| | | |
| | | ProductMaterialSku exist = productMaterialSkuService.getOne(wrapper); |
| | | if (exist == null) { |
| | | productMaterialSkuService.save(sku); |
| | | affected++; |