| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.production.dto.ProductStructureDto; |
| | | import com.ruoyi.production.mapper.ProductStructureMapper; |
| | | import com.ruoyi.production.pojo.ProductStructure; |
| | |
| | | // 真实的父节点 ID |
| | | Long realParentId; |
| | | for (ProductStructureDto psDto : flatDtoList) { |
| | | if (psDto.getId() == null && psDto.getParentTempId() != null) { |
| | | if (psDto.getId() == null && StringUtils.isNotEmpty(psDto.getParentTempId())) { |
| | | ProductStructure child = tempEntityMap.get(psDto.getTempId()); |
| | | if (tempEntityMap.containsKey(psDto.getParentTempId())) { |
| | | // 父节点是新节点 |
| | |
| | | return tree; |
| | | } |
| | | |
| | | @Override |
| | | public List<ProductStructureDto> listDetailBybomId(Integer bomId) { |
| | | List<ProductStructureDto> list = productStructureMapper.listBybomId(bomId); |
| | | Map<String, ProductStructureDto> distinctMap = new LinkedHashMap<>(); |
| | | for (ProductStructureDto dto : list) { |
| | | if (dto.getParentId() == null || dto.getParentId() == 0) { |
| | | continue; |
| | | } |
| | | String key = dto.getProcessId() == null ? "NULL_PROCESS_" + dto.getId() : String.valueOf(dto.getProcessId()); |
| | | distinctMap.putIfAbsent(key, dto); |
| | | } |
| | | return new ArrayList<>(distinctMap.values()); |
| | | } |
| | | |
| | | } |