fix(性能测试): 修复性能测试批量删除时没有把查询条件带上的问题

--bug=1012991 --user=刘瑞斌 性能测试报告高级搜索后,批量删除全部,会将所的报告全部删除 https://www.tapd.cn/55049933/s/1153361
This commit is contained in:
CaptainB 2022-05-06 14:24:26 +08:00 committed by 刘瑞斌
parent 8c56658661
commit d36090178c
3 changed files with 5 additions and 7 deletions

View File

@ -1,6 +1,5 @@
package io.metersphere.performance.controller.request;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseConditions;
import lombok.Data;
import java.util.List;
@ -9,5 +8,5 @@ import java.util.List;
public class DeleteReportRequest {
private List<String> ids;
private String projectId;
private TestPlanFuncCaseConditions condition;
private ReportRequest condition;
}

View File

@ -1,5 +1,6 @@
package io.metersphere.performance.controller.request;
import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.controller.request.OrderRequest;
import lombok.Getter;
import lombok.Setter;
@ -9,7 +10,7 @@ import java.util.Map;
@Getter
@Setter
public class ReportRequest {
public class ReportRequest extends BaseQueryRequest {
private String name;
private String workspaceId;
private String testId;

View File

@ -384,15 +384,13 @@ public class PerformanceReportService {
public void deleteReportBatch(DeleteReportRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> getLoadTestReportIds(request.getProjectId()));
(query) -> getLoadTestReportIds(request.getCondition()));
List<String> ids = request.getIds();
ids.forEach(this::deleteReport);
}
private List<String> getLoadTestReportIds(String projectId) {
ReportRequest request = new ReportRequest();
request.setProjectId(projectId);
private List<String> getLoadTestReportIds(ReportRequest request) {
return this.getReportList(request).stream().map(LoadTestReport::getId).collect(Collectors.toList());
}