|
|
|
@ -779,13 +779,46 @@ public class BomManagementServiceImpl extends ServiceImpl<BomManagementMapper, B |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public PageUtils queryPartListAll(ComponentPartData data) { |
|
|
|
String[] descs = data.getPartDesc().split("@"); |
|
|
|
// Null-safe partDesc handling and extraction of potential embedded familyName after '&' |
|
|
|
String partDesc = StringUtils.defaultString(data.getPartDesc()); |
|
|
|
String originalFamilyName = data.getFamilyName(); |
|
|
|
|
|
|
|
// Collect candidate family names (original + one parsed from partDesc if present) |
|
|
|
Set<String> candidateFamilyNames = new LinkedHashSet<>(); |
|
|
|
if (StringUtils.isNotBlank(originalFamilyName)) { |
|
|
|
candidateFamilyNames.add(originalFamilyName); |
|
|
|
} |
|
|
|
String[] descs = partDesc.split("&"); |
|
|
|
if (descs.length > 1) { |
|
|
|
// First segment becomes the cleaned partDesc; second treated as an alternate familyName |
|
|
|
data.setPartDesc(descs[0]); |
|
|
|
data.setFamilyName(descs[1]); |
|
|
|
List<String> familyIDs = partFamilyInformationMapper.queryFamilyIDs(data); |
|
|
|
data.setFamilyIDs(familyIDs); |
|
|
|
String parsedFamilyName = descs[1]; |
|
|
|
if (StringUtils.isNotBlank(parsedFamilyName)) { |
|
|
|
candidateFamilyNames.add(parsedFamilyName); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Query all family IDs for collected family names |
|
|
|
Set<String> familyIDs = new LinkedHashSet<>(); |
|
|
|
for (String familyName : candidateFamilyNames) { |
|
|
|
data.setFamilyName(familyName); // use as query condition |
|
|
|
familyIDs.addAll(partFamilyInformationMapper.queryFamilyIDs(data)); |
|
|
|
} |
|
|
|
// Restore original familyName to avoid leaving mutated last iteration value |
|
|
|
data.setFamilyName(originalFamilyName); |
|
|
|
|
|
|
|
// Set filtered familyIDs into data (respect explicit single familyID if provided and valid) |
|
|
|
if (!familyIDs.isEmpty()) { |
|
|
|
if (StringUtils.isNotBlank(data.getFamilyID()) && familyIDs.contains(data.getFamilyID())) { |
|
|
|
data.setFamilyIDs(Collections.singletonList(data.getFamilyID())); |
|
|
|
} else { |
|
|
|
data.setFamilyIDs(new ArrayList<>(familyIDs)); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// If none found, ensure empty list instead of null for downstream safety |
|
|
|
data.setFamilyIDs(Collections.emptyList()); |
|
|
|
} |
|
|
|
|
|
|
|
IPage<BomAllFieldEntity> list = this.bomManagementMapper.queryPartListAll(new Page<ComponentPartData>(data.getPage(), data.getLimit()), data); |
|
|
|
return new PageUtils(list); |
|
|
|
} |
|
|
|
|