| | |
| | | package com.ruoyi.production.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | public class ProductMaterialSkuServiceImpl |
| | | extends ServiceImpl<ProductMaterialSkuMapper, ProductMaterialSku> |
| | | implements ProductMaterialSkuService { |
| | | public class ProductMaterialSkuServiceImpl extends ServiceImpl<ProductMaterialSkuMapper, ProductMaterialSku> implements ProductMaterialSkuService { |
| | | |
| | | @Autowired |
| | | private ProductMaterialMapper productMaterialMapper; |
| | |
| | | * 查询物料规格列表 |
| | | */ |
| | | @Override |
| | | public List<ProductMaterialSkuDto> productMaterialSkuList(Long materialId) { |
| | | |
| | | if (materialId == null) { |
| | | return Collections.emptyList(); |
| | | } |
| | | |
| | | LambdaQueryWrapper<ProductMaterialSku> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(ProductMaterialSku::getMaterialId, materialId) |
| | | .orderByAsc(ProductMaterialSku::getId); |
| | | List<ProductMaterialSku> skuList = this.list(queryWrapper); |
| | | if (skuList == null || skuList.isEmpty()) { |
| | | return Collections.emptyList(); |
| | | } |
| | | // 查询物料信息 |
| | | ProductMaterial material = productMaterialMapper.selectById(materialId); |
| | | |
| | | String materialName = material != null ? material.getMaterialName() : null; |
| | | String baseUnit = material != null ? material.getBaseUnit() : null; |
| | | List<ProductMaterialSkuDto> result = new ArrayList<>(skuList.size()); |
| | | for (ProductMaterialSku sku : skuList) { |
| | | ProductMaterialSkuDto dto = new ProductMaterialSkuDto(); |
| | | dto.setMaterialId(materialId); |
| | | dto.setMaterialName(materialName); |
| | | dto.setBaseUnit(baseUnit); |
| | | dto.setSkuId(sku.getId()); |
| | | dto.setSpecification(sku.getSpecification()); |
| | | dto.setSupplyType(sku.getSupplyType()); |
| | | result.add(dto); |
| | | } |
| | | |
| | | return result; |
| | | public Page<ProductMaterialSkuDto> productMaterialSkuList(Page<ProductMaterialSkuDto> page, ProductMaterialSkuDto dto, Integer type) { |
| | | return baseMapper.selectSkuWithMaterialPage(page, dto, type); |
| | | } |
| | | |
| | | /** |