feat(测试计划): 聚合报告生成功能

This commit is contained in:
song-cc-rock 2024-06-13 16:47:07 +08:00 committed by 刘瑞斌
parent 7dc0598cc7
commit 275b63a1be
22 changed files with 1075 additions and 237 deletions

View File

@ -24,6 +24,14 @@ public class TestPlanReportApiCase implements Serializable {
@Size(min = 1, max = 50, message = "{test_plan_report_api_case.test_plan_report_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanReportId;
@Schema(description = "测试集ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_api_case.test_plan_collection_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_api_case.test_plan_collection_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanCollectionId;
@Schema(description = "环境ID")
private String environmentId;
@Schema(description = "测试计划接口用例关联ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_api_case.test_plan_api_case_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_api_case.test_plan_api_case_id.length_range}", groups = {Created.class, Updated.class})
@ -52,16 +60,19 @@ public class TestPlanReportApiCase implements Serializable {
@Schema(description = "接口用例执行人")
private String apiCaseExecuteUser;
@Schema(description = "接口用例执行结果", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_api_case.api_case_execute_result.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_api_case.api_case_execute_result.length_range}", groups = {Created.class, Updated.class})
@Schema(description = "接口用例执行结果")
private String apiCaseExecuteResult;
@Schema(description = "接口用例执行报告ID")
private String apiCaseExecuteReportId;
private static final long serialVersionUID = 1L;
public enum Column {
id("id", "id", "VARCHAR", false),
testPlanReportId("test_plan_report_id", "testPlanReportId", "VARCHAR", false),
testPlanCollectionId("test_plan_collection_id", "testPlanCollectionId", "VARCHAR", false),
environmentId("environment_id", "environmentId", "VARCHAR", false),
testPlanApiCaseId("test_plan_api_case_id", "testPlanApiCaseId", "VARCHAR", false),
apiCaseId("api_case_id", "apiCaseId", "VARCHAR", false),
apiCaseNum("api_case_num", "apiCaseNum", "BIGINT", false),
@ -69,7 +80,8 @@ public class TestPlanReportApiCase implements Serializable {
apiCaseModule("api_case_module", "apiCaseModule", "VARCHAR", false),
apiCasePriority("api_case_priority", "apiCasePriority", "VARCHAR", false),
apiCaseExecuteUser("api_case_execute_user", "apiCaseExecuteUser", "VARCHAR", false),
apiCaseExecuteResult("api_case_execute_result", "apiCaseExecuteResult", "VARCHAR", false);
apiCaseExecuteResult("api_case_execute_result", "apiCaseExecuteResult", "VARCHAR", false),
apiCaseExecuteReportId("api_case_execute_report_id", "apiCaseExecuteReportId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -244,6 +244,146 @@ public class TestPlanReportApiCaseExample {
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIsNull() {
addCriterion("test_plan_collection_id is null");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIsNotNull() {
addCriterion("test_plan_collection_id is not null");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdEqualTo(String value) {
addCriterion("test_plan_collection_id =", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotEqualTo(String value) {
addCriterion("test_plan_collection_id <>", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdGreaterThan(String value) {
addCriterion("test_plan_collection_id >", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_collection_id >=", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLessThan(String value) {
addCriterion("test_plan_collection_id <", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLessThanOrEqualTo(String value) {
addCriterion("test_plan_collection_id <=", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLike(String value) {
addCriterion("test_plan_collection_id like", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotLike(String value) {
addCriterion("test_plan_collection_id not like", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIn(List<String> values) {
addCriterion("test_plan_collection_id in", values, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotIn(List<String> values) {
addCriterion("test_plan_collection_id not in", values, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdBetween(String value1, String value2) {
addCriterion("test_plan_collection_id between", value1, value2, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotBetween(String value1, String value2) {
addCriterion("test_plan_collection_id not between", value1, value2, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andEnvironmentIdIsNull() {
addCriterion("environment_id is null");
return (Criteria) this;
}
public Criteria andEnvironmentIdIsNotNull() {
addCriterion("environment_id is not null");
return (Criteria) this;
}
public Criteria andEnvironmentIdEqualTo(String value) {
addCriterion("environment_id =", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotEqualTo(String value) {
addCriterion("environment_id <>", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdGreaterThan(String value) {
addCriterion("environment_id >", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdGreaterThanOrEqualTo(String value) {
addCriterion("environment_id >=", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLessThan(String value) {
addCriterion("environment_id <", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLessThanOrEqualTo(String value) {
addCriterion("environment_id <=", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLike(String value) {
addCriterion("environment_id like", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotLike(String value) {
addCriterion("environment_id not like", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdIn(List<String> values) {
addCriterion("environment_id in", values, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotIn(List<String> values) {
addCriterion("environment_id not in", values, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdBetween(String value1, String value2) {
addCriterion("environment_id between", value1, value2, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotBetween(String value1, String value2) {
addCriterion("environment_id not between", value1, value2, "environmentId");
return (Criteria) this;
}
public Criteria andTestPlanApiCaseIdIsNull() {
addCriterion("test_plan_api_case_id is null");
return (Criteria) this;
@ -793,6 +933,76 @@ public class TestPlanReportApiCaseExample {
addCriterion("api_case_execute_result not between", value1, value2, "apiCaseExecuteResult");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdIsNull() {
addCriterion("api_case_execute_report_id is null");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdIsNotNull() {
addCriterion("api_case_execute_report_id is not null");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdEqualTo(String value) {
addCriterion("api_case_execute_report_id =", value, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdNotEqualTo(String value) {
addCriterion("api_case_execute_report_id <>", value, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdGreaterThan(String value) {
addCriterion("api_case_execute_report_id >", value, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdGreaterThanOrEqualTo(String value) {
addCriterion("api_case_execute_report_id >=", value, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdLessThan(String value) {
addCriterion("api_case_execute_report_id <", value, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdLessThanOrEqualTo(String value) {
addCriterion("api_case_execute_report_id <=", value, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdLike(String value) {
addCriterion("api_case_execute_report_id like", value, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdNotLike(String value) {
addCriterion("api_case_execute_report_id not like", value, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdIn(List<String> values) {
addCriterion("api_case_execute_report_id in", values, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdNotIn(List<String> values) {
addCriterion("api_case_execute_report_id not in", values, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdBetween(String value1, String value2) {
addCriterion("api_case_execute_report_id between", value1, value2, "apiCaseExecuteReportId");
return (Criteria) this;
}
public Criteria andApiCaseExecuteReportIdNotBetween(String value1, String value2) {
addCriterion("api_case_execute_report_id not between", value1, value2, "apiCaseExecuteReportId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -24,6 +24,17 @@ public class TestPlanReportApiScenario implements Serializable {
@Size(min = 1, max = 50, message = "{test_plan_report_api_scenario.test_plan_report_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanReportId;
@Schema(description = "测试集ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_api_scenario.test_plan_collection_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_api_scenario.test_plan_collection_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanCollectionId;
@Schema(description = "是否环境组")
private Boolean grouped;
@Schema(description = "环境ID")
private String environmentId;
@Schema(description = "测试计划场景用例关联ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_api_scenario.test_plan_api_scenario_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_api_scenario.test_plan_api_scenario_id.length_range}", groups = {Created.class, Updated.class})
@ -52,16 +63,20 @@ public class TestPlanReportApiScenario implements Serializable {
@Schema(description = "场景用例执行人")
private String apiScenarioExecuteUser;
@Schema(description = "场景用例执行结果", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_api_scenario.api_scenario_execute_result.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_api_scenario.api_scenario_execute_result.length_range}", groups = {Created.class, Updated.class})
@Schema(description = "场景用例执行结果")
private String apiScenarioExecuteResult;
@Schema(description = "场景用例执行报告ID")
private String apiScenarioExecuteReportId;
private static final long serialVersionUID = 1L;
public enum Column {
id("id", "id", "VARCHAR", false),
testPlanReportId("test_plan_report_id", "testPlanReportId", "VARCHAR", false),
testPlanCollectionId("test_plan_collection_id", "testPlanCollectionId", "VARCHAR", false),
grouped("grouped", "grouped", "BIT", false),
environmentId("environment_id", "environmentId", "VARCHAR", false),
testPlanApiScenarioId("test_plan_api_scenario_id", "testPlanApiScenarioId", "VARCHAR", false),
apiScenarioId("api_scenario_id", "apiScenarioId", "VARCHAR", false),
apiScenarioNum("api_scenario_num", "apiScenarioNum", "BIGINT", false),
@ -69,7 +84,8 @@ public class TestPlanReportApiScenario implements Serializable {
apiScenarioModule("api_scenario_module", "apiScenarioModule", "VARCHAR", false),
apiScenarioPriority("api_scenario_priority", "apiScenarioPriority", "VARCHAR", false),
apiScenarioExecuteUser("api_scenario_execute_user", "apiScenarioExecuteUser", "VARCHAR", false),
apiScenarioExecuteResult("api_scenario_execute_result", "apiScenarioExecuteResult", "VARCHAR", false);
apiScenarioExecuteResult("api_scenario_execute_result", "apiScenarioExecuteResult", "VARCHAR", false),
apiScenarioExecuteReportId("api_scenario_execute_report_id", "apiScenarioExecuteReportId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -244,6 +244,206 @@ public class TestPlanReportApiScenarioExample {
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIsNull() {
addCriterion("test_plan_collection_id is null");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIsNotNull() {
addCriterion("test_plan_collection_id is not null");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdEqualTo(String value) {
addCriterion("test_plan_collection_id =", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotEqualTo(String value) {
addCriterion("test_plan_collection_id <>", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdGreaterThan(String value) {
addCriterion("test_plan_collection_id >", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_collection_id >=", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLessThan(String value) {
addCriterion("test_plan_collection_id <", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLessThanOrEqualTo(String value) {
addCriterion("test_plan_collection_id <=", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLike(String value) {
addCriterion("test_plan_collection_id like", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotLike(String value) {
addCriterion("test_plan_collection_id not like", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIn(List<String> values) {
addCriterion("test_plan_collection_id in", values, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotIn(List<String> values) {
addCriterion("test_plan_collection_id not in", values, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdBetween(String value1, String value2) {
addCriterion("test_plan_collection_id between", value1, value2, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotBetween(String value1, String value2) {
addCriterion("test_plan_collection_id not between", value1, value2, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andGroupedIsNull() {
addCriterion("grouped is null");
return (Criteria) this;
}
public Criteria andGroupedIsNotNull() {
addCriterion("grouped is not null");
return (Criteria) this;
}
public Criteria andGroupedEqualTo(Boolean value) {
addCriterion("grouped =", value, "grouped");
return (Criteria) this;
}
public Criteria andGroupedNotEqualTo(Boolean value) {
addCriterion("grouped <>", value, "grouped");
return (Criteria) this;
}
public Criteria andGroupedGreaterThan(Boolean value) {
addCriterion("grouped >", value, "grouped");
return (Criteria) this;
}
public Criteria andGroupedGreaterThanOrEqualTo(Boolean value) {
addCriterion("grouped >=", value, "grouped");
return (Criteria) this;
}
public Criteria andGroupedLessThan(Boolean value) {
addCriterion("grouped <", value, "grouped");
return (Criteria) this;
}
public Criteria andGroupedLessThanOrEqualTo(Boolean value) {
addCriterion("grouped <=", value, "grouped");
return (Criteria) this;
}
public Criteria andGroupedIn(List<Boolean> values) {
addCriterion("grouped in", values, "grouped");
return (Criteria) this;
}
public Criteria andGroupedNotIn(List<Boolean> values) {
addCriterion("grouped not in", values, "grouped");
return (Criteria) this;
}
public Criteria andGroupedBetween(Boolean value1, Boolean value2) {
addCriterion("grouped between", value1, value2, "grouped");
return (Criteria) this;
}
public Criteria andGroupedNotBetween(Boolean value1, Boolean value2) {
addCriterion("grouped not between", value1, value2, "grouped");
return (Criteria) this;
}
public Criteria andEnvironmentIdIsNull() {
addCriterion("environment_id is null");
return (Criteria) this;
}
public Criteria andEnvironmentIdIsNotNull() {
addCriterion("environment_id is not null");
return (Criteria) this;
}
public Criteria andEnvironmentIdEqualTo(String value) {
addCriterion("environment_id =", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotEqualTo(String value) {
addCriterion("environment_id <>", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdGreaterThan(String value) {
addCriterion("environment_id >", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdGreaterThanOrEqualTo(String value) {
addCriterion("environment_id >=", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLessThan(String value) {
addCriterion("environment_id <", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLessThanOrEqualTo(String value) {
addCriterion("environment_id <=", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdLike(String value) {
addCriterion("environment_id like", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotLike(String value) {
addCriterion("environment_id not like", value, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdIn(List<String> values) {
addCriterion("environment_id in", values, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotIn(List<String> values) {
addCriterion("environment_id not in", values, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdBetween(String value1, String value2) {
addCriterion("environment_id between", value1, value2, "environmentId");
return (Criteria) this;
}
public Criteria andEnvironmentIdNotBetween(String value1, String value2) {
addCriterion("environment_id not between", value1, value2, "environmentId");
return (Criteria) this;
}
public Criteria andTestPlanApiScenarioIdIsNull() {
addCriterion("test_plan_api_scenario_id is null");
return (Criteria) this;
@ -793,6 +993,76 @@ public class TestPlanReportApiScenarioExample {
addCriterion("api_scenario_execute_result not between", value1, value2, "apiScenarioExecuteResult");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdIsNull() {
addCriterion("api_scenario_execute_report_id is null");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdIsNotNull() {
addCriterion("api_scenario_execute_report_id is not null");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdEqualTo(String value) {
addCriterion("api_scenario_execute_report_id =", value, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdNotEqualTo(String value) {
addCriterion("api_scenario_execute_report_id <>", value, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdGreaterThan(String value) {
addCriterion("api_scenario_execute_report_id >", value, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdGreaterThanOrEqualTo(String value) {
addCriterion("api_scenario_execute_report_id >=", value, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdLessThan(String value) {
addCriterion("api_scenario_execute_report_id <", value, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdLessThanOrEqualTo(String value) {
addCriterion("api_scenario_execute_report_id <=", value, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdLike(String value) {
addCriterion("api_scenario_execute_report_id like", value, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdNotLike(String value) {
addCriterion("api_scenario_execute_report_id not like", value, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdIn(List<String> values) {
addCriterion("api_scenario_execute_report_id in", values, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdNotIn(List<String> values) {
addCriterion("api_scenario_execute_report_id not in", values, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdBetween(String value1, String value2) {
addCriterion("api_scenario_execute_report_id between", value1, value2, "apiScenarioExecuteReportId");
return (Criteria) this;
}
public Criteria andApiScenarioExecuteReportIdNotBetween(String value1, String value2) {
addCriterion("api_scenario_execute_report_id not between", value1, value2, "apiScenarioExecuteReportId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -24,7 +24,7 @@ public class TestPlanReportFunctionCase implements Serializable {
@Size(min = 1, max = 50, message = "{test_plan_report_function_case.test_plan_report_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanReportId;
@Schema(description = "测试计划功能用例关联ID", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "测试计划功能用例关联ID(同一计划下可重复关联, 暂时保留)", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_function_case.test_plan_function_case_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_function_case.test_plan_function_case_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanFunctionCaseId;
@ -60,6 +60,11 @@ public class TestPlanReportFunctionCase implements Serializable {
@Size(min = 1, max = 50, message = "{test_plan_report_function_case.function_case_execute_result.length_range}", groups = {Created.class, Updated.class})
private String functionCaseExecuteResult;
@Schema(description = "测试集ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_function_case.test_plan_collection_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_function_case.test_plan_collection_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanCollectionId;
private static final long serialVersionUID = 1L;
public enum Column {
@ -73,7 +78,8 @@ public class TestPlanReportFunctionCase implements Serializable {
functionCasePriority("function_case_priority", "functionCasePriority", "VARCHAR", false),
functionCaseExecuteUser("function_case_execute_user", "functionCaseExecuteUser", "VARCHAR", false),
functionCaseBugCount("function_case_bug_count", "functionCaseBugCount", "BIGINT", false),
functionCaseExecuteResult("function_case_execute_result", "functionCaseExecuteResult", "VARCHAR", false);
functionCaseExecuteResult("function_case_execute_result", "functionCaseExecuteResult", "VARCHAR", false),
testPlanCollectionId("test_plan_collection_id", "testPlanCollectionId", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -853,6 +853,76 @@ public class TestPlanReportFunctionCaseExample {
addCriterion("function_case_execute_result not between", value1, value2, "functionCaseExecuteResult");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIsNull() {
addCriterion("test_plan_collection_id is null");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIsNotNull() {
addCriterion("test_plan_collection_id is not null");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdEqualTo(String value) {
addCriterion("test_plan_collection_id =", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotEqualTo(String value) {
addCriterion("test_plan_collection_id <>", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdGreaterThan(String value) {
addCriterion("test_plan_collection_id >", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_collection_id >=", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLessThan(String value) {
addCriterion("test_plan_collection_id <", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLessThanOrEqualTo(String value) {
addCriterion("test_plan_collection_id <=", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdLike(String value) {
addCriterion("test_plan_collection_id like", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotLike(String value) {
addCriterion("test_plan_collection_id not like", value, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdIn(List<String> values) {
addCriterion("test_plan_collection_id in", values, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotIn(List<String> values) {
addCriterion("test_plan_collection_id not in", values, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdBetween(String value1, String value2) {
addCriterion("test_plan_collection_id between", value1, value2, "testPlanCollectionId");
return (Criteria) this;
}
public Criteria andTestPlanCollectionIdNotBetween(String value1, String value2) {
addCriterion("test_plan_collection_id not between", value1, value2, "testPlanCollectionId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -4,6 +4,8 @@
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanReportApiCase">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="test_plan_report_id" jdbcType="VARCHAR" property="testPlanReportId" />
<result column="test_plan_collection_id" jdbcType="VARCHAR" property="testPlanCollectionId" />
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
<result column="test_plan_api_case_id" jdbcType="VARCHAR" property="testPlanApiCaseId" />
<result column="api_case_id" jdbcType="VARCHAR" property="apiCaseId" />
<result column="api_case_num" jdbcType="BIGINT" property="apiCaseNum" />
@ -12,6 +14,7 @@
<result column="api_case_priority" jdbcType="VARCHAR" property="apiCasePriority" />
<result column="api_case_execute_user" jdbcType="VARCHAR" property="apiCaseExecuteUser" />
<result column="api_case_execute_result" jdbcType="VARCHAR" property="apiCaseExecuteResult" />
<result column="api_case_execute_report_id" jdbcType="VARCHAR" property="apiCaseExecuteReportId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -72,8 +75,9 @@
</where>
</sql>
<sql id="Base_Column_List">
id, test_plan_report_id, test_plan_api_case_id, api_case_id, api_case_num, api_case_name,
api_case_module, api_case_priority, api_case_execute_user, api_case_execute_result
id, test_plan_report_id, test_plan_collection_id, environment_id, test_plan_api_case_id,
api_case_id, api_case_num, api_case_name, api_case_module, api_case_priority, api_case_execute_user,
api_case_execute_result, api_case_execute_report_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiCaseExample" resultMap="BaseResultMap">
select
@ -106,14 +110,16 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanReportApiCase">
insert into test_plan_report_api_case (id, test_plan_report_id, test_plan_api_case_id,
api_case_id, api_case_num, api_case_name,
api_case_module, api_case_priority, api_case_execute_user,
api_case_execute_result)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanApiCaseId,jdbcType=VARCHAR},
#{apiCaseId,jdbcType=VARCHAR}, #{apiCaseNum,jdbcType=BIGINT}, #{apiCaseName,jdbcType=VARCHAR},
#{apiCaseModule,jdbcType=VARCHAR}, #{apiCasePriority,jdbcType=VARCHAR}, #{apiCaseExecuteUser,jdbcType=VARCHAR},
#{apiCaseExecuteResult,jdbcType=VARCHAR})
insert into test_plan_report_api_case (id, test_plan_report_id, test_plan_collection_id,
environment_id, test_plan_api_case_id, api_case_id,
api_case_num, api_case_name, api_case_module,
api_case_priority, api_case_execute_user, api_case_execute_result,
api_case_execute_report_id)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR},
#{environmentId,jdbcType=VARCHAR}, #{testPlanApiCaseId,jdbcType=VARCHAR}, #{apiCaseId,jdbcType=VARCHAR},
#{apiCaseNum,jdbcType=BIGINT}, #{apiCaseName,jdbcType=VARCHAR}, #{apiCaseModule,jdbcType=VARCHAR},
#{apiCasePriority,jdbcType=VARCHAR}, #{apiCaseExecuteUser,jdbcType=VARCHAR}, #{apiCaseExecuteResult,jdbcType=VARCHAR},
#{apiCaseExecuteReportId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportApiCase">
insert into test_plan_report_api_case
@ -124,6 +130,12 @@
<if test="testPlanReportId != null">
test_plan_report_id,
</if>
<if test="testPlanCollectionId != null">
test_plan_collection_id,
</if>
<if test="environmentId != null">
environment_id,
</if>
<if test="testPlanApiCaseId != null">
test_plan_api_case_id,
</if>
@ -148,6 +160,9 @@
<if test="apiCaseExecuteResult != null">
api_case_execute_result,
</if>
<if test="apiCaseExecuteReportId != null">
api_case_execute_report_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -156,6 +171,12 @@
<if test="testPlanReportId != null">
#{testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="testPlanCollectionId != null">
#{testPlanCollectionId,jdbcType=VARCHAR},
</if>
<if test="environmentId != null">
#{environmentId,jdbcType=VARCHAR},
</if>
<if test="testPlanApiCaseId != null">
#{testPlanApiCaseId,jdbcType=VARCHAR},
</if>
@ -180,6 +201,9 @@
<if test="apiCaseExecuteResult != null">
#{apiCaseExecuteResult,jdbcType=VARCHAR},
</if>
<if test="apiCaseExecuteReportId != null">
#{apiCaseExecuteReportId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiCaseExample" resultType="java.lang.Long">
@ -197,6 +221,12 @@
<if test="record.testPlanReportId != null">
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="record.testPlanCollectionId != null">
test_plan_collection_id = #{record.testPlanCollectionId,jdbcType=VARCHAR},
</if>
<if test="record.environmentId != null">
environment_id = #{record.environmentId,jdbcType=VARCHAR},
</if>
<if test="record.testPlanApiCaseId != null">
test_plan_api_case_id = #{record.testPlanApiCaseId,jdbcType=VARCHAR},
</if>
@ -221,6 +251,9 @@
<if test="record.apiCaseExecuteResult != null">
api_case_execute_result = #{record.apiCaseExecuteResult,jdbcType=VARCHAR},
</if>
<if test="record.apiCaseExecuteReportId != null">
api_case_execute_report_id = #{record.apiCaseExecuteReportId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -230,6 +263,8 @@
update test_plan_report_api_case
set id = #{record.id,jdbcType=VARCHAR},
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
test_plan_collection_id = #{record.testPlanCollectionId,jdbcType=VARCHAR},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
test_plan_api_case_id = #{record.testPlanApiCaseId,jdbcType=VARCHAR},
api_case_id = #{record.apiCaseId,jdbcType=VARCHAR},
api_case_num = #{record.apiCaseNum,jdbcType=BIGINT},
@ -237,7 +272,8 @@
api_case_module = #{record.apiCaseModule,jdbcType=VARCHAR},
api_case_priority = #{record.apiCasePriority,jdbcType=VARCHAR},
api_case_execute_user = #{record.apiCaseExecuteUser,jdbcType=VARCHAR},
api_case_execute_result = #{record.apiCaseExecuteResult,jdbcType=VARCHAR}
api_case_execute_result = #{record.apiCaseExecuteResult,jdbcType=VARCHAR},
api_case_execute_report_id = #{record.apiCaseExecuteReportId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -248,6 +284,12 @@
<if test="testPlanReportId != null">
test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="testPlanCollectionId != null">
test_plan_collection_id = #{testPlanCollectionId,jdbcType=VARCHAR},
</if>
<if test="environmentId != null">
environment_id = #{environmentId,jdbcType=VARCHAR},
</if>
<if test="testPlanApiCaseId != null">
test_plan_api_case_id = #{testPlanApiCaseId,jdbcType=VARCHAR},
</if>
@ -272,12 +314,17 @@
<if test="apiCaseExecuteResult != null">
api_case_execute_result = #{apiCaseExecuteResult,jdbcType=VARCHAR},
</if>
<if test="apiCaseExecuteReportId != null">
api_case_execute_report_id = #{apiCaseExecuteReportId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanReportApiCase">
update test_plan_report_api_case
set test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
test_plan_collection_id = #{testPlanCollectionId,jdbcType=VARCHAR},
environment_id = #{environmentId,jdbcType=VARCHAR},
test_plan_api_case_id = #{testPlanApiCaseId,jdbcType=VARCHAR},
api_case_id = #{apiCaseId,jdbcType=VARCHAR},
api_case_num = #{apiCaseNum,jdbcType=BIGINT},
@ -285,21 +332,23 @@
api_case_module = #{apiCaseModule,jdbcType=VARCHAR},
api_case_priority = #{apiCasePriority,jdbcType=VARCHAR},
api_case_execute_user = #{apiCaseExecuteUser,jdbcType=VARCHAR},
api_case_execute_result = #{apiCaseExecuteResult,jdbcType=VARCHAR}
api_case_execute_result = #{apiCaseExecuteResult,jdbcType=VARCHAR},
api_case_execute_report_id = #{apiCaseExecuteReportId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into test_plan_report_api_case
(id, test_plan_report_id, test_plan_api_case_id, api_case_id, api_case_num, api_case_name,
api_case_module, api_case_priority, api_case_execute_user, api_case_execute_result
)
(id, test_plan_report_id, test_plan_collection_id, environment_id, test_plan_api_case_id,
api_case_id, api_case_num, api_case_name, api_case_module, api_case_priority, api_case_execute_user,
api_case_execute_result, api_case_execute_report_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanApiCaseId,jdbcType=VARCHAR},
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanCollectionId,jdbcType=VARCHAR},
#{item.environmentId,jdbcType=VARCHAR}, #{item.testPlanApiCaseId,jdbcType=VARCHAR},
#{item.apiCaseId,jdbcType=VARCHAR}, #{item.apiCaseNum,jdbcType=BIGINT}, #{item.apiCaseName,jdbcType=VARCHAR},
#{item.apiCaseModule,jdbcType=VARCHAR}, #{item.apiCasePriority,jdbcType=VARCHAR},
#{item.apiCaseExecuteUser,jdbcType=VARCHAR}, #{item.apiCaseExecuteResult,jdbcType=VARCHAR}
)
#{item.apiCaseExecuteUser,jdbcType=VARCHAR}, #{item.apiCaseExecuteResult,jdbcType=VARCHAR},
#{item.apiCaseExecuteReportId,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -318,6 +367,12 @@
<if test="'test_plan_report_id'.toString() == column.value">
#{item.testPlanReportId,jdbcType=VARCHAR}
</if>
<if test="'test_plan_collection_id'.toString() == column.value">
#{item.testPlanCollectionId,jdbcType=VARCHAR}
</if>
<if test="'environment_id'.toString() == column.value">
#{item.environmentId,jdbcType=VARCHAR}
</if>
<if test="'test_plan_api_case_id'.toString() == column.value">
#{item.testPlanApiCaseId,jdbcType=VARCHAR}
</if>
@ -342,6 +397,9 @@
<if test="'api_case_execute_result'.toString() == column.value">
#{item.apiCaseExecuteResult,jdbcType=VARCHAR}
</if>
<if test="'api_case_execute_report_id'.toString() == column.value">
#{item.apiCaseExecuteReportId,jdbcType=VARCHAR}
</if>
</foreach>
)
</foreach>

View File

@ -4,6 +4,9 @@
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanReportApiScenario">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="test_plan_report_id" jdbcType="VARCHAR" property="testPlanReportId" />
<result column="test_plan_collection_id" jdbcType="VARCHAR" property="testPlanCollectionId" />
<result column="grouped" jdbcType="BIT" property="grouped" />
<result column="environment_id" jdbcType="VARCHAR" property="environmentId" />
<result column="test_plan_api_scenario_id" jdbcType="VARCHAR" property="testPlanApiScenarioId" />
<result column="api_scenario_id" jdbcType="VARCHAR" property="apiScenarioId" />
<result column="api_scenario_num" jdbcType="BIGINT" property="apiScenarioNum" />
@ -12,6 +15,7 @@
<result column="api_scenario_priority" jdbcType="VARCHAR" property="apiScenarioPriority" />
<result column="api_scenario_execute_user" jdbcType="VARCHAR" property="apiScenarioExecuteUser" />
<result column="api_scenario_execute_result" jdbcType="VARCHAR" property="apiScenarioExecuteResult" />
<result column="api_scenario_execute_report_id" jdbcType="VARCHAR" property="apiScenarioExecuteReportId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -72,9 +76,9 @@
</where>
</sql>
<sql id="Base_Column_List">
id, test_plan_report_id, test_plan_api_scenario_id, api_scenario_id, api_scenario_num,
api_scenario_name, api_scenario_module, api_scenario_priority, api_scenario_execute_user,
api_scenario_execute_result
id, test_plan_report_id, test_plan_collection_id, grouped, environment_id, test_plan_api_scenario_id,
api_scenario_id, api_scenario_num, api_scenario_name, api_scenario_module, api_scenario_priority,
api_scenario_execute_user, api_scenario_execute_result, api_scenario_execute_report_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenarioExample" resultMap="BaseResultMap">
select
@ -107,16 +111,18 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenario">
insert into test_plan_report_api_scenario (id, test_plan_report_id, test_plan_api_scenario_id,
insert into test_plan_report_api_scenario (id, test_plan_report_id, test_plan_collection_id,
grouped, environment_id, test_plan_api_scenario_id,
api_scenario_id, api_scenario_num, api_scenario_name,
api_scenario_module, api_scenario_priority,
api_scenario_execute_user, api_scenario_execute_result
)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanApiScenarioId,jdbcType=VARCHAR},
api_scenario_execute_user, api_scenario_execute_result,
api_scenario_execute_report_id)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR},
#{grouped,jdbcType=BIT}, #{environmentId,jdbcType=VARCHAR}, #{testPlanApiScenarioId,jdbcType=VARCHAR},
#{apiScenarioId,jdbcType=VARCHAR}, #{apiScenarioNum,jdbcType=BIGINT}, #{apiScenarioName,jdbcType=VARCHAR},
#{apiScenarioModule,jdbcType=VARCHAR}, #{apiScenarioPriority,jdbcType=VARCHAR},
#{apiScenarioExecuteUser,jdbcType=VARCHAR}, #{apiScenarioExecuteResult,jdbcType=VARCHAR}
)
#{apiScenarioExecuteUser,jdbcType=VARCHAR}, #{apiScenarioExecuteResult,jdbcType=VARCHAR},
#{apiScenarioExecuteReportId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenario">
insert into test_plan_report_api_scenario
@ -127,6 +133,15 @@
<if test="testPlanReportId != null">
test_plan_report_id,
</if>
<if test="testPlanCollectionId != null">
test_plan_collection_id,
</if>
<if test="grouped != null">
grouped,
</if>
<if test="environmentId != null">
environment_id,
</if>
<if test="testPlanApiScenarioId != null">
test_plan_api_scenario_id,
</if>
@ -151,6 +166,9 @@
<if test="apiScenarioExecuteResult != null">
api_scenario_execute_result,
</if>
<if test="apiScenarioExecuteReportId != null">
api_scenario_execute_report_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -159,6 +177,15 @@
<if test="testPlanReportId != null">
#{testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="testPlanCollectionId != null">
#{testPlanCollectionId,jdbcType=VARCHAR},
</if>
<if test="grouped != null">
#{grouped,jdbcType=BIT},
</if>
<if test="environmentId != null">
#{environmentId,jdbcType=VARCHAR},
</if>
<if test="testPlanApiScenarioId != null">
#{testPlanApiScenarioId,jdbcType=VARCHAR},
</if>
@ -183,6 +210,9 @@
<if test="apiScenarioExecuteResult != null">
#{apiScenarioExecuteResult,jdbcType=VARCHAR},
</if>
<if test="apiScenarioExecuteReportId != null">
#{apiScenarioExecuteReportId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenarioExample" resultType="java.lang.Long">
@ -200,6 +230,15 @@
<if test="record.testPlanReportId != null">
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="record.testPlanCollectionId != null">
test_plan_collection_id = #{record.testPlanCollectionId,jdbcType=VARCHAR},
</if>
<if test="record.grouped != null">
grouped = #{record.grouped,jdbcType=BIT},
</if>
<if test="record.environmentId != null">
environment_id = #{record.environmentId,jdbcType=VARCHAR},
</if>
<if test="record.testPlanApiScenarioId != null">
test_plan_api_scenario_id = #{record.testPlanApiScenarioId,jdbcType=VARCHAR},
</if>
@ -224,6 +263,9 @@
<if test="record.apiScenarioExecuteResult != null">
api_scenario_execute_result = #{record.apiScenarioExecuteResult,jdbcType=VARCHAR},
</if>
<if test="record.apiScenarioExecuteReportId != null">
api_scenario_execute_report_id = #{record.apiScenarioExecuteReportId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -233,6 +275,9 @@
update test_plan_report_api_scenario
set id = #{record.id,jdbcType=VARCHAR},
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
test_plan_collection_id = #{record.testPlanCollectionId,jdbcType=VARCHAR},
grouped = #{record.grouped,jdbcType=BIT},
environment_id = #{record.environmentId,jdbcType=VARCHAR},
test_plan_api_scenario_id = #{record.testPlanApiScenarioId,jdbcType=VARCHAR},
api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR},
api_scenario_num = #{record.apiScenarioNum,jdbcType=BIGINT},
@ -240,7 +285,8 @@
api_scenario_module = #{record.apiScenarioModule,jdbcType=VARCHAR},
api_scenario_priority = #{record.apiScenarioPriority,jdbcType=VARCHAR},
api_scenario_execute_user = #{record.apiScenarioExecuteUser,jdbcType=VARCHAR},
api_scenario_execute_result = #{record.apiScenarioExecuteResult,jdbcType=VARCHAR}
api_scenario_execute_result = #{record.apiScenarioExecuteResult,jdbcType=VARCHAR},
api_scenario_execute_report_id = #{record.apiScenarioExecuteReportId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -251,6 +297,15 @@
<if test="testPlanReportId != null">
test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="testPlanCollectionId != null">
test_plan_collection_id = #{testPlanCollectionId,jdbcType=VARCHAR},
</if>
<if test="grouped != null">
grouped = #{grouped,jdbcType=BIT},
</if>
<if test="environmentId != null">
environment_id = #{environmentId,jdbcType=VARCHAR},
</if>
<if test="testPlanApiScenarioId != null">
test_plan_api_scenario_id = #{testPlanApiScenarioId,jdbcType=VARCHAR},
</if>
@ -275,12 +330,18 @@
<if test="apiScenarioExecuteResult != null">
api_scenario_execute_result = #{apiScenarioExecuteResult,jdbcType=VARCHAR},
</if>
<if test="apiScenarioExecuteReportId != null">
api_scenario_execute_report_id = #{apiScenarioExecuteReportId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenario">
update test_plan_report_api_scenario
set test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
test_plan_collection_id = #{testPlanCollectionId,jdbcType=VARCHAR},
grouped = #{grouped,jdbcType=BIT},
environment_id = #{environmentId,jdbcType=VARCHAR},
test_plan_api_scenario_id = #{testPlanApiScenarioId,jdbcType=VARCHAR},
api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR},
api_scenario_num = #{apiScenarioNum,jdbcType=BIGINT},
@ -288,21 +349,25 @@
api_scenario_module = #{apiScenarioModule,jdbcType=VARCHAR},
api_scenario_priority = #{apiScenarioPriority,jdbcType=VARCHAR},
api_scenario_execute_user = #{apiScenarioExecuteUser,jdbcType=VARCHAR},
api_scenario_execute_result = #{apiScenarioExecuteResult,jdbcType=VARCHAR}
api_scenario_execute_result = #{apiScenarioExecuteResult,jdbcType=VARCHAR},
api_scenario_execute_report_id = #{apiScenarioExecuteReportId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into test_plan_report_api_scenario
(id, test_plan_report_id, test_plan_api_scenario_id, api_scenario_id, api_scenario_num,
api_scenario_name, api_scenario_module, api_scenario_priority, api_scenario_execute_user,
api_scenario_execute_result)
(id, test_plan_report_id, test_plan_collection_id, grouped, environment_id, test_plan_api_scenario_id,
api_scenario_id, api_scenario_num, api_scenario_name, api_scenario_module, api_scenario_priority,
api_scenario_execute_user, api_scenario_execute_result, api_scenario_execute_report_id
)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanApiScenarioId,jdbcType=VARCHAR},
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanCollectionId,jdbcType=VARCHAR},
#{item.grouped,jdbcType=BIT}, #{item.environmentId,jdbcType=VARCHAR}, #{item.testPlanApiScenarioId,jdbcType=VARCHAR},
#{item.apiScenarioId,jdbcType=VARCHAR}, #{item.apiScenarioNum,jdbcType=BIGINT},
#{item.apiScenarioName,jdbcType=VARCHAR}, #{item.apiScenarioModule,jdbcType=VARCHAR},
#{item.apiScenarioPriority,jdbcType=VARCHAR}, #{item.apiScenarioExecuteUser,jdbcType=VARCHAR},
#{item.apiScenarioExecuteResult,jdbcType=VARCHAR})
#{item.apiScenarioExecuteResult,jdbcType=VARCHAR}, #{item.apiScenarioExecuteReportId,jdbcType=VARCHAR}
)
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -321,6 +386,15 @@
<if test="'test_plan_report_id'.toString() == column.value">
#{item.testPlanReportId,jdbcType=VARCHAR}
</if>
<if test="'test_plan_collection_id'.toString() == column.value">
#{item.testPlanCollectionId,jdbcType=VARCHAR}
</if>
<if test="'grouped'.toString() == column.value">
#{item.grouped,jdbcType=BIT}
</if>
<if test="'environment_id'.toString() == column.value">
#{item.environmentId,jdbcType=VARCHAR}
</if>
<if test="'test_plan_api_scenario_id'.toString() == column.value">
#{item.testPlanApiScenarioId,jdbcType=VARCHAR}
</if>
@ -345,6 +419,9 @@
<if test="'api_scenario_execute_result'.toString() == column.value">
#{item.apiScenarioExecuteResult,jdbcType=VARCHAR}
</if>
<if test="'api_scenario_execute_report_id'.toString() == column.value">
#{item.apiScenarioExecuteReportId,jdbcType=VARCHAR}
</if>
</foreach>
)
</foreach>

View File

@ -13,6 +13,7 @@
<result column="function_case_execute_user" jdbcType="VARCHAR" property="functionCaseExecuteUser" />
<result column="function_case_bug_count" jdbcType="BIGINT" property="functionCaseBugCount" />
<result column="function_case_execute_result" jdbcType="VARCHAR" property="functionCaseExecuteResult" />
<result column="test_plan_collection_id" jdbcType="VARCHAR" property="testPlanCollectionId" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -75,7 +76,7 @@
<sql id="Base_Column_List">
id, test_plan_report_id, test_plan_function_case_id, function_case_id, function_case_num,
function_case_name, function_case_module, function_case_priority, function_case_execute_user,
function_case_bug_count, function_case_execute_result
function_case_bug_count, function_case_execute_result, test_plan_collection_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCaseExample" resultMap="BaseResultMap">
select
@ -112,12 +113,14 @@
function_case_id, function_case_num, function_case_name,
function_case_module, function_case_priority,
function_case_execute_user, function_case_bug_count,
function_case_execute_result)
function_case_execute_result, test_plan_collection_id
)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanFunctionCaseId,jdbcType=VARCHAR},
#{functionCaseId,jdbcType=VARCHAR}, #{functionCaseNum,jdbcType=BIGINT}, #{functionCaseName,jdbcType=VARCHAR},
#{functionCaseModule,jdbcType=VARCHAR}, #{functionCasePriority,jdbcType=VARCHAR},
#{functionCaseExecuteUser,jdbcType=VARCHAR}, #{functionCaseBugCount,jdbcType=BIGINT},
#{functionCaseExecuteResult,jdbcType=VARCHAR})
#{functionCaseExecuteResult,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCase">
insert into test_plan_report_function_case
@ -155,6 +158,9 @@
<if test="functionCaseExecuteResult != null">
function_case_execute_result,
</if>
<if test="testPlanCollectionId != null">
test_plan_collection_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -190,6 +196,9 @@
<if test="functionCaseExecuteResult != null">
#{functionCaseExecuteResult,jdbcType=VARCHAR},
</if>
<if test="testPlanCollectionId != null">
#{testPlanCollectionId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCaseExample" resultType="java.lang.Long">
@ -234,6 +243,9 @@
<if test="record.functionCaseExecuteResult != null">
function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR},
</if>
<if test="record.testPlanCollectionId != null">
test_plan_collection_id = #{record.testPlanCollectionId,jdbcType=VARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -251,7 +263,8 @@
function_case_priority = #{record.functionCasePriority,jdbcType=VARCHAR},
function_case_execute_user = #{record.functionCaseExecuteUser,jdbcType=VARCHAR},
function_case_bug_count = #{record.functionCaseBugCount,jdbcType=BIGINT},
function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR}
function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR},
test_plan_collection_id = #{record.testPlanCollectionId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -289,6 +302,9 @@
<if test="functionCaseExecuteResult != null">
function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR},
</if>
<if test="testPlanCollectionId != null">
test_plan_collection_id = #{testPlanCollectionId,jdbcType=VARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -303,22 +319,23 @@
function_case_priority = #{functionCasePriority,jdbcType=VARCHAR},
function_case_execute_user = #{functionCaseExecuteUser,jdbcType=VARCHAR},
function_case_bug_count = #{functionCaseBugCount,jdbcType=BIGINT},
function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR}
function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR},
test_plan_collection_id = #{testPlanCollectionId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into test_plan_report_function_case
(id, test_plan_report_id, test_plan_function_case_id, function_case_id, function_case_num,
function_case_name, function_case_module, function_case_priority, function_case_execute_user,
function_case_bug_count, function_case_execute_result)
function_case_bug_count, function_case_execute_result, test_plan_collection_id)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanFunctionCaseId,jdbcType=VARCHAR},
#{item.functionCaseId,jdbcType=VARCHAR}, #{item.functionCaseNum,jdbcType=BIGINT},
#{item.functionCaseName,jdbcType=VARCHAR}, #{item.functionCaseModule,jdbcType=VARCHAR},
#{item.functionCasePriority,jdbcType=VARCHAR}, #{item.functionCaseExecuteUser,jdbcType=VARCHAR},
#{item.functionCaseBugCount,jdbcType=BIGINT}, #{item.functionCaseExecuteResult,jdbcType=VARCHAR}
)
#{item.functionCaseBugCount,jdbcType=BIGINT}, #{item.functionCaseExecuteResult,jdbcType=VARCHAR},
#{item.testPlanCollectionId,jdbcType=VARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -364,6 +381,9 @@
<if test="'function_case_execute_result'.toString() == column.value">
#{item.functionCaseExecuteResult,jdbcType=VARCHAR}
</if>
<if test="'test_plan_collection_id'.toString() == column.value">
#{item.testPlanCollectionId,jdbcType=VARCHAR}
</if>
</foreach>
)
</foreach>

View File

@ -179,6 +179,8 @@ ALTER TABLE `user`
CREATE TABLE IF NOT EXISTS test_plan_report_api_case(
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
`test_plan_report_id` VARCHAR(50) NOT NULL COMMENT '测试计划报告ID' ,
`test_plan_collection_id` VARCHAR(50) NOT NULL COMMENT '测试集ID' ,
`environment_id` VARCHAR(50) COMMENT '环境ID' ,
`test_plan_api_case_id` VARCHAR(50) NOT NULL COMMENT '测试计划接口用例关联ID' ,
`api_case_id` VARCHAR(50) NOT NULL COMMENT '接口用例ID' ,
`api_case_num` BIGINT NOT NULL COMMENT '接口用例业务ID' ,
@ -186,15 +188,20 @@ CREATE TABLE IF NOT EXISTS test_plan_report_api_case(
`api_case_module` VARCHAR(255) COMMENT '接口用例所属模块' ,
`api_case_priority` VARCHAR(255) COMMENT '接口用例等级' ,
`api_case_execute_user` VARCHAR(50) COMMENT '接口用例执行人' ,
`api_case_execute_result` VARCHAR(50) NOT NULL COMMENT '接口用例执行结果' ,
`api_case_execute_result` VARCHAR(50) COMMENT '接口用例执行结果' ,
`api_case_execute_report_id` VARCHAR(50) COMMENT '接口用例执行报告ID' ,
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '测试计划报告内容接口用例部分';
CREATE INDEX idx_test_plan_report_id ON test_plan_report_api_case(test_plan_report_id);
CREATE INDEX idx_test_plan_collection_id ON test_plan_report_api_case(test_plan_collection_id);
-- 测试计划报告场景详情部分
CREATE TABLE IF NOT EXISTS test_plan_report_api_scenario(
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
`test_plan_report_id` VARCHAR(50) NOT NULL COMMENT '测试计划报告ID' ,
`test_plan_collection_id` VARCHAR(50) NOT NULL COMMENT '测试集ID' ,
`grouped` BIT(1) COMMENT '是否环境组' ,
`environment_id` VARCHAR(50) COMMENT '环境ID' ,
`test_plan_api_scenario_id` VARCHAR(50) NOT NULL COMMENT '测试计划场景用例关联ID' ,
`api_scenario_id` VARCHAR(50) NOT NULL COMMENT '场景用例ID' ,
`api_scenario_num` BIGINT NOT NULL COMMENT '场景用例业务ID' ,
@ -202,15 +209,21 @@ CREATE TABLE IF NOT EXISTS test_plan_report_api_scenario(
`api_scenario_module` VARCHAR(255) COMMENT '场景用例所属模块' ,
`api_scenario_priority` VARCHAR(255) COMMENT '场景用例等级' ,
`api_scenario_execute_user` VARCHAR(50) COMMENT '场景用例执行人' ,
`api_scenario_execute_result` VARCHAR(50) NOT NULL COMMENT '场景用例执行结果' ,
`api_scenario_execute_result` VARCHAR(50) COMMENT '场景用例执行结果' ,
`api_scenario_execute_report_id` VARCHAR(50) COMMENT '场景用例执行报告ID' ,
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '测试计划报告内容接口场景部分';
CREATE INDEX idx_test_plan_report_id ON test_plan_report_api_scenario(test_plan_report_id);
CREATE INDEX idx_test_plan_collection_id ON test_plan_report_api_scenario(test_plan_collection_id);
-- 测试计划报告
ALTER TABLE test_plan_report ADD `execute_rate` DECIMAL(10, 4) COMMENT '执行率';
ALTER TABLE test_plan_report ADD `parent_id` VARCHAR(50) COMMENT '独立报告的父级ID';
-- 计划报告功能用例明细表
ALTER TABLE test_plan_report_function_case ADD `test_plan_collection_id` VARCHAR(50) NOT NULL COMMENT '测试集ID';
CREATE INDEX idx_test_plan_collection_id ON test_plan_report_function_case(test_plan_collection_id);
-- set innodb lock wait timeout to default
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -122,7 +122,7 @@ public class TestPlanReportController {
@PostMapping("/detail/bug/page")
@Operation(summary = "测试计划-报告-详情-缺陷分页查询")
@RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ)
@CheckOwner(resourceId = "#reportId", resourceType = "test_plan_report")
@CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report")
public Pager<List<BugDTO>> pageBug(@Validated @RequestBody TestPlanReportDetailPageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprb.bug_num, tprb.id desc");
@ -132,7 +132,7 @@ public class TestPlanReportController {
@PostMapping("/detail/functional/case/page")
@Operation(summary = "测试计划-报告-详情-功能用例分页查询")
@RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ)
@CheckOwner(resourceId = "#reportId", resourceType = "test_plan_report")
@CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report")
public Pager<List<ReportDetailCasePageDTO>> pageFunctionalCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprfc.function_case_num, tprfc.id desc");
@ -142,7 +142,7 @@ public class TestPlanReportController {
@PostMapping("/detail/api/case/page")
@Operation(summary = "测试计划-报告-详情-接口用例分页查询")
@RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ)
@CheckOwner(resourceId = "#reportId", resourceType = "test_plan_report")
@CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report")
public Pager<List<ReportDetailCasePageDTO>> pageApiCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprac.api_case_num, tprac.id desc");
@ -152,7 +152,7 @@ public class TestPlanReportController {
@PostMapping("/detail/scenario/case/page")
@Operation(summary = "测试计划-报告-详情-场景用例分页查询")
@RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ)
@CheckOwner(resourceId = "#reportId", resourceType = "test_plan_report")
@CheckOwner(resourceId = "#request.getReportId()", resourceType = "test_plan_report")
public Pager<List<ReportDetailCasePageDTO>> pageScenarioCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) {
Page<Object> page = PageHelper.startPage(request.getCurrent(), request.getPageSize(),
StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpras.api_scenario_num, tpras.id desc");

View File

@ -1,5 +1,6 @@
package io.metersphere.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
/**
@ -9,38 +10,22 @@ import lombok.Data;
@Data
public class ReportDetailCasePageDTO {
// ID用例名称所属模块用例等级执行人执行结果缺陷数
/**
* 用例ID
*/
@Schema(description = "用例ID")
private String id;
/**
* 用例业务ID
*/
@Schema(description = "用例业务ID")
private Long num;
/**
* 用例名称
*/
@Schema(description = "用例名称")
private String name;
/**
* 所属模块
*/
@Schema(description = "所属模块")
private String moduleName;
/**
* 用例等级
*/
@Schema(description = "用例等级")
private String priority;
/**
* 执行结果
*/
@Schema(description = "执行结果")
private String executeResult;
/**
* 执行人
*/
@Schema(description = "执行人")
private String executeUser;
/**
* 缺陷数
*/
@Schema(description = "缺陷数")
private Long bugCount;
@Schema(description = "报告详情ID")
private String reportId;
}

View File

@ -1,8 +1,11 @@
package io.metersphere.plan.dto;
import io.metersphere.plan.domain.TestPlan;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
public class TestPlanReportGenPreParam {
@ -30,8 +33,8 @@ public class TestPlanReportGenPreParam {
@Schema(description = "是否集成报告")
private Boolean integrated;
@Schema(description = "计划数量, 集成报告需要")
private Long planCount;
@Schema(description = "计划, 集成报告需要")
private List<TestPlan> childPlans;
@Schema(description = "计划组报告ID, 独立报告需要")
private String groupReportId;

View File

@ -25,6 +25,13 @@ public interface ExtTestPlanReportApiCaseMapper {
*/
List<TestPlanReportApiCase> getPlanExecuteCases(@Param("id") String planId);
/**
* 获取计划关联的接口用例
* @param planIds 计划ID集合
* @return 接口用例列表
*/
List<TestPlanReportApiCase> getGroupExecuteCases(@Param("ids") List<String> planIds);
/**
* 获取项目下接口用例所属模块集合
* @param projectId 计划ID

View File

@ -9,6 +9,7 @@
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiCase">
select tpac.id as testPlanApiCaseId, atc.id as apiCaseId, atc.num as apiCaseNum, atc.name as apiCaseName, atc.priority as apiCasePriority,
tpac.test_plan_collection_id testPlanCollectionId, tpac.environment_id as environmentId,
if(ad.module_id = 'root','未规划用例', ad.module_id) as apiCaseModule, tpac.execute_user as apiCaseExecuteUser,
ifnull(tpac.last_exec_result, 'PENDING') as apiCaseExecuteResult
from test_plan_api_case tpac join api_test_case atc on atc.id = tpac.api_case_id
@ -18,6 +19,20 @@
group by tpac.id
</select>
<select id="getGroupExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiCase">
select tpac.id as testPlanApiCaseId, atc.id as apiCaseId, atc.num as apiCaseNum, atc.name as apiCaseName, atc.priority as apiCasePriority,
if(ad.module_id = 'root','未规划用例', ad.module_id) as apiCaseModule, tpac.execute_user as apiCaseExecuteUser,
ifnull(tpac.last_exec_result, 'PENDING') as apiCaseExecuteResult
from test_plan_api_case tpac join api_test_case atc on atc.id = tpac.api_case_id
left join api_definition ad on atc.api_definition_id = ad.id
left join api_definition_module adm on ad.module_id = adm.id
where atc.deleted = false and tpac.test_plan_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
group by tpac.id
</select>
<select id="getPlanExecuteCaseModules" resultType="io.metersphere.plan.dto.TestPlanBaseModule">
select adm.id, adm.name, adm.parent_id as parentId from api_definition_module adm
where adm.project_id = #{id}
@ -26,7 +41,7 @@
<select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO">
<!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数 -->
select distinct tprac.api_case_id as id, tprac.api_case_num as num, tprac.api_case_name as name,
tprac.api_case_module as moduleName, tprac.api_case_priority as priority,
tprac.api_case_module as moduleName, tprac.api_case_priority as priority, tprac.api_case_execute_report_id reportId,
tprac.api_case_execute_result as executeResult, tprac.api_case_execute_user as executeUser
from test_plan_report_api_case tprac
where tprac.test_plan_report_id = #{request.reportId}

View File

@ -25,6 +25,13 @@ public interface ExtTestPlanReportApiScenarioMapper {
*/
List<TestPlanReportApiScenario> getPlanExecuteCases(@Param("id") String planId);
/**
* 获取计划关联的场景用例
* @param planIds 计划ID集合
* @return 场景用例列表
*/
List<TestPlanReportApiScenario> getGroupExecuteCases(@Param("ids") List<String> planIds);
/**
* 获取项目下场景用例所属模块集合
* @param projectId 计划ID

View File

@ -9,6 +9,7 @@
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiScenario">
select tpas.id as testPlanApiScenarioId, aso.id as apiScenarioId, aso.num as apiScenarioNum, aso.name as apiScenarioName, aso.priority as apiScenarioPriority,
tpas.test_plan_collection_id testPlanCollectionId, tpas.grouped grouped, tpas.environment_id environmentId,
if(aso.module_id = 'root','未规划用例', aso.module_id) as apiScenarioModule, tpas.execute_user as apiScenarioExecuteUser,
ifnull(tpas.last_exec_result, 'PENDING') as apiScenarioExecuteResult
from test_plan_api_scenario tpas join api_scenario aso on aso.id = tpas.api_scenario_id
@ -17,6 +18,20 @@
group by tpas.id
</select>
<select id="getGroupExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiScenario">
select tpas.id as testPlanApiScenarioId, aso.id as apiScenarioId, aso.num as apiScenarioNum, aso.name as apiScenarioName, aso.priority as apiScenarioPriority,
tpas.test_plan_collection_id testPlanCollectionId, tpas.grouped grouped, tpas.environment_id environmentId,
if(aso.module_id = 'root','未规划用例', aso.module_id) as apiScenarioModule, tpas.execute_user as apiScenarioExecuteUser,
ifnull(tpas.last_exec_result, 'PENDING') as apiScenarioExecuteResult
from test_plan_api_scenario tpas join api_scenario aso on aso.id = tpas.api_scenario_id
left join api_scenario_module asm on aso.module_id = asm.id
where aso.deleted = false and tpas.test_plan_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
group by tpas.id
</select>
<select id="getPlanExecuteCaseModules" resultType="io.metersphere.plan.dto.TestPlanBaseModule">
select asm.id, asm.name, asm.parent_id as parentId from api_scenario_module asm
where asm.project_id = #{id}
@ -25,7 +40,7 @@
<select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO">
<!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数 -->
select distinct tpras.api_scenario_id as id, tpras.api_scenario_num as num, tpras.api_scenario_name as name,
tpras.api_scenario_module as moduleName, tpras.api_scenario_priority as priority,
tpras.api_scenario_module as moduleName, tpras.api_scenario_priority as priority, tpras.api_scenario_execute_report_id reportId,
tpras.api_scenario_execute_result as executeResult, tpras.api_scenario_execute_user as executeUser
from test_plan_report_api_scenario tpras
where tpras.test_plan_report_id = #{request.reportId}

View File

@ -16,6 +16,13 @@ public interface ExtTestPlanReportBugMapper {
*/
List<TestPlanReportBug> getPlanBugs(@Param("id") String planId);
/**
* 获取计划的缺陷集合
* @param planIds 计划ID集合
* @return 缺陷集合
*/
List<TestPlanReportBug> getGroupBugs(@Param("ids") List<String> planIds);
/**
* 分页查询报告关联的缺陷
* @param request 请求参数

View File

@ -10,6 +10,17 @@
group by brc.bug_id
</select>
<select id="getGroupBugs" resultType="io.metersphere.plan.domain.TestPlanReportBug">
select distinct brc.bug_id as bugId, b.num as bugNum, b.title as bugTitle, b.status bugStatus,
b.handle_user bugHandleUser, count(brc.id) bugCaseCount
from bug_relation_case brc join bug b on brc.bug_id = b.id
where brc.test_plan_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
group by brc.bug_id
</select>
<select id="list" resultType="io.metersphere.bug.dto.response.BugDTO">
select distinct tprb.bug_id as id, tprb.bug_num as num, tprb.bug_title as title, tprb.bug_status as status, tprb.bug_handle_user as handleUserName,
ifnull(tprb.bug_case_count, 0) as relationCaseCount

View File

@ -19,6 +19,13 @@ public interface ExtTestPlanReportFunctionalCaseMapper {
*/
List<TestPlanReportFunctionCase> getPlanExecuteCases(@Param("id") String planId);
/**
* 获取计划关联的功能用例
* @param planIds 计划ID集合
* @return 功能用例列表
*/
List<TestPlanReportFunctionCase> getGroupPlanExecuteCases(@Param("ids") List<String> planIds);
/**
* 获取项目下功能用例所属模块集合
* @param projectId 计划ID

View File

@ -3,7 +3,7 @@
<mapper namespace="io.metersphere.plan.mapper.ExtTestPlanReportFunctionalCaseMapper">
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportFunctionCase">
select tpfc.id as testPlanFunctionCaseId, fc.id as functionCaseId, fc.num as functionCaseNum, fc.name as functionCaseName,
select tpfc.id as testPlanFunctionCaseId, fc.id as functionCaseId, fc.num as functionCaseNum, fc.name as functionCaseName, tpfc.test_plan_collection_id testPlanCollectionId,
if(fc.module_id = 'root','未规划用例', fc.module_id) as functionCaseModule, tpfc.execute_user as functionCaseExecuteUser,
count(brc.id) as functionCaseBugCount, ifnull(tpfc.last_exec_result, 'PENDING') as functionCaseExecuteResult
from test_plan_functional_case tpfc join functional_case fc on tpfc.functional_case_id = fc.id
@ -13,6 +13,20 @@
group by tpfc.id
</select>
<select id="getGroupPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportFunctionCase">
select tpfc.id as testPlanFunctionCaseId, fc.id as functionCaseId, fc.num as functionCaseNum, fc.name as functionCaseName, tpfc.test_plan_collection_id testPlanCollectionId,
if(fc.module_id = 'root','未规划用例', fc.module_id) as functionCaseModule, tpfc.execute_user as functionCaseExecuteUser,
count(brc.id) as functionCaseBugCount, ifnull(tpfc.last_exec_result, 'PENDING') as functionCaseExecuteResult
from test_plan_functional_case tpfc join functional_case fc on tpfc.functional_case_id = fc.id
left join functional_case_module fcm on fcm.id = fc.module_id
left join bug_relation_case brc on brc.test_plan_case_id = tpfc.id
where fc.deleted = false and tpfc.test_plan_id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
group by tpfc.id
</select>
<select id="getPlanExecuteCaseModules" resultType="io.metersphere.plan.dto.TestPlanBaseModule">
select fcm.id, fcm.name, fcm.parent_id as parentId from functional_case_module fcm
where fcm.project_id = #{id}

View File

@ -224,22 +224,22 @@ public class TestPlanReportService {
// 模块参数
TestPlanReportModuleParam moduleParam = getModuleParam(request.getProjectId());
/*
* 1. 准备报告生成参数
* 2. 预生成报告
* 3. 汇总报告数据 {执行时跳过}
* 3. 报告后置处理 (计算通过率, 执行率, 执行状态...) {执行时跳过}
*/
final Long groupPlanCount = (long) (plans.size() - 1);
AtomicReference<String> groupReportId = new AtomicReference<>();
plans.forEach(plan -> {
request.setTestPlanId(plan.getId());
TestPlanReportGenPreParam genPreParam = buildReportGenParam(request, plan, groupPlanCount, groupReportId.get() != null ? groupReportId.get() : null);
TestPlanReport preReport = preGenReport(genPreParam, currentUser, logPath, moduleParam);
if (genPreParam.getIntegrated()) {
// 如果是计划组的报告, 初始化组的报告ID
groupReportId.set(preReport.getId());
}
/*
* 1. 准备报告生成参数
* 2. 预生成报告
* 3. 汇总报告数据 {执行时跳过}
* 3. 报告后置处理 (计算通过率, 执行率, 执行状态...) {执行时跳过}
*/
List<String> childPlanIds = plans.stream().filter(plan -> StringUtils.equals(plan.getType(), TestPlanConstants.TEST_PLAN_TYPE_PLAN)).map(TestPlan::getId).toList();
AtomicReference<String> groupReportId = new AtomicReference<>();
plans.forEach(plan -> {
request.setTestPlanId(plan.getId());
TestPlanReportGenPreParam genPreParam = buildReportGenParam(request, plan, groupReportId.get());
TestPlanReport preReport = preGenReport(genPreParam, currentUser, logPath, moduleParam, childPlanIds);
if (genPreParam.getIntegrated()) {
// 如果是计划组的报告, 初始化组的报告ID
groupReportId.set(preReport.getId());
}
if (!isExecute) {
// 汇总
@ -257,14 +257,13 @@ public class TestPlanReportService {
});
}
/**
* 预生成报告内容(汇总前调用)
*
* @return 报告
*/
public TestPlanReport preGenReport(TestPlanReportGenPreParam genParam, String currentUser, String logPath, TestPlanReportModuleParam moduleParam) {
// 计划配置
TestPlanConfig config = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId());
/**
* 预生成报告内容(汇总前调用)
* @return 报告
*/
public TestPlanReport preGenReport(TestPlanReportGenPreParam genParam, String currentUser, String logPath, TestPlanReportModuleParam moduleParam, List<String> childPlanIds) {
// 计划配置
TestPlanConfig config = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId());
/*
* 预生成报告
@ -282,100 +281,119 @@ public class TestPlanReportService {
report.setParentId(genParam.getGroupReportId());
testPlanReportMapper.insertSelective(report);
// 报告关联数据
TestPlanReportDetailCaseDTO reportCaseDetail = genReportDetail(genParam, moduleParam, report);
// 报告统计内容
TestPlanReportSummary reportSummary = new TestPlanReportSummary();
reportSummary.setId(IDGenerator.nextStr());
reportSummary.setTestPlanReportId(report.getId());
reportSummary.setFunctionalCaseCount((long) (CollectionUtils.isEmpty(reportCaseDetail.getFunctionCases()) ? 0 : reportCaseDetail.getFunctionCases().size()));
reportSummary.setApiCaseCount((long) (CollectionUtils.isEmpty(reportCaseDetail.getApiCases()) ? 0 : reportCaseDetail.getApiCases().size()));
reportSummary.setApiScenarioCount((long) (CollectionUtils.isEmpty(reportCaseDetail.getApiScenarios()) ? 0 : reportCaseDetail.getApiScenarios().size()));
reportSummary.setBugCount((long) (CollectionUtils.isEmpty(reportCaseDetail.getBugs()) ? 0 : reportCaseDetail.getBugs().size()));
reportSummary.setPlanCount(genParam.getIntegrated() ? genParam.getPlanCount() : 0);
testPlanReportSummaryMapper.insertSelective(reportSummary);
// 报告关联数据
TestPlanReportDetailCaseDTO reportCaseDetail = genReportDetail(genParam, moduleParam, report, childPlanIds);
// 报告统计内容
TestPlanReportSummary reportSummary = new TestPlanReportSummary();
reportSummary.setId(IDGenerator.nextStr());
reportSummary.setTestPlanReportId(report.getId());
reportSummary.setFunctionalCaseCount((long) (CollectionUtils.isEmpty(reportCaseDetail.getFunctionCases()) ? 0 : reportCaseDetail.getFunctionCases().size()));
reportSummary.setApiCaseCount((long) (CollectionUtils.isEmpty(reportCaseDetail.getApiCases()) ? 0 : reportCaseDetail.getApiCases().size()));
reportSummary.setApiScenarioCount((long) (CollectionUtils.isEmpty(reportCaseDetail.getApiScenarios()) ? 0 : reportCaseDetail.getApiScenarios().size()));
reportSummary.setBugCount((long) (CollectionUtils.isEmpty(reportCaseDetail.getBugs()) ? 0 : reportCaseDetail.getBugs().size()));
reportSummary.setPlanCount(genParam.getIntegrated() ? (long) childPlanIds.size() : 0);
testPlanReportSummaryMapper.insertSelective(reportSummary);
// 报告日志
testPlanReportLogService.addLog(report, currentUser, genParam.getProjectId(), logPath);
return report;
}
/**
* 生成报告的关联数据
*
* @param genParam 报告生成的参数
* @param moduleParam 模块参数
* @param report 报告
*/
private TestPlanReportDetailCaseDTO genReportDetail(TestPlanReportGenPreParam genParam, TestPlanReportModuleParam moduleParam, TestPlanReport report) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
// 功能用例
List<TestPlanReportFunctionCase> reportFunctionCases = extTestPlanReportFunctionalCaseMapper.getPlanExecuteCases(genParam.getTestPlanId());
if (CollectionUtils.isNotEmpty(reportFunctionCases)) {
// 用例等级
List<String> ids = reportFunctionCases.stream().map(TestPlanReportFunctionCase::getFunctionCaseId).distinct().toList();
List<SelectOption> options = extTestPlanReportFunctionalCaseMapper.getCasePriorityByIds(ids);
Map<String, String> casePriorityMap = options.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
reportFunctionCases.forEach(reportFunctionalCase -> {
reportFunctionalCase.setId(IDGenerator.nextStr());
reportFunctionalCase.setTestPlanReportId(report.getId());
reportFunctionalCase.setFunctionCaseModule(moduleParam.getFunctionalModuleMap().getOrDefault(reportFunctionalCase.getFunctionCaseModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportFunctionalCase.getFunctionCaseModule()));
reportFunctionalCase.setFunctionCasePriority(casePriorityMap.get(reportFunctionalCase.getFunctionCaseId()));
});
// 插入计划功能用例关联数据 -> 报告内容
TestPlanReportFunctionCaseMapper batchMapper = sqlSession.getMapper(TestPlanReportFunctionCaseMapper.class);
batchMapper.batchInsert(reportFunctionCases);
}
/**
* 生成报告的关联数据
* @param genParam 报告生成的参数
* @param moduleParam 模块参数
* @param report 报告
*/
private TestPlanReportDetailCaseDTO genReportDetail(TestPlanReportGenPreParam genParam, TestPlanReportModuleParam moduleParam, TestPlanReport report, List<String> childPlanIds) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
// 功能用例
List<TestPlanReportFunctionCase> reportFunctionCases;
if (genParam.getIntegrated()) {
reportFunctionCases = CollectionUtils.isEmpty(childPlanIds) ? new ArrayList<>() : extTestPlanReportFunctionalCaseMapper.getGroupPlanExecuteCases(childPlanIds);
} else {
reportFunctionCases = extTestPlanReportFunctionalCaseMapper.getPlanExecuteCases(genParam.getTestPlanId());
}
if (CollectionUtils.isNotEmpty(reportFunctionCases)) {
// 用例等级
List<String> ids = reportFunctionCases.stream().map(TestPlanReportFunctionCase::getFunctionCaseId).distinct().toList();
List<SelectOption> options = extTestPlanReportFunctionalCaseMapper.getCasePriorityByIds(ids);
Map<String, String> casePriorityMap = options.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
reportFunctionCases.forEach(reportFunctionalCase -> {
reportFunctionalCase.setId(IDGenerator.nextStr());
reportFunctionalCase.setTestPlanReportId(report.getId());
reportFunctionalCase.setFunctionCaseModule(moduleParam.getFunctionalModuleMap().getOrDefault(reportFunctionalCase.getFunctionCaseModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportFunctionalCase.getFunctionCaseModule()));
reportFunctionalCase.setFunctionCasePriority(casePriorityMap.get(reportFunctionalCase.getFunctionCaseId()));
});
// 插入计划功能用例关联数据 -> 报告内容
TestPlanReportFunctionCaseMapper batchMapper = sqlSession.getMapper(TestPlanReportFunctionCaseMapper.class);
batchMapper.batchInsert(reportFunctionCases);
}
// 接口用例
List<TestPlanReportApiCase> reportApiCases = extTestPlanReportApiCaseMapper.getPlanExecuteCases(genParam.getTestPlanId());
if (CollectionUtils.isNotEmpty(reportApiCases)) {
reportApiCases.forEach(reportApiCase -> {
reportApiCase.setId(IDGenerator.nextStr());
reportApiCase.setTestPlanReportId(report.getId());
reportApiCase.setApiCaseModule(moduleParam.getApiModuleMap().getOrDefault(reportApiCase.getApiCaseModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportApiCase.getApiCaseModule()));
});
// 插入计划接口用例关联数据 -> 报告内容
TestPlanReportApiCaseMapper batchMapper = sqlSession.getMapper(TestPlanReportApiCaseMapper.class);
batchMapper.batchInsert(reportApiCases);
}
// 接口用例
List<TestPlanReportApiCase> reportApiCases;
if (genParam.getIntegrated()) {
reportApiCases = CollectionUtils.isEmpty(childPlanIds) ? new ArrayList<>() : extTestPlanReportApiCaseMapper.getGroupExecuteCases(childPlanIds);
} else {
reportApiCases = extTestPlanReportApiCaseMapper.getPlanExecuteCases(genParam.getTestPlanId());
}
if (CollectionUtils.isNotEmpty(reportApiCases)) {
reportApiCases.forEach(reportApiCase -> {
reportApiCase.setId(IDGenerator.nextStr());
reportApiCase.setTestPlanReportId(report.getId());
reportApiCase.setApiCaseModule(moduleParam.getApiModuleMap().getOrDefault(reportApiCase.getApiCaseModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportApiCase.getApiCaseModule()));
});
// 插入计划接口用例关联数据 -> 报告内容
TestPlanReportApiCaseMapper batchMapper = sqlSession.getMapper(TestPlanReportApiCaseMapper.class);
batchMapper.batchInsert(reportApiCases);
}
// 场景用例
List<TestPlanReportApiScenario> reportApiScenarios = extTestPlanReportApiScenarioMapper.getPlanExecuteCases(genParam.getTestPlanId());
if (CollectionUtils.isNotEmpty(reportApiScenarios)) {
reportApiScenarios.forEach(reportApiScenario -> {
reportApiScenario.setId(IDGenerator.nextStr());
reportApiScenario.setTestPlanReportId(report.getId());
reportApiScenario.setApiScenarioModule(moduleParam.getScenarioModuleMap().getOrDefault(reportApiScenario.getApiScenarioModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportApiScenario.getApiScenarioModule()));
});
// 插入计划场景用例关联数据 -> 报告内容
TestPlanReportApiScenarioMapper batchMapper = sqlSession.getMapper(TestPlanReportApiScenarioMapper.class);
batchMapper.batchInsert(reportApiScenarios);
}
// 场景用例
List<TestPlanReportApiScenario> reportApiScenarios;
if (genParam.getIntegrated()) {
reportApiScenarios = CollectionUtils.isEmpty(childPlanIds) ? new ArrayList<>() : extTestPlanReportApiScenarioMapper.getGroupExecuteCases(childPlanIds);
} else {
reportApiScenarios = extTestPlanReportApiScenarioMapper.getPlanExecuteCases(genParam.getTestPlanId());
}
if (CollectionUtils.isNotEmpty(reportApiScenarios)) {
reportApiScenarios.forEach(reportApiScenario -> {
reportApiScenario.setId(IDGenerator.nextStr());
reportApiScenario.setTestPlanReportId(report.getId());
reportApiScenario.setApiScenarioModule(moduleParam.getScenarioModuleMap().getOrDefault(reportApiScenario.getApiScenarioModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportApiScenario.getApiScenarioModule()));
});
// 插入计划场景用例关联数据 -> 报告内容
TestPlanReportApiScenarioMapper batchMapper = sqlSession.getMapper(TestPlanReportApiScenarioMapper.class);
batchMapper.batchInsert(reportApiScenarios);
}
// 计划报告缺陷内容
List<TestPlanReportBug> reportBugs = extTestPlanReportBugMapper.getPlanBugs(genParam.getTestPlanId());
// MS处理人会与第三方的值冲突, 分开查询
List<SelectOption> headerOptions = bugCommonService.getHeaderHandlerOption(genParam.getProjectId());
Map<String, String> headerHandleUserMap = headerOptions.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
List<SelectOption> localOptions = bugCommonService.getLocalHandlerOption(genParam.getProjectId());
Map<String, String> localHandleUserMap = localOptions.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
Map<String, String> allStatusMap = bugCommonService.getAllStatusMap(genParam.getProjectId());
reportBugs.forEach(reportBug -> {
reportBug.setId(IDGenerator.nextStr());
reportBug.setTestPlanReportId(report.getId());
reportBug.setBugHandleUser(headerHandleUserMap.containsKey(reportBug.getBugHandleUser()) ?
headerHandleUserMap.get(reportBug.getBugHandleUser()) : localHandleUserMap.get(reportBug.getBugHandleUser()));
reportBug.setBugStatus(allStatusMap.get(reportBug.getBugStatus()));
});
if (CollectionUtils.isNotEmpty(reportBugs)) {
// 插入计划关联用例缺陷数据(去重) -> 报告内容
TestPlanReportBugMapper batchMapper = sqlSession.getMapper(TestPlanReportBugMapper.class);
batchMapper.batchInsert(reportBugs);
}
// 计划报告缺陷内容
List<TestPlanReportBug> reportBugs;
if (genParam.getIntegrated()) {
reportBugs = extTestPlanReportBugMapper.getGroupBugs(childPlanIds);
} else {
reportBugs = extTestPlanReportBugMapper.getPlanBugs(genParam.getTestPlanId());;
}
// MS处理人会与第三方的值冲突, 分开查询
List<SelectOption> headerOptions = bugCommonService.getHeaderHandlerOption(genParam.getProjectId());
Map<String, String> headerHandleUserMap = headerOptions.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
List<SelectOption> localOptions = bugCommonService.getLocalHandlerOption(genParam.getProjectId());
Map<String, String> localHandleUserMap = localOptions.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText));
Map<String, String> allStatusMap = bugCommonService.getAllStatusMap(genParam.getProjectId());
reportBugs.forEach(reportBug -> {
reportBug.setId(IDGenerator.nextStr());
reportBug.setTestPlanReportId(report.getId());
reportBug.setBugHandleUser(headerHandleUserMap.containsKey(reportBug.getBugHandleUser()) ?
headerHandleUserMap.get(reportBug.getBugHandleUser()) : localHandleUserMap.get(reportBug.getBugHandleUser()));
reportBug.setBugStatus(allStatusMap.get(reportBug.getBugStatus()));
});
if (CollectionUtils.isNotEmpty(reportBugs)) {
// 插入计划关联用例缺陷数据(去重) -> 报告内容
TestPlanReportBugMapper batchMapper = sqlSession.getMapper(TestPlanReportBugMapper.class);
batchMapper.batchInsert(reportBugs);
}
sqlSession.flushStatements();
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
@ -469,25 +487,24 @@ public class TestPlanReportService {
return extTestPlanReportBugMapper.list(request);
}
/**
* 分页查询报告详情-用例分页数据
*
* @param request 请求参数
* @return 用例分页数据
*/
public List<ReportDetailCasePageDTO> listReportDetailCases(TestPlanReportDetailPageRequest request, String caseType) {
List<ReportDetailCasePageDTO> detailCases = new ArrayList<>();
switch (caseType) {
case AssociateCaseType.FUNCTIONAL -> detailCases = extTestPlanReportFunctionalCaseMapper.list(request);
case AssociateCaseType.API_CASE -> detailCases = extTestPlanReportApiCaseMapper.list(request);
case AssociateCaseType.API_SCENARIO -> detailCases = extTestPlanReportApiScenarioMapper.list(request);
default -> detailCases = new ArrayList<>();
}
List<String> distinctUserIds = detailCases.stream().map(ReportDetailCasePageDTO::getExecuteUser).distinct().toList();
Map<String, String> userMap = getUserMap(distinctUserIds);
detailCases.forEach(detailCase -> detailCase.setExecuteUser(userMap.getOrDefault(detailCase.getExecuteUser(), detailCase.getExecuteUser())));
return detailCases;
}
/**
* 分页查询报告详情-用例分页数据
* @param request 请求参数
* @return 用例分页数据
*/
public List<ReportDetailCasePageDTO> listReportDetailCases(TestPlanReportDetailPageRequest request, String caseType) {
List<ReportDetailCasePageDTO> detailCases;
switch (caseType) {
case AssociateCaseType.FUNCTIONAL -> detailCases = extTestPlanReportFunctionalCaseMapper.list(request);
case AssociateCaseType.API_CASE -> detailCases = extTestPlanReportApiCaseMapper.list(request);
case AssociateCaseType.API_SCENARIO -> detailCases = extTestPlanReportApiScenarioMapper.list(request);
default -> detailCases = new ArrayList<>();
}
List<String> distinctUserIds = detailCases.stream().map(ReportDetailCasePageDTO::getExecuteUser).distinct().toList();
Map<String, String> userMap = getUserMap(distinctUserIds);
detailCases.forEach(detailCase -> detailCase.setExecuteUser(userMap.getOrDefault(detailCase.getExecuteUser(), detailCase.getExecuteUser())));
return detailCases;
}
/**
* 汇总规划生成的报告
@ -685,26 +702,24 @@ public class TestPlanReportService {
}
}
/**
* 构建预生成报告的参数
*
* @param genRequest 报告请求参数
* @return 预生成报告参数
*/
private TestPlanReportGenPreParam buildReportGenParam(TestPlanReportGenRequest genRequest, TestPlan testPlan, Long groupPlanCount, String groupReportId) {
TestPlanReportGenPreParam genPreParam = new TestPlanReportGenPreParam();
BeanUtils.copyBean(genPreParam, genRequest);
genPreParam.setTestPlanName(testPlan.getName());
genPreParam.setStartTime(System.currentTimeMillis());
// 报告预生成时, 执行状态为未执行, 结果状态为'-'
genPreParam.setExecStatus(ExecStatus.PENDING.name());
genPreParam.setResultStatus("-");
// 是否集成报告(计划组报告), 目前根据是否计划组来区分
genPreParam.setIntegrated(StringUtils.equals(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_GROUP));
genPreParam.setPlanCount(groupPlanCount);
genPreParam.setGroupReportId(groupReportId);
return genPreParam;
}
/**
* 构建预生成报告的参数
* @param genRequest 报告请求参数
* @return 预生成报告参数
*/
private TestPlanReportGenPreParam buildReportGenParam(TestPlanReportGenRequest genRequest, TestPlan testPlan, String groupReportId) {
TestPlanReportGenPreParam genPreParam = new TestPlanReportGenPreParam();
BeanUtils.copyBean(genPreParam, genRequest);
genPreParam.setTestPlanName(testPlan.getName());
genPreParam.setStartTime(System.currentTimeMillis());
// 报告预生成时, 执行状态为未执行, 结果状态为'-'
genPreParam.setExecStatus(ExecStatus.PENDING.name());
genPreParam.setResultStatus("-");
// 是否集成报告(计划组报告), 目前根据是否计划组来区分
genPreParam.setIntegrated(StringUtils.equals(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_GROUP));
genPreParam.setGroupReportId(groupReportId);
return genPreParam;
}
/**
* 统计执行状态的用例数量