| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.ruoyi.framework.config.AliDingConfig; |
| | | import com.ruoyi.production.dto.ProductMaterialGroupDto; |
| | | import com.ruoyi.production.enums.MaterialConfigTypeEnum; |
| | | import com.ruoyi.production.mapper.ProductMaterialMapper; |
| | | import com.ruoyi.production.pojo.ProductMaterial; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, List<ProductMaterial>> ProductMaterialList(String materialName) { |
| | | public List<ProductMaterialGroupDto> ProductMaterialList(String materialName) { |
| | | |
| | | List<ProductMaterialConfig> materialConfigList = |
| | | productMaterialConfigService.list(new LambdaQueryWrapper<ProductMaterialConfig>() |
| | | .eq(ProductMaterialConfig::getConfigType, MaterialConfigTypeEnum.MATERIAL_TYPE.name())); |
| | | List<ProductMaterialConfig> materialConfigList = productMaterialConfigService.list(new LambdaQueryWrapper<ProductMaterialConfig>() |
| | | .eq(ProductMaterialConfig::getConfigType, MaterialConfigTypeEnum.MATERIAL_TYPE.name())); |
| | | |
| | | Map<String, List<ProductMaterial>> productMaterialMap = new HashMap<>(); |
| | | List<ProductMaterialGroupDto> productMaterialMap = new ArrayList<>(); |
| | | if (materialConfigList == null || materialConfigList.isEmpty()) { |
| | | return productMaterialMap; |
| | | } |
| | | for (ProductMaterialConfig materialConfig : materialConfigList) { |
| | | LambdaQueryWrapper<ProductMaterial> wrapper = new LambdaQueryWrapper<>(); |
| | | wrapper.eq(ProductMaterial::getMaterialTypeId, materialConfig.getId()) |
| | | .select(ProductMaterial::getId, ProductMaterial::getMaterialName) |
| | | .like(materialName != null && !materialName.isEmpty(), ProductMaterial::getMaterialName, materialName); |
| | | |
| | | List<ProductMaterial> productMaterialList = list(wrapper); |
| | | |
| | | if (productMaterialList != null && !productMaterialList.isEmpty()) { |
| | | productMaterialMap.put(materialConfig.getConfigName(), productMaterialList); |
| | | } |
| | | ProductMaterialGroupDto dto = new ProductMaterialGroupDto(); |
| | | dto.setConfigId(materialConfig.getId()); |
| | | dto.setConfigName(materialConfig.getConfigName()); |
| | | dto.setMaterialList(productMaterialList); |
| | | productMaterialMap.add(dto); |
| | | } |
| | | |
| | | return productMaterialMap; |
| | | } |
| | | |