1-pbom-工作表查询问题-2
This commit is contained in:
parent
9886397891
commit
04a36e33cb
|
|
@ -139,7 +139,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(materialNo)) {
|
if (StrUtil.isNotBlank(materialNo)) {
|
||||||
List<String> parentMaterialByMaterialNo = new ArrayList<>(getParentMaterialByMaterialNo(materialNo));
|
List<String> parentMaterialByMaterialNo = new ArrayList<>(getParentMaterialByMaterialNo(materialNo));
|
||||||
|
|
||||||
parentMaterialByMaterialNo.add(materialNo);
|
parentMaterialByMaterialNo.add(materialNo);
|
||||||
if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) {
|
if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) {
|
||||||
String queryFac= StrUtil.isBlank(query.getFacCode())? userRoleService.getUserFactory():query.getFacCode();
|
String queryFac= StrUtil.isBlank(query.getFacCode())? userRoleService.getUserFactory():query.getFacCode();
|
||||||
|
|
@ -202,15 +203,26 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
||||||
*/
|
*/
|
||||||
public void getGetParentMaterialByMaterialNoNew(Set<String> parentNoResult, Set<String> materialNos){
|
public void getGetParentMaterialByMaterialNoNew(Set<String> parentNoResult, Set<String> materialNos){
|
||||||
|
|
||||||
|
Set<String> relParentNoSet= getParent(parentNoResult,materialNos);
|
||||||
|
|
||||||
|
while (CollUtil.isNotEmpty(relParentNoSet)){
|
||||||
|
|
||||||
|
relParentNoSet= getParent(parentNoResult , relParentNoSet);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Set<String> getParent(Set<String> parentNoResult, Set<String> materialNos){
|
||||||
|
|
||||||
List<BomNewPbomChildEntity> childList = pbomChildService.lambdaQuery().in(BomNewPbomChildEntity::getMaterialNo, materialNos).select(BomNewPbomChildEntity::getParentRowId).list();
|
List<BomNewPbomChildEntity> childList = pbomChildService.lambdaQuery().in(BomNewPbomChildEntity::getMaterialNo, materialNos).select(BomNewPbomChildEntity::getParentRowId).list();
|
||||||
|
parentNoResult.addAll(materialNos);
|
||||||
|
if(CollUtil.isEmpty(childList)){
|
||||||
|
return new HashSet<>();
|
||||||
|
}
|
||||||
List<Long> parentRowIdList = childList.stream().map(u -> u.getParentRowId()).collect(Collectors.toList());
|
List<Long> parentRowIdList = childList.stream().map(u -> u.getParentRowId()).collect(Collectors.toList());
|
||||||
List<BomNewPbomParentEntity> parentList = this.lambdaQuery().in(BomNewPbomParentEntity::getRowId, parentRowIdList).select(BomNewPbomParentEntity::getMaterialNo).list();
|
List<BomNewPbomParentEntity> parentList = this.lambdaQuery().in(BomNewPbomParentEntity::getRowId, parentRowIdList).select(BomNewPbomParentEntity::getMaterialNo).list();
|
||||||
Set<String> parentNoSet = parentList.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
Set<String> parentNoSet = parentList.stream().map(u -> u.getMaterialNo()).collect(Collectors.toSet());
|
||||||
Set<String> relParentNoSet= Sets.difference(parentNoSet,parentNoResult);
|
|
||||||
parentNoResult.addAll(materialNos);
|
return Sets.difference(parentNoSet,parentNoResult);
|
||||||
while (CollUtil.isNotEmpty(relParentNoSet)){
|
|
||||||
getGetParentMaterialByMaterialNoNew(parentNoResult, relParentNoSet);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue