UPDATE: 优化可选标准设备接口

This commit is contained in:
贾同学
2025-09-04 15:59:03 +08:00
parent b09438e29d
commit 7c18d0038a

View File

@@ -309,8 +309,10 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
@Override
public List<PqStandardDev> canBindingList() {
List<String> excludeStandardDevIds = new ArrayList<>();
// 获取所有已绑定的标准设备
List<AdPlanStandardDev> boundList = adPlanStandardDevService.list();
if (CollectionUtil.isNotEmpty(boundList)) {
// 获取对应检测计划
List<String> planIds = boundList.stream().map(AdPlanStandardDev::getPlanId).collect(Collectors.toList());
IAdPlanService adPlanService = SpringUtil.getBean(IAdPlanService.class);
@@ -319,7 +321,7 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
List<AdPlan> mainPlanList = planList.stream().filter(plan -> plan.getFatherPlanId() == null).collect(Collectors.toList());
List<AdPlan> subPlanList = planList.stream().filter(plan -> plan.getFatherPlanId() != null).collect(Collectors.toList());
List<String> excludePlanIds = new ArrayList<>();
List<String> excludeStandardDevIds = new ArrayList<>();
// 主计划直接排除
if (CollectionUtil.isNotEmpty(mainPlanList)) {
List<String> excludeMainPlanIds = mainPlanList.stream().filter(plan -> plan.getTestState() != 2).map(plan -> plan.getId()).collect(Collectors.toList());
@@ -343,6 +345,8 @@ public class PqStandardDevServiceImpl extends ServiceImpl<PqStandardDevMapper, P
.collect(Collectors.toList());
excludeStandardDevIds = excludeBoundList.stream().map(AdPlanStandardDev::getStandardDevId).collect(Collectors.toList());
}
}
return this.lambdaQuery()
.eq(PqStandardDev::getState, DataStateEnum.ENABLE.getCode())
.notIn(CollectionUtil.isNotEmpty(excludeStandardDevIds), PqStandardDev::getId, excludeStandardDevIds)