fix(用例管理): 修改批量关联需求不需要disable问题

This commit is contained in:
guoyuqi 2024-09-09 18:56:18 +08:00 committed by Craftsman
parent bf74d8d882
commit 5843371237
2 changed files with 13 additions and 9 deletions

View File

@ -14,7 +14,6 @@ public class FunctionalThirdDemandPageRequest extends BasePageRequest {
private String projectId;
@Schema(description = "当前选择的用例Id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{case_review.case_id.not_blank}")
private String caseId;
}

View File

@ -350,7 +350,10 @@ public class FunctionalCaseDemandService {
public PluginPager<PlatformDemandDTO> pageDemand(FunctionalThirdDemandPageRequest request) {
String platformId = projectApplicationService.getDemandPlatformId(request.getProjectId());
List<String> demandIds = extFunctionalCaseDemandMapper.selectDemandIdsByCaseId(request.getCaseId(), platformId);
List<String> demandIds = new ArrayList<>();
if (StringUtils.isNotBlank(request.getCaseId())) {
demandIds = extFunctionalCaseDemandMapper.selectDemandIdsByCaseId(request.getCaseId(), platformId);
}
DemandPageRequest demandPageRequest = new DemandPageRequest();
demandPageRequest.setQuery(StringUtils.replace(request.getKeyword(), "\\", ""));
demandPageRequest.setFilter(request.getFilter());
@ -359,15 +362,17 @@ public class FunctionalCaseDemandService {
demandPageRequest.setProjectConfig(projectApplicationService.getProjectDemandThirdPartConfig(request.getProjectId()));
Platform platform = projectApplicationService.getPlatform(request.getProjectId(), false);
PluginPager<PlatformDemandDTO> platformDemandDTOPluginPager = platform.pageDemand(demandPageRequest);
PlatformDemandDTO data = platformDemandDTOPluginPager.getData();
List<PlatformDemandDTO.Demand> list = data.getList();
for (PlatformDemandDTO.Demand demand : list) {
if (demandIds.contains(demand.getDemandId())) {
demand.setDisabled(true);
if (CollectionUtils.isNotEmpty(demandIds)) {
PlatformDemandDTO data = platformDemandDTOPluginPager.getData();
List<PlatformDemandDTO.Demand> list = data.getList();
for (PlatformDemandDTO.Demand demand : list) {
if (demandIds.contains(demand.getDemandId())) {
demand.setDisabled(true);
}
}
data.setList(list);
platformDemandDTOPluginPager.setData(data);
}
data.setList(list);
platformDemandDTOPluginPager.setData(data);
return platformDemandDTOPluginPager;
}
}