diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReport.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReport.java index 03d046f76f..14d46775ca 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReport.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReport.java @@ -41,7 +41,7 @@ public class TestPlanReport implements Serializable { @Schema(description = "开始时间;计划开始执行的时间") private Long startTime; - @Schema(description = "结束时间;计划执行结束的时间") + @Schema(description = "结束时间;计划结束执行的时间") private Long endTime; @Schema(description = "执行状态", requiredMode = Schema.RequiredMode.REQUIRED) @@ -79,6 +79,12 @@ public class TestPlanReport implements Serializable { @NotNull(message = "{test_plan_report.deleted.not_blank}", groups = {Created.class}) private Boolean deleted; + @Schema(description = "执行率") + private Double executeRate; + + @Schema(description = "独立报告的父级ID") + private String parentId; + private static final long serialVersionUID = 1L; public enum Column { @@ -97,7 +103,9 @@ public class TestPlanReport implements Serializable { passThreshold("pass_threshold", "passThreshold", "DECIMAL", false), projectId("project_id", "projectId", "VARCHAR", false), integrated("integrated", "integrated", "BIT", false), - deleted("deleted", "deleted", "BIT", false); + deleted("deleted", "deleted", "BIT", false), + executeRate("execute_rate", "executeRate", "DECIMAL", false), + parentId("parent_id", "parentId", "VARCHAR", false); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiCase.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiCase.java new file mode 100644 index 0000000000..a4dee6858b --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiCase.java @@ -0,0 +1,141 @@ +package io.metersphere.plan.domain; + +import io.metersphere.validation.groups.Created; +import io.metersphere.validation.groups.Updated; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; + +@Data +public class TestPlanReportApiCase implements Serializable { + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report_api_case.id.not_blank}", groups = {Updated.class}) + @Size(min = 1, max = 50, message = "{test_plan_report_api_case.id.length_range}", groups = {Created.class, Updated.class}) + private String id; + + @Schema(description = "测试计划报告ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report_api_case.test_plan_report_id.not_blank}", groups = {Created.class}) + @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_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}) + private String testPlanApiCaseId; + + @Schema(description = "接口用例ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report_api_case.api_case_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{test_plan_report_api_case.api_case_id.length_range}", groups = {Created.class, Updated.class}) + private String apiCaseId; + + @Schema(description = "接口用例业务ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{test_plan_report_api_case.api_case_num.not_blank}", groups = {Created.class}) + private Long apiCaseNum; + + @Schema(description = "接口用例名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report_api_case.api_case_name.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 255, message = "{test_plan_report_api_case.api_case_name.length_range}", groups = {Created.class, Updated.class}) + private String apiCaseName; + + @Schema(description = "接口用例所属模块") + private String apiCaseModule; + + @Schema(description = "接口用例等级") + private String apiCasePriority; + + @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}) + private String apiCaseExecuteResult; + + private static final long serialVersionUID = 1L; + + public enum Column { + id("id", "id", "VARCHAR", false), + testPlanReportId("test_plan_report_id", "testPlanReportId", "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), + apiCaseName("api_case_name", "apiCaseName", "VARCHAR", false), + 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); + + private static final String BEGINNING_DELIMITER = "`"; + + private static final String ENDING_DELIMITER = "`"; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiCaseExample.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiCaseExample.java new file mode 100644 index 0000000000..d99b348f51 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiCaseExample.java @@ -0,0 +1,890 @@ +package io.metersphere.plan.domain; + +import java.util.ArrayList; +import java.util.List; + +public class TestPlanReportApiCaseExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public TestPlanReportApiCaseExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdIsNull() { + addCriterion("test_plan_report_id is null"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdIsNotNull() { + addCriterion("test_plan_report_id is not null"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdEqualTo(String value) { + addCriterion("test_plan_report_id =", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdNotEqualTo(String value) { + addCriterion("test_plan_report_id <>", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdGreaterThan(String value) { + addCriterion("test_plan_report_id >", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdGreaterThanOrEqualTo(String value) { + addCriterion("test_plan_report_id >=", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdLessThan(String value) { + addCriterion("test_plan_report_id <", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdLessThanOrEqualTo(String value) { + addCriterion("test_plan_report_id <=", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdLike(String value) { + addCriterion("test_plan_report_id like", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdNotLike(String value) { + addCriterion("test_plan_report_id not like", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdIn(List values) { + addCriterion("test_plan_report_id in", values, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdNotIn(List values) { + addCriterion("test_plan_report_id not in", values, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdBetween(String value1, String value2) { + addCriterion("test_plan_report_id between", value1, value2, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdNotBetween(String value1, String value2) { + addCriterion("test_plan_report_id not between", value1, value2, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdIsNull() { + addCriterion("test_plan_api_case_id is null"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdIsNotNull() { + addCriterion("test_plan_api_case_id is not null"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdEqualTo(String value) { + addCriterion("test_plan_api_case_id =", value, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdNotEqualTo(String value) { + addCriterion("test_plan_api_case_id <>", value, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdGreaterThan(String value) { + addCriterion("test_plan_api_case_id >", value, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdGreaterThanOrEqualTo(String value) { + addCriterion("test_plan_api_case_id >=", value, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdLessThan(String value) { + addCriterion("test_plan_api_case_id <", value, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdLessThanOrEqualTo(String value) { + addCriterion("test_plan_api_case_id <=", value, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdLike(String value) { + addCriterion("test_plan_api_case_id like", value, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdNotLike(String value) { + addCriterion("test_plan_api_case_id not like", value, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdIn(List values) { + addCriterion("test_plan_api_case_id in", values, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdNotIn(List values) { + addCriterion("test_plan_api_case_id not in", values, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdBetween(String value1, String value2) { + addCriterion("test_plan_api_case_id between", value1, value2, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiCaseIdNotBetween(String value1, String value2) { + addCriterion("test_plan_api_case_id not between", value1, value2, "testPlanApiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdIsNull() { + addCriterion("api_case_id is null"); + return (Criteria) this; + } + + public Criteria andApiCaseIdIsNotNull() { + addCriterion("api_case_id is not null"); + return (Criteria) this; + } + + public Criteria andApiCaseIdEqualTo(String value) { + addCriterion("api_case_id =", value, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdNotEqualTo(String value) { + addCriterion("api_case_id <>", value, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdGreaterThan(String value) { + addCriterion("api_case_id >", value, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdGreaterThanOrEqualTo(String value) { + addCriterion("api_case_id >=", value, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdLessThan(String value) { + addCriterion("api_case_id <", value, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdLessThanOrEqualTo(String value) { + addCriterion("api_case_id <=", value, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdLike(String value) { + addCriterion("api_case_id like", value, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdNotLike(String value) { + addCriterion("api_case_id not like", value, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdIn(List values) { + addCriterion("api_case_id in", values, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdNotIn(List values) { + addCriterion("api_case_id not in", values, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdBetween(String value1, String value2) { + addCriterion("api_case_id between", value1, value2, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseIdNotBetween(String value1, String value2) { + addCriterion("api_case_id not between", value1, value2, "apiCaseId"); + return (Criteria) this; + } + + public Criteria andApiCaseNumIsNull() { + addCriterion("api_case_num is null"); + return (Criteria) this; + } + + public Criteria andApiCaseNumIsNotNull() { + addCriterion("api_case_num is not null"); + return (Criteria) this; + } + + public Criteria andApiCaseNumEqualTo(Long value) { + addCriterion("api_case_num =", value, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumNotEqualTo(Long value) { + addCriterion("api_case_num <>", value, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumGreaterThan(Long value) { + addCriterion("api_case_num >", value, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumGreaterThanOrEqualTo(Long value) { + addCriterion("api_case_num >=", value, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumLessThan(Long value) { + addCriterion("api_case_num <", value, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumLessThanOrEqualTo(Long value) { + addCriterion("api_case_num <=", value, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumIn(List values) { + addCriterion("api_case_num in", values, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumNotIn(List values) { + addCriterion("api_case_num not in", values, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumBetween(Long value1, Long value2) { + addCriterion("api_case_num between", value1, value2, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNumNotBetween(Long value1, Long value2) { + addCriterion("api_case_num not between", value1, value2, "apiCaseNum"); + return (Criteria) this; + } + + public Criteria andApiCaseNameIsNull() { + addCriterion("api_case_name is null"); + return (Criteria) this; + } + + public Criteria andApiCaseNameIsNotNull() { + addCriterion("api_case_name is not null"); + return (Criteria) this; + } + + public Criteria andApiCaseNameEqualTo(String value) { + addCriterion("api_case_name =", value, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameNotEqualTo(String value) { + addCriterion("api_case_name <>", value, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameGreaterThan(String value) { + addCriterion("api_case_name >", value, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameGreaterThanOrEqualTo(String value) { + addCriterion("api_case_name >=", value, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameLessThan(String value) { + addCriterion("api_case_name <", value, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameLessThanOrEqualTo(String value) { + addCriterion("api_case_name <=", value, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameLike(String value) { + addCriterion("api_case_name like", value, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameNotLike(String value) { + addCriterion("api_case_name not like", value, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameIn(List values) { + addCriterion("api_case_name in", values, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameNotIn(List values) { + addCriterion("api_case_name not in", values, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameBetween(String value1, String value2) { + addCriterion("api_case_name between", value1, value2, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseNameNotBetween(String value1, String value2) { + addCriterion("api_case_name not between", value1, value2, "apiCaseName"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleIsNull() { + addCriterion("api_case_module is null"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleIsNotNull() { + addCriterion("api_case_module is not null"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleEqualTo(String value) { + addCriterion("api_case_module =", value, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleNotEqualTo(String value) { + addCriterion("api_case_module <>", value, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleGreaterThan(String value) { + addCriterion("api_case_module >", value, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleGreaterThanOrEqualTo(String value) { + addCriterion("api_case_module >=", value, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleLessThan(String value) { + addCriterion("api_case_module <", value, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleLessThanOrEqualTo(String value) { + addCriterion("api_case_module <=", value, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleLike(String value) { + addCriterion("api_case_module like", value, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleNotLike(String value) { + addCriterion("api_case_module not like", value, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleIn(List values) { + addCriterion("api_case_module in", values, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleNotIn(List values) { + addCriterion("api_case_module not in", values, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleBetween(String value1, String value2) { + addCriterion("api_case_module between", value1, value2, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCaseModuleNotBetween(String value1, String value2) { + addCriterion("api_case_module not between", value1, value2, "apiCaseModule"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityIsNull() { + addCriterion("api_case_priority is null"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityIsNotNull() { + addCriterion("api_case_priority is not null"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityEqualTo(String value) { + addCriterion("api_case_priority =", value, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityNotEqualTo(String value) { + addCriterion("api_case_priority <>", value, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityGreaterThan(String value) { + addCriterion("api_case_priority >", value, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityGreaterThanOrEqualTo(String value) { + addCriterion("api_case_priority >=", value, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityLessThan(String value) { + addCriterion("api_case_priority <", value, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityLessThanOrEqualTo(String value) { + addCriterion("api_case_priority <=", value, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityLike(String value) { + addCriterion("api_case_priority like", value, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityNotLike(String value) { + addCriterion("api_case_priority not like", value, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityIn(List values) { + addCriterion("api_case_priority in", values, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityNotIn(List values) { + addCriterion("api_case_priority not in", values, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityBetween(String value1, String value2) { + addCriterion("api_case_priority between", value1, value2, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCasePriorityNotBetween(String value1, String value2) { + addCriterion("api_case_priority not between", value1, value2, "apiCasePriority"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserIsNull() { + addCriterion("api_case_execute_user is null"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserIsNotNull() { + addCriterion("api_case_execute_user is not null"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserEqualTo(String value) { + addCriterion("api_case_execute_user =", value, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserNotEqualTo(String value) { + addCriterion("api_case_execute_user <>", value, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserGreaterThan(String value) { + addCriterion("api_case_execute_user >", value, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserGreaterThanOrEqualTo(String value) { + addCriterion("api_case_execute_user >=", value, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserLessThan(String value) { + addCriterion("api_case_execute_user <", value, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserLessThanOrEqualTo(String value) { + addCriterion("api_case_execute_user <=", value, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserLike(String value) { + addCriterion("api_case_execute_user like", value, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserNotLike(String value) { + addCriterion("api_case_execute_user not like", value, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserIn(List values) { + addCriterion("api_case_execute_user in", values, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserNotIn(List values) { + addCriterion("api_case_execute_user not in", values, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserBetween(String value1, String value2) { + addCriterion("api_case_execute_user between", value1, value2, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteUserNotBetween(String value1, String value2) { + addCriterion("api_case_execute_user not between", value1, value2, "apiCaseExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultIsNull() { + addCriterion("api_case_execute_result is null"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultIsNotNull() { + addCriterion("api_case_execute_result is not null"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultEqualTo(String value) { + addCriterion("api_case_execute_result =", value, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultNotEqualTo(String value) { + addCriterion("api_case_execute_result <>", value, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultGreaterThan(String value) { + addCriterion("api_case_execute_result >", value, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultGreaterThanOrEqualTo(String value) { + addCriterion("api_case_execute_result >=", value, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultLessThan(String value) { + addCriterion("api_case_execute_result <", value, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultLessThanOrEqualTo(String value) { + addCriterion("api_case_execute_result <=", value, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultLike(String value) { + addCriterion("api_case_execute_result like", value, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultNotLike(String value) { + addCriterion("api_case_execute_result not like", value, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultIn(List values) { + addCriterion("api_case_execute_result in", values, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultNotIn(List values) { + addCriterion("api_case_execute_result not in", values, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultBetween(String value1, String value2) { + addCriterion("api_case_execute_result between", value1, value2, "apiCaseExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiCaseExecuteResultNotBetween(String value1, String value2) { + addCriterion("api_case_execute_result not between", value1, value2, "apiCaseExecuteResult"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiScenario.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiScenario.java new file mode 100644 index 0000000000..b72fde9194 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiScenario.java @@ -0,0 +1,141 @@ +package io.metersphere.plan.domain; + +import io.metersphere.validation.groups.Created; +import io.metersphere.validation.groups.Updated; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; + +@Data +public class TestPlanReportApiScenario implements Serializable { + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report_api_scenario.id.not_blank}", groups = {Updated.class}) + @Size(min = 1, max = 50, message = "{test_plan_report_api_scenario.id.length_range}", groups = {Created.class, Updated.class}) + private String id; + + @Schema(description = "测试计划报告ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report_api_scenario.test_plan_report_id.not_blank}", groups = {Created.class}) + @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_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}) + private String testPlanApiScenarioId; + + @Schema(description = "场景用例ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report_api_scenario.api_scenario_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{test_plan_report_api_scenario.api_scenario_id.length_range}", groups = {Created.class, Updated.class}) + private String apiScenarioId; + + @Schema(description = "场景用例业务ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{test_plan_report_api_scenario.api_scenario_num.not_blank}", groups = {Created.class}) + private Long apiScenarioNum; + + @Schema(description = "场景用例名称", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report_api_scenario.api_scenario_name.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 255, message = "{test_plan_report_api_scenario.api_scenario_name.length_range}", groups = {Created.class, Updated.class}) + private String apiScenarioName; + + @Schema(description = "场景用例所属模块") + private String apiScenarioModule; + + @Schema(description = "场景用例等级") + private String apiScenarioPriority; + + @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}) + private String apiScenarioExecuteResult; + + private static final long serialVersionUID = 1L; + + public enum Column { + id("id", "id", "VARCHAR", false), + testPlanReportId("test_plan_report_id", "testPlanReportId", "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), + apiScenarioName("api_scenario_name", "apiScenarioName", "VARCHAR", false), + 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); + + private static final String BEGINNING_DELIMITER = "`"; + + private static final String ENDING_DELIMITER = "`"; + + private final String column; + + private final boolean isColumnNameDelimited; + + private final String javaProperty; + + private final String jdbcType; + + public String value() { + return this.column; + } + + public String getValue() { + return this.column; + } + + public String getJavaProperty() { + return this.javaProperty; + } + + public String getJdbcType() { + return this.jdbcType; + } + + Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) { + this.column = column; + this.javaProperty = javaProperty; + this.jdbcType = jdbcType; + this.isColumnNameDelimited = isColumnNameDelimited; + } + + public String desc() { + return this.getEscapedColumnName() + " DESC"; + } + + public String asc() { + return this.getEscapedColumnName() + " ASC"; + } + + public static Column[] excludes(Column ... excludes) { + ArrayList columns = new ArrayList<>(Arrays.asList(Column.values())); + if (excludes != null && excludes.length > 0) { + columns.removeAll(new ArrayList<>(Arrays.asList(excludes))); + } + return columns.toArray(new Column[]{}); + } + + public static Column[] all() { + return Column.values(); + } + + public String getEscapedColumnName() { + if (this.isColumnNameDelimited) { + return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString(); + } else { + return this.column; + } + } + + public String getAliasedEscapedColumnName() { + return this.getEscapedColumnName(); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiScenarioExample.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiScenarioExample.java new file mode 100644 index 0000000000..bc65d950cf --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportApiScenarioExample.java @@ -0,0 +1,890 @@ +package io.metersphere.plan.domain; + +import java.util.ArrayList; +import java.util.List; + +public class TestPlanReportApiScenarioExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public TestPlanReportApiScenarioExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdIsNull() { + addCriterion("test_plan_report_id is null"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdIsNotNull() { + addCriterion("test_plan_report_id is not null"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdEqualTo(String value) { + addCriterion("test_plan_report_id =", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdNotEqualTo(String value) { + addCriterion("test_plan_report_id <>", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdGreaterThan(String value) { + addCriterion("test_plan_report_id >", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdGreaterThanOrEqualTo(String value) { + addCriterion("test_plan_report_id >=", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdLessThan(String value) { + addCriterion("test_plan_report_id <", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdLessThanOrEqualTo(String value) { + addCriterion("test_plan_report_id <=", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdLike(String value) { + addCriterion("test_plan_report_id like", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdNotLike(String value) { + addCriterion("test_plan_report_id not like", value, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdIn(List values) { + addCriterion("test_plan_report_id in", values, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdNotIn(List values) { + addCriterion("test_plan_report_id not in", values, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdBetween(String value1, String value2) { + addCriterion("test_plan_report_id between", value1, value2, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanReportIdNotBetween(String value1, String value2) { + addCriterion("test_plan_report_id not between", value1, value2, "testPlanReportId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdIsNull() { + addCriterion("test_plan_api_scenario_id is null"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdIsNotNull() { + addCriterion("test_plan_api_scenario_id is not null"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdEqualTo(String value) { + addCriterion("test_plan_api_scenario_id =", value, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdNotEqualTo(String value) { + addCriterion("test_plan_api_scenario_id <>", value, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdGreaterThan(String value) { + addCriterion("test_plan_api_scenario_id >", value, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdGreaterThanOrEqualTo(String value) { + addCriterion("test_plan_api_scenario_id >=", value, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdLessThan(String value) { + addCriterion("test_plan_api_scenario_id <", value, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdLessThanOrEqualTo(String value) { + addCriterion("test_plan_api_scenario_id <=", value, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdLike(String value) { + addCriterion("test_plan_api_scenario_id like", value, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdNotLike(String value) { + addCriterion("test_plan_api_scenario_id not like", value, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdIn(List values) { + addCriterion("test_plan_api_scenario_id in", values, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdNotIn(List values) { + addCriterion("test_plan_api_scenario_id not in", values, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdBetween(String value1, String value2) { + addCriterion("test_plan_api_scenario_id between", value1, value2, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andTestPlanApiScenarioIdNotBetween(String value1, String value2) { + addCriterion("test_plan_api_scenario_id not between", value1, value2, "testPlanApiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdIsNull() { + addCriterion("api_scenario_id is null"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdIsNotNull() { + addCriterion("api_scenario_id is not null"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdEqualTo(String value) { + addCriterion("api_scenario_id =", value, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdNotEqualTo(String value) { + addCriterion("api_scenario_id <>", value, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdGreaterThan(String value) { + addCriterion("api_scenario_id >", value, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdGreaterThanOrEqualTo(String value) { + addCriterion("api_scenario_id >=", value, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdLessThan(String value) { + addCriterion("api_scenario_id <", value, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdLessThanOrEqualTo(String value) { + addCriterion("api_scenario_id <=", value, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdLike(String value) { + addCriterion("api_scenario_id like", value, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdNotLike(String value) { + addCriterion("api_scenario_id not like", value, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdIn(List values) { + addCriterion("api_scenario_id in", values, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdNotIn(List values) { + addCriterion("api_scenario_id not in", values, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdBetween(String value1, String value2) { + addCriterion("api_scenario_id between", value1, value2, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioIdNotBetween(String value1, String value2) { + addCriterion("api_scenario_id not between", value1, value2, "apiScenarioId"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumIsNull() { + addCriterion("api_scenario_num is null"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumIsNotNull() { + addCriterion("api_scenario_num is not null"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumEqualTo(Long value) { + addCriterion("api_scenario_num =", value, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumNotEqualTo(Long value) { + addCriterion("api_scenario_num <>", value, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumGreaterThan(Long value) { + addCriterion("api_scenario_num >", value, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumGreaterThanOrEqualTo(Long value) { + addCriterion("api_scenario_num >=", value, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumLessThan(Long value) { + addCriterion("api_scenario_num <", value, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumLessThanOrEqualTo(Long value) { + addCriterion("api_scenario_num <=", value, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumIn(List values) { + addCriterion("api_scenario_num in", values, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumNotIn(List values) { + addCriterion("api_scenario_num not in", values, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumBetween(Long value1, Long value2) { + addCriterion("api_scenario_num between", value1, value2, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNumNotBetween(Long value1, Long value2) { + addCriterion("api_scenario_num not between", value1, value2, "apiScenarioNum"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameIsNull() { + addCriterion("api_scenario_name is null"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameIsNotNull() { + addCriterion("api_scenario_name is not null"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameEqualTo(String value) { + addCriterion("api_scenario_name =", value, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameNotEqualTo(String value) { + addCriterion("api_scenario_name <>", value, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameGreaterThan(String value) { + addCriterion("api_scenario_name >", value, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameGreaterThanOrEqualTo(String value) { + addCriterion("api_scenario_name >=", value, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameLessThan(String value) { + addCriterion("api_scenario_name <", value, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameLessThanOrEqualTo(String value) { + addCriterion("api_scenario_name <=", value, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameLike(String value) { + addCriterion("api_scenario_name like", value, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameNotLike(String value) { + addCriterion("api_scenario_name not like", value, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameIn(List values) { + addCriterion("api_scenario_name in", values, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameNotIn(List values) { + addCriterion("api_scenario_name not in", values, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameBetween(String value1, String value2) { + addCriterion("api_scenario_name between", value1, value2, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioNameNotBetween(String value1, String value2) { + addCriterion("api_scenario_name not between", value1, value2, "apiScenarioName"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleIsNull() { + addCriterion("api_scenario_module is null"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleIsNotNull() { + addCriterion("api_scenario_module is not null"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleEqualTo(String value) { + addCriterion("api_scenario_module =", value, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleNotEqualTo(String value) { + addCriterion("api_scenario_module <>", value, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleGreaterThan(String value) { + addCriterion("api_scenario_module >", value, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleGreaterThanOrEqualTo(String value) { + addCriterion("api_scenario_module >=", value, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleLessThan(String value) { + addCriterion("api_scenario_module <", value, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleLessThanOrEqualTo(String value) { + addCriterion("api_scenario_module <=", value, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleLike(String value) { + addCriterion("api_scenario_module like", value, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleNotLike(String value) { + addCriterion("api_scenario_module not like", value, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleIn(List values) { + addCriterion("api_scenario_module in", values, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleNotIn(List values) { + addCriterion("api_scenario_module not in", values, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleBetween(String value1, String value2) { + addCriterion("api_scenario_module between", value1, value2, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioModuleNotBetween(String value1, String value2) { + addCriterion("api_scenario_module not between", value1, value2, "apiScenarioModule"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityIsNull() { + addCriterion("api_scenario_priority is null"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityIsNotNull() { + addCriterion("api_scenario_priority is not null"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityEqualTo(String value) { + addCriterion("api_scenario_priority =", value, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityNotEqualTo(String value) { + addCriterion("api_scenario_priority <>", value, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityGreaterThan(String value) { + addCriterion("api_scenario_priority >", value, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityGreaterThanOrEqualTo(String value) { + addCriterion("api_scenario_priority >=", value, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityLessThan(String value) { + addCriterion("api_scenario_priority <", value, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityLessThanOrEqualTo(String value) { + addCriterion("api_scenario_priority <=", value, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityLike(String value) { + addCriterion("api_scenario_priority like", value, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityNotLike(String value) { + addCriterion("api_scenario_priority not like", value, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityIn(List values) { + addCriterion("api_scenario_priority in", values, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityNotIn(List values) { + addCriterion("api_scenario_priority not in", values, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityBetween(String value1, String value2) { + addCriterion("api_scenario_priority between", value1, value2, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioPriorityNotBetween(String value1, String value2) { + addCriterion("api_scenario_priority not between", value1, value2, "apiScenarioPriority"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserIsNull() { + addCriterion("api_scenario_execute_user is null"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserIsNotNull() { + addCriterion("api_scenario_execute_user is not null"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserEqualTo(String value) { + addCriterion("api_scenario_execute_user =", value, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserNotEqualTo(String value) { + addCriterion("api_scenario_execute_user <>", value, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserGreaterThan(String value) { + addCriterion("api_scenario_execute_user >", value, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserGreaterThanOrEqualTo(String value) { + addCriterion("api_scenario_execute_user >=", value, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserLessThan(String value) { + addCriterion("api_scenario_execute_user <", value, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserLessThanOrEqualTo(String value) { + addCriterion("api_scenario_execute_user <=", value, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserLike(String value) { + addCriterion("api_scenario_execute_user like", value, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserNotLike(String value) { + addCriterion("api_scenario_execute_user not like", value, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserIn(List values) { + addCriterion("api_scenario_execute_user in", values, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserNotIn(List values) { + addCriterion("api_scenario_execute_user not in", values, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserBetween(String value1, String value2) { + addCriterion("api_scenario_execute_user between", value1, value2, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteUserNotBetween(String value1, String value2) { + addCriterion("api_scenario_execute_user not between", value1, value2, "apiScenarioExecuteUser"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultIsNull() { + addCriterion("api_scenario_execute_result is null"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultIsNotNull() { + addCriterion("api_scenario_execute_result is not null"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultEqualTo(String value) { + addCriterion("api_scenario_execute_result =", value, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultNotEqualTo(String value) { + addCriterion("api_scenario_execute_result <>", value, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultGreaterThan(String value) { + addCriterion("api_scenario_execute_result >", value, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultGreaterThanOrEqualTo(String value) { + addCriterion("api_scenario_execute_result >=", value, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultLessThan(String value) { + addCriterion("api_scenario_execute_result <", value, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultLessThanOrEqualTo(String value) { + addCriterion("api_scenario_execute_result <=", value, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultLike(String value) { + addCriterion("api_scenario_execute_result like", value, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultNotLike(String value) { + addCriterion("api_scenario_execute_result not like", value, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultIn(List values) { + addCriterion("api_scenario_execute_result in", values, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultNotIn(List values) { + addCriterion("api_scenario_execute_result not in", values, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultBetween(String value1, String value2) { + addCriterion("api_scenario_execute_result between", value1, value2, "apiScenarioExecuteResult"); + return (Criteria) this; + } + + public Criteria andApiScenarioExecuteResultNotBetween(String value1, String value2) { + addCriterion("api_scenario_execute_result not between", value1, value2, "apiScenarioExecuteResult"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportExample.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportExample.java index 2963514593..5962241dc2 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanReportExample.java @@ -1,5 +1,6 @@ package io.metersphere.plan.domain; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; @@ -774,52 +775,52 @@ public class TestPlanReportExample { return (Criteria) this; } - public Criteria andPassRateEqualTo(Long value) { + public Criteria andPassRateEqualTo(BigDecimal value) { addCriterion("pass_rate =", value, "passRate"); return (Criteria) this; } - public Criteria andPassRateNotEqualTo(Long value) { + public Criteria andPassRateNotEqualTo(BigDecimal value) { addCriterion("pass_rate <>", value, "passRate"); return (Criteria) this; } - public Criteria andPassRateGreaterThan(Long value) { + public Criteria andPassRateGreaterThan(BigDecimal value) { addCriterion("pass_rate >", value, "passRate"); return (Criteria) this; } - public Criteria andPassRateGreaterThanOrEqualTo(Long value) { + public Criteria andPassRateGreaterThanOrEqualTo(BigDecimal value) { addCriterion("pass_rate >=", value, "passRate"); return (Criteria) this; } - public Criteria andPassRateLessThan(Long value) { + public Criteria andPassRateLessThan(BigDecimal value) { addCriterion("pass_rate <", value, "passRate"); return (Criteria) this; } - public Criteria andPassRateLessThanOrEqualTo(Long value) { + public Criteria andPassRateLessThanOrEqualTo(BigDecimal value) { addCriterion("pass_rate <=", value, "passRate"); return (Criteria) this; } - public Criteria andPassRateIn(List values) { + public Criteria andPassRateIn(List values) { addCriterion("pass_rate in", values, "passRate"); return (Criteria) this; } - public Criteria andPassRateNotIn(List values) { + public Criteria andPassRateNotIn(List values) { addCriterion("pass_rate not in", values, "passRate"); return (Criteria) this; } - public Criteria andPassRateBetween(Long value1, Long value2) { + public Criteria andPassRateBetween(BigDecimal value1, BigDecimal value2) { addCriterion("pass_rate between", value1, value2, "passRate"); return (Criteria) this; } - public Criteria andPassRateNotBetween(Long value1, Long value2) { + public Criteria andPassRateNotBetween(BigDecimal value1, BigDecimal value2) { addCriterion("pass_rate not between", value1, value2, "passRate"); return (Criteria) this; } @@ -904,52 +905,52 @@ public class TestPlanReportExample { return (Criteria) this; } - public Criteria andPassThresholdEqualTo(Long value) { + public Criteria andPassThresholdEqualTo(BigDecimal value) { addCriterion("pass_threshold =", value, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdNotEqualTo(Long value) { + public Criteria andPassThresholdNotEqualTo(BigDecimal value) { addCriterion("pass_threshold <>", value, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdGreaterThan(Long value) { + public Criteria andPassThresholdGreaterThan(BigDecimal value) { addCriterion("pass_threshold >", value, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdGreaterThanOrEqualTo(Long value) { + public Criteria andPassThresholdGreaterThanOrEqualTo(BigDecimal value) { addCriterion("pass_threshold >=", value, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdLessThan(Long value) { + public Criteria andPassThresholdLessThan(BigDecimal value) { addCriterion("pass_threshold <", value, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdLessThanOrEqualTo(Long value) { + public Criteria andPassThresholdLessThanOrEqualTo(BigDecimal value) { addCriterion("pass_threshold <=", value, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdIn(List values) { + public Criteria andPassThresholdIn(List values) { addCriterion("pass_threshold in", values, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdNotIn(List values) { + public Criteria andPassThresholdNotIn(List values) { addCriterion("pass_threshold not in", values, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdBetween(Long value1, Long value2) { + public Criteria andPassThresholdBetween(BigDecimal value1, BigDecimal value2) { addCriterion("pass_threshold between", value1, value2, "passThreshold"); return (Criteria) this; } - public Criteria andPassThresholdNotBetween(Long value1, Long value2) { + public Criteria andPassThresholdNotBetween(BigDecimal value1, BigDecimal value2) { addCriterion("pass_threshold not between", value1, value2, "passThreshold"); return (Criteria) this; } @@ -1143,6 +1144,136 @@ public class TestPlanReportExample { addCriterion("deleted not between", value1, value2, "deleted"); return (Criteria) this; } + + public Criteria andExecuteRateIsNull() { + addCriterion("execute_rate is null"); + return (Criteria) this; + } + + public Criteria andExecuteRateIsNotNull() { + addCriterion("execute_rate is not null"); + return (Criteria) this; + } + + public Criteria andExecuteRateEqualTo(BigDecimal value) { + addCriterion("execute_rate =", value, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateNotEqualTo(BigDecimal value) { + addCriterion("execute_rate <>", value, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateGreaterThan(BigDecimal value) { + addCriterion("execute_rate >", value, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateGreaterThanOrEqualTo(BigDecimal value) { + addCriterion("execute_rate >=", value, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateLessThan(BigDecimal value) { + addCriterion("execute_rate <", value, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateLessThanOrEqualTo(BigDecimal value) { + addCriterion("execute_rate <=", value, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateIn(List values) { + addCriterion("execute_rate in", values, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateNotIn(List values) { + addCriterion("execute_rate not in", values, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("execute_rate between", value1, value2, "executeRate"); + return (Criteria) this; + } + + public Criteria andExecuteRateNotBetween(BigDecimal value1, BigDecimal value2) { + addCriterion("execute_rate not between", value1, value2, "executeRate"); + return (Criteria) this; + } + + public Criteria andParentIdIsNull() { + addCriterion("parent_id is null"); + return (Criteria) this; + } + + public Criteria andParentIdIsNotNull() { + addCriterion("parent_id is not null"); + return (Criteria) this; + } + + public Criteria andParentIdEqualTo(String value) { + addCriterion("parent_id =", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotEqualTo(String value) { + addCriterion("parent_id <>", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdGreaterThan(String value) { + addCriterion("parent_id >", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdGreaterThanOrEqualTo(String value) { + addCriterion("parent_id >=", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdLessThan(String value) { + addCriterion("parent_id <", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdLessThanOrEqualTo(String value) { + addCriterion("parent_id <=", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdLike(String value) { + addCriterion("parent_id like", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotLike(String value) { + addCriterion("parent_id not like", value, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdIn(List values) { + addCriterion("parent_id in", values, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotIn(List values) { + addCriterion("parent_id not in", values, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdBetween(String value1, String value2) { + addCriterion("parent_id between", value1, value2, "parentId"); + return (Criteria) this; + } + + public Criteria andParentIdNotBetween(String value1, String value2) { + addCriterion("parent_id not between", value1, value2, "parentId"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiCaseMapper.java b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiCaseMapper.java new file mode 100644 index 0000000000..f9841ae833 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiCaseMapper.java @@ -0,0 +1,35 @@ +package io.metersphere.plan.mapper; + +import io.metersphere.plan.domain.TestPlanReportApiCase; +import io.metersphere.plan.domain.TestPlanReportApiCaseExample; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface TestPlanReportApiCaseMapper { + long countByExample(TestPlanReportApiCaseExample example); + + int deleteByExample(TestPlanReportApiCaseExample example); + + int deleteByPrimaryKey(String id); + + int insert(TestPlanReportApiCase record); + + int insertSelective(TestPlanReportApiCase record); + + List selectByExample(TestPlanReportApiCaseExample example); + + TestPlanReportApiCase selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") TestPlanReportApiCase record, @Param("example") TestPlanReportApiCaseExample example); + + int updateByExample(@Param("record") TestPlanReportApiCase record, @Param("example") TestPlanReportApiCaseExample example); + + int updateByPrimaryKeySelective(TestPlanReportApiCase record); + + int updateByPrimaryKey(TestPlanReportApiCase record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") TestPlanReportApiCase.Column ... selective); +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiCaseMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiCaseMapper.xml new file mode 100644 index 0000000000..ae14713ec9 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiCaseMapper.xml @@ -0,0 +1,349 @@ + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + 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 + + + + + delete from test_plan_report_api_case + where id = #{id,jdbcType=VARCHAR} + + + delete from test_plan_report_api_case + + + + + + 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_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,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}, + + + + + + update test_plan_report_api_case + + + id = #{record.id,jdbcType=VARCHAR}, + + + test_plan_report_id = #{record.testPlanReportId,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}, + + + api_case_name = #{record.apiCaseName,jdbcType=VARCHAR}, + + + 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}, + + + + + + + + update test_plan_report_api_case + set id = #{record.id,jdbcType=VARCHAR}, + test_plan_report_id = #{record.testPlanReportId,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}, + api_case_name = #{record.apiCaseName,jdbcType=VARCHAR}, + 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} + + + + + + update test_plan_report_api_case + + + test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR}, + + + test_plan_api_case_id = #{testPlanApiCaseId,jdbcType=VARCHAR}, + + + api_case_id = #{apiCaseId,jdbcType=VARCHAR}, + + + api_case_num = #{apiCaseNum,jdbcType=BIGINT}, + + + api_case_name = #{apiCaseName,jdbcType=VARCHAR}, + + + 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}, + + + where id = #{id,jdbcType=VARCHAR} + + + update test_plan_report_api_case + set test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR}, + test_plan_api_case_id = #{testPlanApiCaseId,jdbcType=VARCHAR}, + api_case_id = #{apiCaseId,jdbcType=VARCHAR}, + api_case_num = #{apiCaseNum,jdbcType=BIGINT}, + api_case_name = #{apiCaseName,jdbcType=VARCHAR}, + 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} + where id = #{id,jdbcType=VARCHAR} + + + 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 + + (#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,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} + ) + + + + insert into test_plan_report_api_case ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.id,jdbcType=VARCHAR} + + + #{item.testPlanReportId,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} + + + ) + + + \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiScenarioMapper.java b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiScenarioMapper.java new file mode 100644 index 0000000000..3628c75462 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiScenarioMapper.java @@ -0,0 +1,35 @@ +package io.metersphere.plan.mapper; + +import io.metersphere.plan.domain.TestPlanReportApiScenario; +import io.metersphere.plan.domain.TestPlanReportApiScenarioExample; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface TestPlanReportApiScenarioMapper { + long countByExample(TestPlanReportApiScenarioExample example); + + int deleteByExample(TestPlanReportApiScenarioExample example); + + int deleteByPrimaryKey(String id); + + int insert(TestPlanReportApiScenario record); + + int insertSelective(TestPlanReportApiScenario record); + + List selectByExample(TestPlanReportApiScenarioExample example); + + TestPlanReportApiScenario selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") TestPlanReportApiScenario record, @Param("example") TestPlanReportApiScenarioExample example); + + int updateByExample(@Param("record") TestPlanReportApiScenario record, @Param("example") TestPlanReportApiScenarioExample example); + + int updateByPrimaryKeySelective(TestPlanReportApiScenario record); + + int updateByPrimaryKey(TestPlanReportApiScenario record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") TestPlanReportApiScenario.Column ... selective); +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiScenarioMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiScenarioMapper.xml new file mode 100644 index 0000000000..aa03f8e8e7 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportApiScenarioMapper.xml @@ -0,0 +1,352 @@ + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + 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 + + + + + delete from test_plan_report_api_scenario + where id = #{id,jdbcType=VARCHAR} + + + delete from test_plan_report_api_scenario + + + + + + 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 + ) + values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,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} + ) + + + 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,jdbcType=VARCHAR}, + + + #{testPlanReportId,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}, + + + + + + update test_plan_report_api_scenario + + + id = #{record.id,jdbcType=VARCHAR}, + + + test_plan_report_id = #{record.testPlanReportId,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}, + + + api_scenario_name = #{record.apiScenarioName,jdbcType=VARCHAR}, + + + 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}, + + + + + + + + update test_plan_report_api_scenario + set id = #{record.id,jdbcType=VARCHAR}, + test_plan_report_id = #{record.testPlanReportId,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}, + api_scenario_name = #{record.apiScenarioName,jdbcType=VARCHAR}, + 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} + + + + + + update test_plan_report_api_scenario + + + test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR}, + + + test_plan_api_scenario_id = #{testPlanApiScenarioId,jdbcType=VARCHAR}, + + + api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR}, + + + api_scenario_num = #{apiScenarioNum,jdbcType=BIGINT}, + + + api_scenario_name = #{apiScenarioName,jdbcType=VARCHAR}, + + + 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}, + + + where id = #{id,jdbcType=VARCHAR} + + + update test_plan_report_api_scenario + set test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR}, + test_plan_api_scenario_id = #{testPlanApiScenarioId,jdbcType=VARCHAR}, + api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR}, + api_scenario_num = #{apiScenarioNum,jdbcType=BIGINT}, + api_scenario_name = #{apiScenarioName,jdbcType=VARCHAR}, + 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} + where id = #{id,jdbcType=VARCHAR} + + + 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) + values + + (#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,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}) + + + + insert into test_plan_report_api_scenario ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.id,jdbcType=VARCHAR} + + + #{item.testPlanReportId,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} + + + ) + + + \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportMapper.xml index d7bbf536a6..64be013e96 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanReportMapper.xml @@ -18,6 +18,8 @@ + + @@ -80,7 +82,7 @@ id, test_plan_id, `name`, create_user, create_time, execute_time, start_time, end_time, exec_status, result_status, pass_rate, trigger_mode, pass_threshold, project_id, - integrated, deleted + integrated, deleted, execute_rate, parent_id @@ -286,6 +302,12 @@ deleted = #{record.deleted,jdbcType=BIT}, + + execute_rate = #{record.executeRate,jdbcType=DECIMAL}, + + + parent_id = #{record.parentId,jdbcType=VARCHAR}, + @@ -308,7 +330,9 @@ pass_threshold = #{record.passThreshold,jdbcType=DECIMAL}, project_id = #{record.projectId,jdbcType=VARCHAR}, integrated = #{record.integrated,jdbcType=BIT}, - deleted = #{record.deleted,jdbcType=BIT} + deleted = #{record.deleted,jdbcType=BIT}, + execute_rate = #{record.executeRate,jdbcType=DECIMAL}, + parent_id = #{record.parentId,jdbcType=VARCHAR} @@ -361,6 +385,12 @@ deleted = #{deleted,jdbcType=BIT}, + + execute_rate = #{executeRate,jdbcType=DECIMAL}, + + + parent_id = #{parentId,jdbcType=VARCHAR}, + where id = #{id,jdbcType=VARCHAR} @@ -380,14 +410,16 @@ pass_threshold = #{passThreshold,jdbcType=DECIMAL}, project_id = #{projectId,jdbcType=VARCHAR}, integrated = #{integrated,jdbcType=BIT}, - deleted = #{deleted,jdbcType=BIT} + deleted = #{deleted,jdbcType=BIT}, + execute_rate = #{executeRate,jdbcType=DECIMAL}, + parent_id = #{parentId,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR} insert into test_plan_report (id, test_plan_id, `name`, create_user, create_time, execute_time, start_time, end_time, exec_status, result_status, pass_rate, trigger_mode, pass_threshold, project_id, - integrated, deleted) + integrated, deleted, execute_rate, parent_id) values (#{item.id,jdbcType=VARCHAR}, #{item.testPlanId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, @@ -395,7 +427,8 @@ #{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT}, #{item.execStatus,jdbcType=VARCHAR}, #{item.resultStatus,jdbcType=VARCHAR}, #{item.passRate,jdbcType=DECIMAL}, #{item.triggerMode,jdbcType=VARCHAR}, #{item.passThreshold,jdbcType=DECIMAL}, #{item.projectId,jdbcType=VARCHAR}, #{item.integrated,jdbcType=BIT}, - #{item.deleted,jdbcType=BIT}) + #{item.deleted,jdbcType=BIT}, #{item.executeRate,jdbcType=DECIMAL}, #{item.parentId,jdbcType=VARCHAR} + ) @@ -456,6 +489,12 @@ #{item.deleted,jdbcType=BIT} + + #{item.executeRate,jdbcType=DECIMAL} + + + #{item.parentId,jdbcType=VARCHAR} + ) diff --git a/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql index f6c0b8d0f9..4123129d8c 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.1/ddl/V3.0.1_2__ga_ddl.sql @@ -175,6 +175,42 @@ update test_resource_pool set id ='100001100001' where `name`= '默认资源池' ALTER TABLE `user` ADD COLUMN `cft_token` varchar(255) NOT NULL DEFAULT 'NONE' COMMENT '身份令牌'; +-- 测试计划报告接口详情 +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_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' , + `api_case_name` VARCHAR(255) NOT NULL COMMENT '接口用例名称' , + `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 '接口用例执行结果' , + 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 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_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' , + `api_scenario_name` VARCHAR(255) NOT NULL COMMENT '场景用例名称' , + `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 '场景用例执行结果' , + 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); + +-- 测试计划报告 +ALTER TABLE test_plan_report ADD `execute_rate` DECIMAL(10, 4) COMMENT '执行率'; +ALTER TABLE test_plan_report ADD `parent_id` VARCHAR(50) COMMENT '独立报告的父级ID'; + -- set innodb lock wait timeout to default SET SESSION innodb_lock_wait_timeout = DEFAULT; diff --git a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/GlobalUserRoleControllerTests.java b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/GlobalUserRoleControllerTests.java index 3cf0d949f0..2dc2c962ea 100644 --- a/backend/services/system-setting/src/test/java/io/metersphere/system/controller/GlobalUserRoleControllerTests.java +++ b/backend/services/system-setting/src/test/java/io/metersphere/system/controller/GlobalUserRoleControllerTests.java @@ -23,11 +23,11 @@ import io.metersphere.system.uid.IDGenerator; import io.metersphere.system.utils.SessionUtils; import jakarta.annotation.Resource; import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.*; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.web.servlet.MvcResult; -import org.apache.commons.lang3.StringUtils; import java.util.*; import java.util.stream.Collectors; @@ -373,6 +373,7 @@ class GlobalUserRoleControllerTests extends BaseTest { user.setUpdateUser(ADMIN.getValue()); user.setEnable(true); user.setDeleted(false); + user.setCftToken("NONE"); userMapper.insert(user); UserRoleRelation roleRelation = new UserRoleRelation(); roleRelation.setId(IDGenerator.nextStr()); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java index 8090a5949f..40d755f10f 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportController.java @@ -4,8 +4,8 @@ import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.bug.dto.response.BugDTO; import io.metersphere.bug.service.BugAttachmentService; +import io.metersphere.plan.constants.AssociateCaseType; import io.metersphere.plan.constants.TestPlanResourceConfig; -import io.metersphere.plan.domain.TestPlanReport; import io.metersphere.plan.dto.ReportDetailCasePageDTO; import io.metersphere.plan.dto.request.*; import io.metersphere.plan.dto.response.TestPlanReportDetailResponse; @@ -88,9 +88,9 @@ public class TestPlanReportController { @Operation(summary = "测试计划-详情-生成报告") @RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE) @CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan") - public TestPlanReport genReportByManual(@Validated @RequestBody TestPlanReportGenRequest request) { + public void genReportByManual(@Validated @RequestBody TestPlanReportGenRequest request) { testPlanService.checkTestPlanNotArchived(request.getTestPlanId()); - return testPlanReportService.genReportByManual(request, SessionUtils.getUserId()); + testPlanReportService.genReportByManual(request, SessionUtils.getUserId()); } // 报告详情开始 @@ -136,6 +136,26 @@ public class TestPlanReportController { public Pager> pageFunctionalCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprfc.function_case_num, tprfc.id desc"); - return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailFunctionalCases(request)); + return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.FUNCTIONAL)); + } + + @PostMapping("/detail/api/case/page") + @Operation(summary = "测试计划-报告-详情-接口用例分页查询") + @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @CheckOwner(resourceId = "#reportId", resourceType = "test_plan_report") + public Pager> pageApiCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprac.api_case_num, tprac.id desc"); + return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_CASE)); + } + + @PostMapping("/detail/scenario/case/page") + @Operation(summary = "测试计划-报告-详情-场景用例分页查询") + @RequiresPermissions(PermissionConstants.TEST_PLAN_REPORT_READ) + @CheckOwner(resourceId = "#reportId", resourceType = "test_plan_report") + public Pager> pageScenarioCase(@Validated @RequestBody TestPlanReportDetailPageRequest request) { + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpras.api_scenario_num, tpras.id desc"); + return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_SCENARIO)); } } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java index 8f194b9b01..59ea2c9b27 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/controller/TestPlanReportShareController.java @@ -3,6 +3,7 @@ package io.metersphere.plan.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.bug.dto.response.BugDTO; +import io.metersphere.plan.constants.AssociateCaseType; import io.metersphere.plan.dto.ReportDetailCasePageDTO; import io.metersphere.plan.dto.TestPlanShareInfo; import io.metersphere.plan.dto.request.TestPlanReportShareRequest; @@ -84,6 +85,26 @@ public class TestPlanReportShareController { testPlanReportShareService.validateExpired(shareInfo); Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprfc.function_case_num, tprfc.id desc"); - return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailFunctionalCases(request)); + return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.FUNCTIONAL)); + } + + @PostMapping("/detail/api/case/page") + @Operation(summary = "测试计划-报告-详情-接口用例分页查询") + public Pager> pageApiCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) { + ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId()); + testPlanReportShareService.validateExpired(shareInfo); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tprac.api_case_num, tprac.id desc"); + return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_CASE)); + } + + @PostMapping("/detail/scenario/case/page") + @Operation(summary = "测试计划-报告-详情-场景用例分页查询") + public Pager> pageScenarioCase(@Validated @RequestBody TestPlanShareReportDetailRequest request) { + ShareInfo shareInfo = testPlanReportShareService.checkResource(request.getShareId()); + testPlanReportShareService.validateExpired(shareInfo); + Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize(), + StringUtils.isNotBlank(request.getSortString()) ? request.getSortString() : "tpras.api_scenario_num, tpras.id desc"); + return PageUtils.setPageInfo(page, testPlanReportService.listReportDetailCases(request, AssociateCaseType.API_SCENARIO)); } } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/CaseCount.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/CaseCount.java new file mode 100644 index 0000000000..59540f3e86 --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/CaseCount.java @@ -0,0 +1,28 @@ +package io.metersphere.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * 功能, 接口, 场景 + */ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class CaseCount { + + @Schema(description = "成功用例数量") + private Integer success = 0; + @Schema(description = "失败用例数量") + private Integer error = 0; + @Schema(description = "误报用例数量") + private Integer fakeError = 0; + @Schema(description = "阻塞用例数量") + private Integer block = 0; + @Schema(description = "未执行用例数量") + private Integer pending = 0; +} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportDetailCaseDTO.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportDetailCaseDTO.java new file mode 100644 index 0000000000..afe163f45b --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportDetailCaseDTO.java @@ -0,0 +1,28 @@ +package io.metersphere.plan.dto; + +import io.metersphere.plan.domain.TestPlanReportApiCase; +import io.metersphere.plan.domain.TestPlanReportApiScenario; +import io.metersphere.plan.domain.TestPlanReportBug; +import io.metersphere.plan.domain.TestPlanReportFunctionCase; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; + +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class TestPlanReportDetailCaseDTO { + + private List functionCases; + + private List apiCases; + + private List apiScenarios; + + private List bugs; + +} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportGenPreParam.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportGenPreParam.java index de2bf6cc7b..10a1bcfdc3 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportGenPreParam.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportGenPreParam.java @@ -29,4 +29,10 @@ public class TestPlanReportGenPreParam { @Schema(description = "是否集成报告") private Boolean integrated; + + @Schema(description = "计划数量, 集成报告需要") + private Long planCount; + + @Schema(description = "计划组报告ID, 独立报告需要") + private String groupReportId; } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportModuleParam.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportModuleParam.java new file mode 100644 index 0000000000..ee45b8fc3d --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportModuleParam.java @@ -0,0 +1,22 @@ +package io.metersphere.plan.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.HashMap; +import java.util.Map; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class TestPlanReportModuleParam { + + private Map functionalModuleMap = new HashMap<>(); + + private Map apiModuleMap = new HashMap<>(); + + private Map scenarioModuleMap = new HashMap<>(); +} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanReportGenRequest.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanReportGenRequest.java index fc4d2ea8d6..d6d2370757 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanReportGenRequest.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanReportGenRequest.java @@ -11,7 +11,10 @@ public class TestPlanReportGenRequest { @NotBlank(message = "{test_plan.project_id.not_blank}") private String projectId; - @Schema(description = "计划ID", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "计划ID/计划组ID", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{test_plan.id.not_blank}") private String testPlanId; + + @Schema(description = "触发方式", requiredMode = Schema.RequiredMode.REQUIRED, allowableValues = {"SCHEDULE", "MANUAL", "API", "BATCH"}) + private String triggerMode; } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanReportDetailResponse.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanReportDetailResponse.java index 582449d70f..f5e26cd4c9 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanReportDetailResponse.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/response/TestPlanReportDetailResponse.java @@ -1,6 +1,7 @@ package io.metersphere.plan.dto.response; import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import io.metersphere.plan.dto.CaseCount; import io.metersphere.plan.serializer.CustomRateSerializer; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; @@ -35,6 +36,8 @@ public class TestPlanReportDetailResponse { private Double executeRate; @Schema(description = "缺陷总数") private Integer bugCount; + @Schema(description = "计划总数") + private Integer planCount; @Schema(description = "用例总数") @@ -59,22 +62,4 @@ public class TestPlanReportDetailResponse { */ @Schema(description = "接口场景用例分析-用例数") private CaseCount apiScenarioCount; - - - /** - * 功能, 接口, 场景 - */ - @Data - public static class CaseCount { - @Schema(description = "成功用例数量") - private Integer success = 0; - @Schema(description = "失败用例数量") - private Integer error = 0; - @Schema(description = "误报用例数量") - private Integer fakeError = 0; - @Schema(description = "阻塞用例数量") - private Integer block = 0; - @Schema(description = "未执行用例数量") - private Integer pending = 0; - } } diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.java new file mode 100644 index 0000000000..57fb4c7d3d --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.java @@ -0,0 +1,41 @@ +package io.metersphere.plan.mapper; + +import io.metersphere.plan.domain.TestPlanReportApiCase; +import io.metersphere.plan.dto.CaseStatusCountMap; +import io.metersphere.plan.dto.ReportDetailCasePageDTO; +import io.metersphere.plan.dto.TestPlanBaseModule; +import io.metersphere.plan.dto.request.TestPlanReportDetailPageRequest; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ExtTestPlanReportApiCaseMapper { + + /** + * 统计报告中接口用例执行情况 + * @param reportId 报告ID + * @return 用例数量 + */ + List countExecuteResult(@Param("id") String reportId); + + /** + * 获取计划关联的接口用例 + * @param planId 计划ID + * @return 接口用例列表 + */ + List getPlanExecuteCases(@Param("id") String planId); + + /** + * 获取项目下接口用例所属模块集合 + * @param projectId 计划ID + * @return 模块集合 + */ + List getPlanExecuteCaseModules(@Param("id") String projectId); + + /** + * 分页查询报告关联的用例 + * @param request 请求参数 + * @return 关联的用例集合 + */ + List list(@Param("request") TestPlanReportDetailPageRequest request); +} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.xml new file mode 100644 index 0000000000..20fcb1c87f --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiCaseMapper.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + and tprfc.function_case_execute_result in + + + + + + + + \ No newline at end of file diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiScenarioMapper.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiScenarioMapper.java new file mode 100644 index 0000000000..e6e6fb8844 --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiScenarioMapper.java @@ -0,0 +1,41 @@ +package io.metersphere.plan.mapper; + +import io.metersphere.plan.domain.TestPlanReportApiScenario; +import io.metersphere.plan.dto.CaseStatusCountMap; +import io.metersphere.plan.dto.ReportDetailCasePageDTO; +import io.metersphere.plan.dto.TestPlanBaseModule; +import io.metersphere.plan.dto.request.TestPlanReportDetailPageRequest; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface ExtTestPlanReportApiScenarioMapper { + + /** + * 统计报告中场景用例执行情况 + * @param reportId 报告ID + * @return 用例数量 + */ + List countExecuteResult(@Param("id") String reportId); + + /** + * 获取计划关联的场景用例 + * @param planId 计划ID + * @return 场景用例列表 + */ + List getPlanExecuteCases(@Param("id") String planId); + + /** + * 获取项目下场景用例所属模块集合 + * @param projectId 计划ID + * @return 模块集合 + */ + List getPlanExecuteCaseModules(@Param("id") String projectId); + + /** + * 分页查询报告关联的用例 + * @param request 请求参数 + * @return 关联的用例集合 + */ + List list(@Param("request") TestPlanReportDetailPageRequest request); +} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiScenarioMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiScenarioMapper.xml new file mode 100644 index 0000000000..d1d9445149 --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportApiScenarioMapper.xml @@ -0,0 +1,50 @@ + + + + + + + + + + + + + + + + + + + and tpras.api_scenario_execute_result in + + + + + + + + \ No newline at end of file diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportFunctionalCaseMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportFunctionalCaseMapper.xml index 9ddd1ddefb..c97d6ee307 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportFunctionalCaseMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportFunctionalCaseMapper.xml @@ -38,7 +38,7 @@ diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java index d341a98fd1..ab332ed920 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/service/TestPlanReportService.java @@ -2,6 +2,7 @@ package io.metersphere.plan.service; import io.metersphere.bug.dto.response.BugDTO; import io.metersphere.bug.service.BugCommonService; +import io.metersphere.plan.constants.AssociateCaseType; import io.metersphere.plan.domain.*; import io.metersphere.plan.dto.*; import io.metersphere.plan.dto.request.*; @@ -12,7 +13,10 @@ import io.metersphere.plan.mapper.*; import io.metersphere.plan.utils.ModuleTreeUtils; import io.metersphere.plan.utils.RateCalculateUtils; import io.metersphere.plugin.platform.dto.SelectOption; -import io.metersphere.sdk.constants.*; +import io.metersphere.sdk.constants.DefaultRepositoryDir; +import io.metersphere.sdk.constants.ExecStatus; +import io.metersphere.sdk.constants.ReportStatus; +import io.metersphere.sdk.constants.TestPlanConstants; import io.metersphere.sdk.exception.MSException; import io.metersphere.sdk.file.FileCenter; import io.metersphere.sdk.file.FileCopyRequest; @@ -39,6 +43,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @Service @@ -65,6 +70,10 @@ public class TestPlanReportService { @Resource private ExtTestPlanReportFunctionalCaseMapper extTestPlanReportFunctionalCaseMapper; @Resource + private ExtTestPlanReportApiCaseMapper extTestPlanReportApiCaseMapper; + @Resource + private ExtTestPlanReportApiScenarioMapper extTestPlanReportApiScenarioMapper; + @Resource private TestPlanReportLogService testPlanReportLogService; @Resource private TestPlanReportNoticeService testPlanReportNoticeService; @@ -189,71 +198,123 @@ public class TestPlanReportService { testPlanReportBugMapper.deleteByExample(testPlanReportBugExample); } /** - * 手动生成报告 + * 手动生成报告 (计划 或者 组) * @param request 请求参数 - * @return 报告 + * @param currentUser 当前用户 */ - public TestPlanReport genReportByManual(TestPlanReportGenRequest request, String currentUser) { - TestPlan testPlan = checkPlan(request.getTestPlanId()); - /* - * 手动生成报告 - * 1. 构建预生成报告参数 - * 2. 预生成报告 - * 3. 报告后置处理 - */ - TestPlanReportGenPreParam genPreParam = new TestPlanReportGenPreParam(); - BeanUtils.copyBean(genPreParam, request); - genPreParam.setTestPlanName(testPlan.getName()); - genPreParam.setStartTime(System.currentTimeMillis()); - // 手动触发 - genPreParam.setTriggerMode(TaskTriggerMode.MANUAL.name()); - // 报告预生成时, 执行状态为未执行, 结果状态为'-' - genPreParam.setExecStatus(ExecStatus.PENDING.name()); - genPreParam.setResultStatus("-"); - // 是否集成报告, 目前根据是否计划组来区分 - genPreParam.setIntegrated(StringUtils.equals(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_GROUP)); - TestPlanReport preReport = preGenReport(genPreParam, currentUser, "/test-plan/report/gen"); - TestPlanReportPostParam postParam = new TestPlanReportPostParam(); - BeanUtils.copyBean(postParam, request); - postParam.setReportId(preReport.getId()); - // 手动生成报告, 执行状态为已完成, 执行及结束时间为当前时间 - postParam.setExecuteTime(System.currentTimeMillis()); - postParam.setEndTime(System.currentTimeMillis()); - postParam.setExecStatus(ExecStatus.COMPLETED.name()); - return postHandleReport(postParam); + public void genReportByManual(TestPlanReportGenRequest request, String currentUser) { + genReport(request, false, currentUser, "/test-plan/report/gen"); } - /** - * 预生成报告内容(后续拆分优化) - * @return 报告 + * 执行生成报告 + * @param request 请求参数 + * @param currentUser 当前用户 */ - public TestPlanReport preGenReport(TestPlanReportGenPreParam genParam, String currentUser, String logPath) { - // 准备计划数据 - TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId()); + public void genReportByExecution(TestPlanReportGenRequest request, String currentUser) { + genReport(request, true, currentUser, "/test-plan/report/gen"); + } + + public void genReport(TestPlanReportGenRequest request, boolean isExecute, String currentUser, String logPath) { + // 所有计划 + List plans = getPlans(request.getTestPlanId()); + // 模块参数 + TestPlanReportModuleParam moduleParam = getModuleParam(request.getProjectId()); /* - * 预生成报告(后续执行生成报告复用) + * 1. 准备报告生成参数 + * 2. 预生成报告 + * 3. 汇总报告数据 {执行时跳过} + * 3. 报告后置处理 (计算通过率, 执行率, 执行状态...) {执行时跳过} + */ + final Long groupPlanCount = (long) (plans.size() - 1); + AtomicReference 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()); + } + + if (!isExecute) { + // 汇总 + summaryReport(preReport.getId()); + // 手动生成的报告, 汇总结束后直接进行后置处理 + TestPlanReportPostParam postParam = new TestPlanReportPostParam(); + BeanUtils.copyBean(postParam, request); + postParam.setReportId(preReport.getId()); + // 手动生成报告, 执行状态为已完成, 执行及结束时间为当前时间 + postParam.setExecuteTime(System.currentTimeMillis()); + postParam.setEndTime(System.currentTimeMillis()); + postParam.setExecStatus(ExecStatus.COMPLETED.name()); + postHandleReport(postParam); + } + }); + } + + /** + * 预生成报告内容(汇总前调用) + * @return 报告 + */ + public TestPlanReport preGenReport(TestPlanReportGenPreParam genParam, String currentUser, String logPath, TestPlanReportModuleParam moduleParam) { + // 计划配置 + TestPlanConfig config = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId()); + + /* + * 预生成报告 * 1. 生成报告用例数据, 缺陷数据 * 2. 生成或计算报告统计数据 */ + TestPlanReport report = new TestPlanReport(); + BeanUtils.copyBean(report, genParam); + report.setId(IDGenerator.nextStr()); + report.setName(genParam.getTestPlanName() + "-" + DateUtils.getTimeStr(System.currentTimeMillis())); + report.setCreateUser(currentUser); + report.setCreateTime(System.currentTimeMillis()); + report.setDeleted(false); + report.setPassThreshold(config.getPassThreshold()); + 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); + + // 报告日志 + 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); - String reportId = IDGenerator.nextStr(); // 功能用例 List reportFunctionCases = extTestPlanReportFunctionalCaseMapper.getPlanExecuteCases(genParam.getTestPlanId()); if (CollectionUtils.isNotEmpty(reportFunctionCases)) { - // 模块树 - List functionalModules = extTestPlanReportFunctionalCaseMapper.getPlanExecuteCaseModules(genParam.getProjectId()); - Map functionalModuleMap = new HashMap<>(functionalModules.size()); - ModuleTreeUtils.genPathMap(functionalModules, functionalModuleMap, new ArrayList<>()); // 用例等级 List ids = reportFunctionCases.stream().map(TestPlanReportFunctionCase::getFunctionCaseId).distinct().toList(); List options = extTestPlanReportFunctionalCaseMapper.getCasePriorityByIds(ids); Map casePriorityMap = options.stream().collect(Collectors.toMap(SelectOption::getValue, SelectOption::getText)); reportFunctionCases.forEach(reportFunctionalCase -> { reportFunctionalCase.setId(IDGenerator.nextStr()); - reportFunctionalCase.setTestPlanReportId(reportId); - reportFunctionalCase.setFunctionCaseModule(functionalModuleMap.getOrDefault(reportFunctionalCase.getFunctionCaseModule(), + reportFunctionalCase.setTestPlanReportId(report.getId()); + reportFunctionalCase.setFunctionCaseModule(moduleParam.getFunctionalModuleMap().getOrDefault(reportFunctionalCase.getFunctionCaseModule(), ModuleTreeUtils.MODULE_PATH_PREFIX + reportFunctionalCase.getFunctionCaseModule())); reportFunctionalCase.setFunctionCasePriority(casePriorityMap.get(reportFunctionalCase.getFunctionCaseId())); }); @@ -262,7 +323,33 @@ public class TestPlanReportService { batchMapper.batchInsert(reportFunctionCases); } - // TODO: 接口用例, 场景报告内容 (与接口报告是否能一致) + // 接口用例 + List 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 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 reportBugs = extTestPlanReportBugMapper.getPlanBugs(genParam.getTestPlanId()); @@ -274,7 +361,7 @@ public class TestPlanReportService { Map allStatusMap = bugCommonService.getAllStatusMap(genParam.getProjectId()); reportBugs.forEach(reportBug -> { reportBug.setId(IDGenerator.nextStr()); - reportBug.setTestPlanReportId(reportId); + reportBug.setTestPlanReportId(report.getId()); reportBug.setBugHandleUser(headerHandleUserMap.containsKey(reportBug.getBugHandleUser()) ? headerHandleUserMap.get(reportBug.getBugHandleUser()) : localHandleUserMap.get(reportBug.getBugHandleUser())); reportBug.setBugStatus(allStatusMap.get(reportBug.getBugStatus())); @@ -284,65 +371,40 @@ public class TestPlanReportService { TestPlanReportBugMapper batchMapper = sqlSession.getMapper(TestPlanReportBugMapper.class); batchMapper.batchInsert(reportBugs); } + sqlSession.flushStatements(); SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); - // 插入报告统计内容 - TestPlanReportSummary reportSummary = new TestPlanReportSummary(); - reportSummary.setId(IDGenerator.nextStr()); - reportSummary.setTestPlanReportId(reportId); - reportSummary.setFunctionalCaseCount((long) (CollectionUtils.isEmpty(reportFunctionCases) ? 0 : reportFunctionCases.size())); - reportSummary.setApiCaseCount(0L); - reportSummary.setApiScenarioCount(0L); - reportSummary.setBugCount((long) (CollectionUtils.isEmpty(reportBugs) ? 0 : reportBugs.size())); - testPlanReportSummaryMapper.insertSelective(reportSummary); - // 插入报告 - TestPlanReport report = new TestPlanReport(); - BeanUtils.copyBean(report, genParam); - report.setId(reportId); - report.setName(genParam.getTestPlanName() + "-" + DateUtils.getTimeStr(System.currentTimeMillis())); - report.setCreateUser(currentUser); - report.setCreateTime(System.currentTimeMillis()); - report.setDeleted(false); - report.setPassThreshold(testPlanConfig.getPassThreshold()); - testPlanReportMapper.insertSelective(report); - - // 插入生成报告日志 - testPlanReportLogService.addLog(report, currentUser, genParam.getProjectId(), logPath); - return report; + return TestPlanReportDetailCaseDTO.builder() + .functionCases(reportFunctionCases).apiCases(reportApiCases).apiScenarios(reportApiScenarios).bugs(reportBugs).build(); } /** - * 报告结果后置处理 + * 报告结果后置处理 (汇总操作结束后调用) * @param postParam 后置处理参数 - * @return 报告 */ - public TestPlanReport postHandleReport(TestPlanReportPostParam postParam) { + public void postHandleReport(TestPlanReportPostParam postParam) { /* * 处理报告(执行状态, 结束时间) */ TestPlanReport planReport = checkReport(postParam.getReportId()); BeanUtils.copyBean(planReport, postParam); /* - * TODO: 计算报告通过率, 并对比阈值生成报告结果状态(目前只有功能用例参与计算) + * 计算报告通过率, 并对比阈值生成报告结果状态 */ TestPlanReportSummaryExample example = new TestPlanReportSummaryExample(); example.createCriteria().andTestPlanReportIdEqualTo(postParam.getReportId()); - TestPlanReportSummary reportSummary = testPlanReportSummaryMapper.selectByExample(example).get(0); - // 通过的功能用例数 - // TODO: 接口用例, 场景用例 - long functionalCasePassCount = extTestPlanReportFunctionalCaseMapper.countExecuteSuccessCase(postParam.getReportId()); + TestPlanReportSummary reportSummary = testPlanReportSummaryMapper.selectByExampleWithBLOBs(example).get(0); // 用例总数 long caseTotal = reportSummary.getFunctionalCaseCount() + reportSummary.getApiCaseCount() + reportSummary.getApiScenarioCount(); - // 通过率 {通过用例数/总用例数} - // FIXME: 后续替换成PASS_COUNT - planReport.setPassRate(RateCalculateUtils.divWithPrecision((int) functionalCasePassCount, (int) caseTotal, 2)); + CaseCount summaryCount = JSON.parseObject(new String(reportSummary.getExecuteResult()), CaseCount.class); + planReport.setExecuteRate(RateCalculateUtils.divWithPrecision(((int) caseTotal - summaryCount.getPending()), (int) caseTotal, 2)); + planReport.setPassRate(RateCalculateUtils.divWithPrecision(summaryCount.getSuccess(), (int) caseTotal, 2)); // 计划的(执行)结果状态: 通过率 >= 阈值 ? 成功 : 失败 planReport.setResultStatus(planReport.getPassRate() >= planReport.getPassThreshold() ? ReportStatus.SUCCESS.name() : ReportStatus.ERROR.name()); testPlanReportMapper.updateByPrimaryKeySelective(planReport); - return planReport; } /** @@ -354,17 +416,22 @@ public class TestPlanReportService { TestPlanReport planReport = checkReport(reportId); TestPlanReportSummaryExample example = new TestPlanReportSummaryExample(); example.createCriteria().andTestPlanReportIdEqualTo(reportId); - TestPlanReportSummary reportSummary = testPlanReportSummaryMapper.selectByExample(example).get(0); + TestPlanReportSummary reportSummary = testPlanReportSummaryMapper.selectByExampleWithBLOBs(example).get(0); TestPlanReportDetailResponse planReportDetail = new TestPlanReportDetailResponse(); BeanUtils.copyBean(planReportDetail, planReport); int caseTotal = (int) (reportSummary.getFunctionalCaseCount() + reportSummary.getApiCaseCount() + reportSummary.getApiScenarioCount()); planReportDetail.setCaseTotal(caseTotal); planReportDetail.setBugCount(reportSummary.getBugCount().intValue()); + planReportDetail.setPlanCount(reportSummary.getPlanCount().intValue()); planReportDetail.setSummary(reportSummary.getSummary()); /* * 统计用例执行数据 */ - return statisticsCase(planReportDetail); + planReportDetail.setFunctionalCount(JSON.parseObject(new String(reportSummary.getFunctionalExecuteResult()), CaseCount.class)); + planReportDetail.setApiCaseCount(JSON.parseObject(new String(reportSummary.getApiExecuteResult()), CaseCount.class)); + planReportDetail.setApiScenarioCount(JSON.parseObject(new String(reportSummary.getScenarioExecuteResult()), CaseCount.class)); + planReportDetail.setExecuteCount(JSON.parseObject(new String(reportSummary.getExecuteResult()), CaseCount.class)); + return planReportDetail; } /** @@ -394,52 +461,60 @@ public class TestPlanReportService { } /** - * 分页查询报告详情-功能用例分页数据 + * 分页查询报告详情-用例分页数据 * @param request 请求参数 - * @return 缺陷分页数据 + * @return 用例分页数据 */ - public List listReportDetailFunctionalCases(TestPlanReportDetailPageRequest request) { - List functionalCases = extTestPlanReportFunctionalCaseMapper.list(request); - if (CollectionUtils.isEmpty(functionalCases)) { - return new ArrayList<>(); + public List listReportDetailCases(TestPlanReportDetailPageRequest request, String caseType) { + List 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 distinctUserIds = functionalCases.stream().map(ReportDetailCasePageDTO::getExecuteUser).distinct().toList(); - List userOptions = baseUserMapper.selectUserOptionByIds(distinctUserIds); - Map userMap = userOptions.stream().collect(Collectors.toMap(OptionDTO::getId, OptionDTO::getName)); - functionalCases.forEach(functionalCase -> functionalCase.setExecuteUser(userMap.getOrDefault(functionalCase.getExecuteUser(), functionalCase.getExecuteUser()))); - return functionalCases; + List distinctUserIds = detailCases.stream().map(ReportDetailCasePageDTO::getExecuteUser).distinct().toList(); + Map userMap = getUserMap(distinctUserIds); + detailCases.forEach(detailCase -> detailCase.setExecuteUser(userMap.getOrDefault(detailCase.getExecuteUser(), detailCase.getExecuteUser()))); + return detailCases; } /** - * 统计用例执行数据 (目前只统计功能用例) - * @param reportDetail 用例详情 + * 汇总规划生成的报告 + * @param reportId 报告ID */ - private TestPlanReportDetailResponse statisticsCase(TestPlanReportDetailResponse reportDetail) { - // 功能用例 (无误报状态) - List functionalCaseCountMap = extTestPlanReportFunctionalCaseMapper.countExecuteResult(reportDetail.getId()); - Map functionalCaseResultMap = functionalCaseCountMap.stream().collect(Collectors.toMap(CaseStatusCountMap::getStatus, CaseStatusCountMap::getCount)); - TestPlanReportDetailResponse.CaseCount functionalCaseCount = new TestPlanReportDetailResponse.CaseCount(); - functionalCaseCount.setSuccess(functionalCaseResultMap.getOrDefault(ExecStatus.SUCCESS.name(), 0L).intValue()); - functionalCaseCount.setError(functionalCaseResultMap.getOrDefault(ExecStatus.ERROR.name(), 0L).intValue()); - functionalCaseCount.setPending(functionalCaseResultMap.getOrDefault(ExecStatus.PENDING.name(), 0L).intValue()); - functionalCaseCount.setBlock(functionalCaseResultMap.getOrDefault(ExecStatus.BLOCKED.name(), 0L).intValue()); + public void summaryReport(String reportId) { + TestPlanReportSummaryExample example = new TestPlanReportSummaryExample(); + example.createCriteria().andTestPlanReportIdEqualTo(reportId); + List testPlanReportSummaries = testPlanReportSummaryMapper.selectByExample(example); + if (CollectionUtils.isEmpty(testPlanReportSummaries)) { + // 报告详情不存在 + return; + } + // 功能用例 + List functionalCountMapList = extTestPlanReportFunctionalCaseMapper.countExecuteResult(reportId); + CaseCount functionalCaseCount = countMap(functionalCountMapList); + // 接口用例 + List apiCountMapList = extTestPlanReportApiCaseMapper.countExecuteResult(reportId); + CaseCount apiCaseCount = countMap(apiCountMapList); + // 场景用例 + List scenarioCountMapList = extTestPlanReportApiScenarioMapper.countExecuteResult(reportId); + CaseCount scenarioCaseCount = countMap(scenarioCountMapList); - // TODO: 接口用例, 场景用例 + // 规划整体的汇总数据 + CaseCount summaryCount = CaseCount.builder().success(functionalCaseCount.getSuccess() + apiCaseCount.getSuccess() + scenarioCaseCount.getSuccess()) + .error(functionalCaseCount.getError() + apiCaseCount.getError() + scenarioCaseCount.getError()) + .block(functionalCaseCount.getBlock() + apiCaseCount.getBlock() + scenarioCaseCount.getBlock()) + .pending(functionalCaseCount.getPending() + apiCaseCount.getPending() + scenarioCaseCount.getPending()) + .fakeError(functionalCaseCount.getFakeError() + apiCaseCount.getFakeError() + scenarioCaseCount.getFakeError()).build(); - // FIXME: 目前只有功能用例 - TestPlanReportDetailResponse.CaseCount executeCaseCount = new TestPlanReportDetailResponse.CaseCount(); - executeCaseCount.setSuccess(functionalCaseCount.getSuccess()); - executeCaseCount.setError(functionalCaseCount.getError()); - executeCaseCount.setFakeError(functionalCaseCount.getFakeError()); - executeCaseCount.setPending(functionalCaseCount.getPending()); - executeCaseCount.setBlock(functionalCaseCount.getBlock()); - - // 计算执行完成率 - reportDetail.setExecuteRate(RateCalculateUtils.divWithPrecision(reportDetail.getCaseTotal() - executeCaseCount.getPending(), reportDetail.getCaseTotal(), 2)); - // 分析详情数据 - reportDetail.setFunctionalCount(functionalCaseCount); - reportDetail.setExecuteCount(executeCaseCount); - return reportDetail; + // 入库汇总数据 => 报告详情表 + TestPlanReportSummary reportSummary = testPlanReportSummaries.get(0); + reportSummary.setFunctionalExecuteResult(JSON.toJSONBytes(functionalCaseCount)); + reportSummary.setApiExecuteResult(JSON.toJSONBytes(apiCaseCount)); + reportSummary.setScenarioExecuteResult(JSON.toJSONBytes(scenarioCaseCount)); + reportSummary.setExecuteResult(JSON.toJSONBytes(summaryCount)); + testPlanReportSummaryMapper.updateByPrimaryKeySelective(reportSummary); } /** @@ -595,4 +670,92 @@ 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 resultMapList 执行结果集合 + * @return 用例数量 + */ + private CaseCount countMap(List resultMapList) { + CaseCount caseCount = new CaseCount(); + Map resultMap = resultMapList.stream().collect(Collectors.toMap(CaseStatusCountMap::getStatus, CaseStatusCountMap::getCount)); + caseCount.setSuccess(resultMap.getOrDefault(ExecStatus.SUCCESS.name(), 0L).intValue()); + caseCount.setError(resultMap.getOrDefault(ExecStatus.ERROR.name(), 0L).intValue()); + caseCount.setPending(resultMap.getOrDefault(ExecStatus.PENDING.name(), 0L).intValue()); + caseCount.setBlock(resultMap.getOrDefault(ExecStatus.BLOCKED.name(), 0L).intValue()); + caseCount.setFakeError(resultMap.getOrDefault(ExecStatus.FAKE_ERROR.name(), 0L).intValue()); + return caseCount; + } + + /** + * 获取组或者计划 + * @param groupOrPlanId 计划组/报告ID + * @return 计划集合 + */ + private List getPlans(String groupOrPlanId) { + TestPlan testPlan = checkPlan(groupOrPlanId); + List plans = new ArrayList<>(); + if (StringUtils.equals(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_GROUP)) { + // 计划组 + TestPlanExample example = new TestPlanExample(); + example.createCriteria().andGroupIdEqualTo(groupOrPlanId); + List testPlans = testPlanMapper.selectByExample(example); + plans.addAll(testPlans); + } + // 保证第一条为计划组 + plans.addFirst(testPlan); + return plans; + } + + /** + * 获取项目下的模块参数 + * @param projectId 项目ID + * @return 模块参数 + */ + private TestPlanReportModuleParam getModuleParam(String projectId) { + // 模块树 {功能, 接口, 场景} + List functionalModules = extTestPlanReportFunctionalCaseMapper.getPlanExecuteCaseModules(projectId); + Map functionalModuleMap = new HashMap<>(functionalModules.size()); + ModuleTreeUtils.genPathMap(functionalModules, functionalModuleMap, new ArrayList<>()); + List apiModules = extTestPlanReportApiCaseMapper.getPlanExecuteCaseModules(projectId); + Map apiModuleMap = new HashMap<>(apiModules.size()); + ModuleTreeUtils.genPathMap(apiModules, apiModuleMap, new ArrayList<>()); + List scenarioModules = extTestPlanReportApiScenarioMapper.getPlanExecuteCaseModules(projectId); + Map scenarioModuleMap = new HashMap<>(apiModules.size()); + ModuleTreeUtils.genPathMap(scenarioModules, scenarioModuleMap, new ArrayList<>()); + return TestPlanReportModuleParam.builder().functionalModuleMap(functionalModuleMap).apiModuleMap(apiModuleMap).scenarioModuleMap(scenarioModuleMap).build(); + } + + /** + * 获取用户集合 + * @param userIds 用户ID集合 + * @return 用户集合 + */ + private Map getUserMap(List userIds) { + if (CollectionUtils.isEmpty(userIds)) { + return new HashMap<>(16); + } + List userOptions = baseUserMapper.selectUserOptionByIds(userIds); + return userOptions.stream().collect(Collectors.toMap(OptionDTO::getId, OptionDTO::getName)); + } } diff --git a/backend/services/test-plan/src/main/resources/testPlanGeneratorConfig.xml b/backend/services/test-plan/src/main/resources/testPlanGeneratorConfig.xml index d9f8c1e2aa..e23f003ef7 100644 --- a/backend/services/test-plan/src/main/resources/testPlanGeneratorConfig.xml +++ b/backend/services/test-plan/src/main/resources/testPlanGeneratorConfig.xml @@ -77,7 +77,7 @@ - + diff --git a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanReportControllerTests.java b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanReportControllerTests.java index 07c3744129..55b7446ad6 100644 --- a/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanReportControllerTests.java +++ b/backend/services/test-plan/src/test/java/io/metersphere/plan/controller/TestPlanReportControllerTests.java @@ -12,6 +12,7 @@ import io.metersphere.project.domain.ProjectApplicationExample; import io.metersphere.project.mapper.ProjectApplicationMapper; import io.metersphere.sdk.constants.ProjectApplicationType; import io.metersphere.sdk.constants.ShareInfoType; +import io.metersphere.sdk.constants.TaskTriggerMode; import io.metersphere.sdk.util.CommonBeanFactory; import io.metersphere.sdk.util.JSON; import io.metersphere.system.base.BaseTest; @@ -49,12 +50,16 @@ public class TestPlanReportControllerTests extends BaseTest { private static final String EDIT_PLAN_REPORT = "/test-plan/report/detail/edit"; private static final String GET_PLAN_REPORT_DETAIL_BUG_PAGE = "/test-plan/report/detail/bug/page"; private static final String GET_PLAN_REPORT_DETAIL_FUNCTIONAL_PAGE = "/test-plan/report/detail/functional/case/page"; + private static final String GET_PLAN_REPORT_DETAIL_API_PAGE = "/test-plan/report/detail/api/case/page"; + private static final String GET_PLAN_REPORT_DETAIL_SCENARIO_PAGE = "/test-plan/report/detail/scenario/case/page"; private static final String GEN_AND_SHARE = "/test-plan/report/share/gen"; private static final String GET_SHARE_INFO = "/test-plan/report/share/get"; private static final String GET_SHARE_TIME = "/test-plan/report/share/get-share-time"; private static final String GET_SHARE_REPORT = "/test-plan/report/share/get/detail"; private static final String GET_SHARE_REPORT_BUG_LIST = "/test-plan/report/share/detail/bug/page"; private static final String GET_SHARE_REPORT_FUNCTIONAL_LIST = "/test-plan/report/share/detail/functional/case/page"; + private static final String GET_SHARE_REPORT_API_LIST = "/test-plan/report/share/detail/api/case/page"; + private static final String GET_SHARE_REPORT_SCENARIO_LIST = "/test-plan/report/share/detail/scenario/case/page"; @Autowired private TestPlanReportMapper testPlanReportMapper; @@ -179,9 +184,13 @@ public class TestPlanReportControllerTests extends BaseTest { // 获取分享的报告的列表明细 this.requestPostWithOk(GET_SHARE_REPORT_BUG_LIST, request); this.requestPostWithOk(GET_SHARE_REPORT_FUNCTIONAL_LIST, request); + this.requestPostWithOk(GET_SHARE_REPORT_API_LIST, request); + this.requestPostWithOk(GET_SHARE_REPORT_SCENARIO_LIST, request); request.setSort(Map.of("num", "asc")); this.requestPostWithOk(GET_SHARE_REPORT_BUG_LIST, request); this.requestPostWithOk(GET_SHARE_REPORT_FUNCTIONAL_LIST, request); + this.requestPostWithOk(GET_SHARE_REPORT_API_LIST, request); + this.requestPostWithOk(GET_SHARE_REPORT_SCENARIO_LIST, request); } @Test @@ -243,15 +252,11 @@ public class TestPlanReportControllerTests extends BaseTest { TestPlanReportGenRequest genRequest = new TestPlanReportGenRequest(); genRequest.setProjectId("100001100001"); genRequest.setTestPlanId("plan_id_for_gen_report_1"); + genRequest.setTriggerMode(TaskTriggerMode.MANUAL.name()); this.requestPost(GEN_PLAN_REPORT, genRequest); genRequest.setTestPlanId("plan_id_for_gen_report"); - MvcResult mvcResult = this.requestPostAndReturn(GEN_PLAN_REPORT, genRequest); - String returnData = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); - ResultHolder resultHolder = JSON.parseObject(returnData, ResultHolder.class); - //返回请求正常 - Assertions.assertNotNull(resultHolder); - TestPlanReport report = JSON.parseObject(JSON.toJSONString(resultHolder.getData()), TestPlanReport.class); - GEN_REPORT_ID = report.getId(); + this.requestPost(GEN_PLAN_REPORT, genRequest); + GEN_REPORT_ID = getGenReportId("plan_id_for_gen_report"); } @Test @@ -280,8 +285,12 @@ public class TestPlanReportControllerTests extends BaseTest { request.setPageSize(10); request.setReportId(GEN_REPORT_ID); this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_FUNCTIONAL_PAGE, request); + this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_API_PAGE, request); + this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_SCENARIO_PAGE, request); request.setSort(Map.of("num", "asc")); this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_FUNCTIONAL_PAGE, request); + this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_API_PAGE, request); + this.requestPostWithOk(GET_PLAN_REPORT_DETAIL_SCENARIO_PAGE, request); } @Test @@ -356,4 +365,15 @@ public class TestPlanReportControllerTests extends BaseTest { attachment.setCreateTime(System.currentTimeMillis()); reportAttachmentMapper.insert(attachment); } + + /** + * 获取生成的报告ID + * @param planId 计划ID + * @return 报告ID + */ + private String getGenReportId(String planId) { + TestPlanReportExample example = new TestPlanReportExample(); + example.createCriteria().andTestPlanIdEqualTo(planId); + return testPlanReportMapper.selectByExample(example).get(0).getId(); + } } diff --git a/backend/services/test-plan/src/test/resources/dml/init_test_plan_report_gen.sql b/backend/services/test-plan/src/test/resources/dml/init_test_plan_report_gen.sql index 9987488bde..c8289d943b 100644 --- a/backend/services/test-plan/src/test/resources/dml/init_test_plan_report_gen.sql +++ b/backend/services/test-plan/src/test/resources/dml/init_test_plan_report_gen.sql @@ -1,7 +1,7 @@ -- 计划的测试数据 INSERT INTO `test_plan`(`id`, `num`, `project_id`, `group_id`, `module_id`, `name`, `status`, `type`, `tags`, `create_time`, `create_user`, `update_time`, `update_user`, `planned_start_time`, `planned_end_time`, `actual_start_time`, `actual_end_time`, `description`) VALUES ('plan_id_for_gen_report', 100001, '100001100001', 'NONE', '1', 'gen-report-plan', 'PREPARED', 'TEST_PLAN', NULL, CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '11'), -('plan_id_for_gen_report_1', 100001, '100001100001', 'NONE', '1', 'gen-report-plan-1', 'PREPARED', 'TEST_PLAN', NULL, CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '11'); +('plan_id_for_gen_report_1', 100001, '100001100001', 'NONE', '1', 'gen-report-plan-1', 'PREPARED', 'GROUP', NULL, CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, '11'); INSERT INTO `test_plan_config`(`test_plan_id`, `automatic_status_update`, `repeat_case`, `pass_threshold`, `case_run_mode`) VALUES ('plan_id_for_gen_report', b'0', b'0', 100.00, 'PARALLEL'), @@ -15,6 +15,12 @@ INSERT INTO `test_plan_functional_case` (`id`, `test_plan_id`, `functional_case_ ('plan_id_for_gen_report_case_4', 'plan_id_for_gen_report', 'f4_gen', CURRENT_TIMESTAMP, 'admin', 'admin', CURRENT_TIMESTAMP, 'BLOCKED', 4, '123'), ('plan_id_for_gen_report_case_5', 'plan_id_for_gen_report', 'f5_gen', CURRENT_TIMESTAMP, 'admin', 'admin', CURRENT_TIMESTAMP, 'FAKE_ERROR', 5, '123'); +INSERT INTO `test_plan_api_case`(`id`, `test_plan_id`, `api_case_id`, `environment_id`, `last_exec_result`, `last_exec_report_id`, `execute_user`, `create_time`, `create_user`, `pos`, `test_plan_collection_id`, `last_exec_time`) VALUES +('plan_id_for_gen_report_api_case_1', 'plan_id_for_gen_report', 'a1_gen', '1', 'SUCCESS', NULL, 'admin', CURRENT_TIMESTAMP, 'admin', 1, '123', CURRENT_TIMESTAMP); +INSERT INTO `test_plan_api_scenario`(id, test_plan_id, api_scenario_id, environment_id, execute_user, last_exec_result, last_exec_report_id, create_time, create_user, pos, test_plan_collection_id, grouped, last_exec_time) +VALUES ('plan_id_for_gen_report_api_scenario_case_1', 'plan_id_for_gen_report', 'as_1', '1','admin', 'SUCCESS', NULL, CURRENT_TIMESTAMP, 'admin', 1, '123', b'0', CURRENT_TIMESTAMP); + + -- 计划关联缺陷的测试数据 INSERT INTO `bug_relation_case` (`id`, `case_id`, `bug_id`, `case_type`, `test_plan_id`, `test_plan_case_id`, `create_user`, `create_time`, `update_time`) VALUES ('test-plan-bug-relate-case-1', 'f1', 'test-plan-bug-for-gen', 'FUNCTIONAL', 'plan_id_for_gen_report', 'f1', 'admin', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP); @@ -30,4 +36,10 @@ VALUES ('f1_gen', 100001, 'TEST_MODULE_ID', '100001100001', '100001', 'functiona INSERT INTO functional_case_module (id, project_id, name, parent_id, pos, create_user, create_time, update_user, update_time) VALUES ('TEST_MODULE_ID', '100001100001', 'test_module_gen_1', 'NONE', 0, 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP), ('TEST_MODULE_ID_1', '100001100001', 'test_module_gen_2', 'TEST_MODULE_ID', 0, 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP), -('TEST_MODULE_ID_2', '100001100001', 'test_module_gen_3', '', 0, 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP); \ No newline at end of file +('TEST_MODULE_ID_2', '100001100001', 'test_module_gen_3', '', 0, 'admin', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP); + +INSERT INTO api_test_case(id, name, priority, num, tags, status, last_report_status, last_report_id, pos, project_id, api_definition_id, version_id, environment_id, create_time, create_user, update_time, update_user, delete_time, delete_user, deleted) VALUES + ('a1_gen', 'api_case_gen', 'P0', 1001, null, 'Underway', 'PENDING', null, 100, 'project-associate-case-test', 'oasis_ac_definition', 'oasis_ac_version_id', 'oasis_ac_env_id', 1698058347559, 'admin', 1698058347559, 'admin', null, null, false); + +INSERT INTO api_scenario(id, name, priority, status, last_report_status, last_report_id, num, pos, version_id, ref_id, project_id, module_id, description, tags, create_user, create_time, delete_time, delete_user, update_user, update_time, deleted) VALUES + ('as_1', 'api_scenario_gen', 'P0', 'Underway', 'PENDING', null, 1000001, 1, 'oasis_as_version_id', 'as-rid', 'test-associate-pro', 'root', null, null, 'admin', UNIX_TIMESTAMP() * 1000, null, null, 'admin', UNIX_TIMESTAMP() * 1000, false); \ No newline at end of file