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; private String projectId;
@Schema(description = "当前选择的用例Id", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "当前选择的用例Id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{case_review.case_id.not_blank}")
private String caseId; private String caseId;
} }

View File

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