diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanConfig.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanConfig.java index 9816adcb8b..58c2896695 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanConfig.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanConfig.java @@ -1,12 +1,16 @@ package io.metersphere.plan.domain; -import io.metersphere.validation.groups.*; +import io.metersphere.validation.groups.Created; +import io.metersphere.validation.groups.Updated; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.*; +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; -import lombok.Data; @Data public class TestPlanConfig implements Serializable { @@ -23,23 +27,22 @@ public class TestPlanConfig implements Serializable { @NotNull(message = "{test_plan_config.repeat_case.not_blank}", groups = {Created.class}) private Boolean repeatCase; - @Schema(description = "测试计划通过阈值;0-100", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "是否开启测试规划", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{test_plan_config.test_planning.not_blank}", groups = {Created.class}) + private Boolean testPlanning; + + @Schema(title = "测试计划通过阈值; 0-100, 保留两位小数", requiredMode = Schema.RequiredMode.REQUIRED) @NotNull(message = "{test_plan_config.pass_threshold.not_blank}", groups = {Created.class}) private Double passThreshold; - @Schema(description = "是否开启测试规划", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{test_plan_config.test_planning.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 1, message = "{test_plan_config.test_planning.length_range}", groups = {Created.class, Updated.class}) - private Boolean testPlanning; - private static final long serialVersionUID = 1L; public enum Column { testPlanId("test_plan_id", "testPlanId", "VARCHAR", false), automaticStatusUpdate("automatic_status_update", "automaticStatusUpdate", "BIT", false), repeatCase("repeat_case", "repeatCase", "BIT", false), - passThreshold("pass_threshold", "passThreshold", "DOUBLE", false), - testPlanning("test_planning", "testPlanning", "BIT", false); + testPlanning("test_planning", "testPlanning", "BIT", false), + passThreshold("pass_threshold", "passThreshold", "DECIMAL", false); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanConfigExample.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanConfigExample.java index 94bee01b00..dc815e22a0 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanConfigExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanConfigExample.java @@ -294,66 +294,6 @@ public class TestPlanConfigExample { return (Criteria) this; } - public Criteria andPassThresholdIsNull() { - addCriterion("pass_threshold is null"); - return (Criteria) this; - } - - public Criteria andPassThresholdIsNotNull() { - addCriterion("pass_threshold is not null"); - return (Criteria) this; - } - - public Criteria andPassThresholdEqualTo(Double value) { - addCriterion("pass_threshold =", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdNotEqualTo(Double value) { - addCriterion("pass_threshold <>", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdGreaterThan(Double value) { - addCriterion("pass_threshold >", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdGreaterThanOrEqualTo(Double value) { - addCriterion("pass_threshold >=", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdLessThan(Double value) { - addCriterion("pass_threshold <", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdLessThanOrEqualTo(Double value) { - addCriterion("pass_threshold <=", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdIn(List values) { - addCriterion("pass_threshold in", values, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdNotIn(List values) { - addCriterion("pass_threshold not in", values, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdBetween(Double value1, Double value2) { - addCriterion("pass_threshold between", value1, value2, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdNotBetween(Double value1, Double value2) { - addCriterion("pass_threshold not between", value1, value2, "passThreshold"); - return (Criteria) this; - } - public Criteria andTestPlanningIsNull() { addCriterion("test_planning is null"); return (Criteria) this; @@ -413,6 +353,66 @@ public class TestPlanConfigExample { addCriterion("test_planning not between", value1, value2, "testPlanning"); return (Criteria) this; } + + public Criteria andPassThresholdIsNull() { + addCriterion("pass_threshold is null"); + return (Criteria) this; + } + + public Criteria andPassThresholdIsNotNull() { + addCriterion("pass_threshold is not null"); + return (Criteria) this; + } + + public Criteria andPassThresholdEqualTo(Long value) { + addCriterion("pass_threshold =", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdNotEqualTo(Long value) { + addCriterion("pass_threshold <>", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdGreaterThan(Long value) { + addCriterion("pass_threshold >", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdGreaterThanOrEqualTo(Long value) { + addCriterion("pass_threshold >=", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdLessThan(Long value) { + addCriterion("pass_threshold <", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdLessThanOrEqualTo(Long value) { + addCriterion("pass_threshold <=", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdIn(List values) { + addCriterion("pass_threshold in", values, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdNotIn(List values) { + addCriterion("pass_threshold not in", values, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdBetween(Long value1, Long value2) { + addCriterion("pass_threshold between", value1, value2, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdNotBetween(Long value1, Long value2) { + addCriterion("pass_threshold not between", value1, value2, "passThreshold"); + return (Criteria) this; + } } public static class Criteria extends GeneratedCriteria { 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 8d94c6463f..03d046f76f 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 @@ -1,12 +1,16 @@ package io.metersphere.plan.domain; -import io.metersphere.validation.groups.*; +import io.metersphere.validation.groups.Created; +import io.metersphere.validation.groups.Updated; import io.swagger.v3.oas.annotations.media.Schema; -import jakarta.validation.constraints.*; +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; -import lombok.Data; @Data public class TestPlanReport implements Serializable { @@ -31,30 +35,36 @@ public class TestPlanReport implements Serializable { @Schema(description = "创建时间") private Long createTime; - @Schema(description = "开始时间") + @Schema(description = "执行时间;计划真正执行的时间") + private Long executeTime; + + @Schema(description = "开始时间;计划开始执行的时间") private Long startTime; - @Schema(description = "结束时间") + @Schema(description = "结束时间;计划执行结束的时间") private Long endTime; - @Schema(description = "触发类型") - private String triggerMode; - - @Schema(description = "执行状态: 未执行, 执行中, 已停止, 已完成;", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "执行状态", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{test_plan_report.exec_status.not_blank}", groups = {Created.class}) @Size(min = 1, max = 50, message = "{test_plan_report.exec_status.length_range}", groups = {Created.class, Updated.class}) private String execStatus; - @Schema(description = "结果状态: 成功, 失败, 阻塞, 误报") + @Schema(description = "结果状态", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report.result_status.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{test_plan_report.result_status.length_range}", groups = {Created.class, Updated.class}) private String resultStatus; - @Schema(description = "通过阈值", requiredMode = Schema.RequiredMode.REQUIRED) - @NotBlank(message = "{test_plan_report.pass_threshold.not_blank}", groups = {Created.class}) - @Size(min = 1, max = 100, message = "{test_plan_report.pass_threshold.length_range}", groups = {Created.class, Updated.class}) - private String passThreshold; - @Schema(description = "通过率") - private Long passRate; + private Double passRate; + + @Schema(description = "触发类型", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_report.trigger_mode.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{test_plan_report.trigger_mode.length_range}", groups = {Created.class, Updated.class}) + private String triggerMode; + + @Schema(description = "通过阈值", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{test_plan_report.pass_threshold.not_blank}", groups = {Created.class}) + private Double passThreshold; @Schema(description = "项目id", requiredMode = Schema.RequiredMode.REQUIRED) @NotBlank(message = "{test_plan_report.project_id.not_blank}", groups = {Created.class}) @@ -77,13 +87,14 @@ public class TestPlanReport implements Serializable { name("name", "name", "VARCHAR", true), createUser("create_user", "createUser", "VARCHAR", false), createTime("create_time", "createTime", "BIGINT", false), + executeTime("execute_time", "executeTime", "BIGINT", false), startTime("start_time", "startTime", "BIGINT", false), endTime("end_time", "endTime", "BIGINT", false), - triggerMode("trigger_mode", "triggerMode", "VARCHAR", false), execStatus("exec_status", "execStatus", "VARCHAR", false), resultStatus("result_status", "resultStatus", "VARCHAR", false), - passThreshold("pass_threshold", "passThreshold", "VARCHAR", false), passRate("pass_rate", "passRate", "DECIMAL", false), + triggerMode("trigger_mode", "triggerMode", "VARCHAR", false), + passThreshold("pass_threshold", "passThreshold", "DECIMAL", false), projectId("project_id", "projectId", "VARCHAR", false), integrated("integrated", "integrated", "BIT", false), deleted("deleted", "deleted", "BIT", false); 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 a1ff6a6dca..2963514593 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 @@ -444,6 +444,66 @@ public class TestPlanReportExample { return (Criteria) this; } + public Criteria andExecuteTimeIsNull() { + addCriterion("execute_time is null"); + return (Criteria) this; + } + + public Criteria andExecuteTimeIsNotNull() { + addCriterion("execute_time is not null"); + return (Criteria) this; + } + + public Criteria andExecuteTimeEqualTo(Long value) { + addCriterion("execute_time =", value, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeNotEqualTo(Long value) { + addCriterion("execute_time <>", value, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeGreaterThan(Long value) { + addCriterion("execute_time >", value, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeGreaterThanOrEqualTo(Long value) { + addCriterion("execute_time >=", value, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeLessThan(Long value) { + addCriterion("execute_time <", value, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeLessThanOrEqualTo(Long value) { + addCriterion("execute_time <=", value, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeIn(List values) { + addCriterion("execute_time in", values, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeNotIn(List values) { + addCriterion("execute_time not in", values, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeBetween(Long value1, Long value2) { + addCriterion("execute_time between", value1, value2, "executeTime"); + return (Criteria) this; + } + + public Criteria andExecuteTimeNotBetween(Long value1, Long value2) { + addCriterion("execute_time not between", value1, value2, "executeTime"); + return (Criteria) this; + } + public Criteria andStartTimeIsNull() { addCriterion("start_time is null"); return (Criteria) this; @@ -564,76 +624,6 @@ public class TestPlanReportExample { return (Criteria) this; } - public Criteria andTriggerModeIsNull() { - addCriterion("trigger_mode is null"); - return (Criteria) this; - } - - public Criteria andTriggerModeIsNotNull() { - addCriterion("trigger_mode is not null"); - return (Criteria) this; - } - - public Criteria andTriggerModeEqualTo(String value) { - addCriterion("trigger_mode =", value, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeNotEqualTo(String value) { - addCriterion("trigger_mode <>", value, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeGreaterThan(String value) { - addCriterion("trigger_mode >", value, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeGreaterThanOrEqualTo(String value) { - addCriterion("trigger_mode >=", value, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeLessThan(String value) { - addCriterion("trigger_mode <", value, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeLessThanOrEqualTo(String value) { - addCriterion("trigger_mode <=", value, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeLike(String value) { - addCriterion("trigger_mode like", value, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeNotLike(String value) { - addCriterion("trigger_mode not like", value, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeIn(List values) { - addCriterion("trigger_mode in", values, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeNotIn(List values) { - addCriterion("trigger_mode not in", values, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeBetween(String value1, String value2) { - addCriterion("trigger_mode between", value1, value2, "triggerMode"); - return (Criteria) this; - } - - public Criteria andTriggerModeNotBetween(String value1, String value2) { - addCriterion("trigger_mode not between", value1, value2, "triggerMode"); - return (Criteria) this; - } - public Criteria andExecStatusIsNull() { addCriterion("exec_status is null"); return (Criteria) this; @@ -774,76 +764,6 @@ public class TestPlanReportExample { return (Criteria) this; } - public Criteria andPassThresholdIsNull() { - addCriterion("pass_threshold is null"); - return (Criteria) this; - } - - public Criteria andPassThresholdIsNotNull() { - addCriterion("pass_threshold is not null"); - return (Criteria) this; - } - - public Criteria andPassThresholdEqualTo(String value) { - addCriterion("pass_threshold =", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdNotEqualTo(String value) { - addCriterion("pass_threshold <>", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdGreaterThan(String value) { - addCriterion("pass_threshold >", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdGreaterThanOrEqualTo(String value) { - addCriterion("pass_threshold >=", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdLessThan(String value) { - addCriterion("pass_threshold <", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdLessThanOrEqualTo(String value) { - addCriterion("pass_threshold <=", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdLike(String value) { - addCriterion("pass_threshold like", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdNotLike(String value) { - addCriterion("pass_threshold not like", value, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdIn(List values) { - addCriterion("pass_threshold in", values, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdNotIn(List values) { - addCriterion("pass_threshold not in", values, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdBetween(String value1, String value2) { - addCriterion("pass_threshold between", value1, value2, "passThreshold"); - return (Criteria) this; - } - - public Criteria andPassThresholdNotBetween(String value1, String value2) { - addCriterion("pass_threshold not between", value1, value2, "passThreshold"); - return (Criteria) this; - } - public Criteria andPassRateIsNull() { addCriterion("pass_rate is null"); return (Criteria) this; @@ -904,6 +824,136 @@ public class TestPlanReportExample { return (Criteria) this; } + public Criteria andTriggerModeIsNull() { + addCriterion("trigger_mode is null"); + return (Criteria) this; + } + + public Criteria andTriggerModeIsNotNull() { + addCriterion("trigger_mode is not null"); + return (Criteria) this; + } + + public Criteria andTriggerModeEqualTo(String value) { + addCriterion("trigger_mode =", value, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeNotEqualTo(String value) { + addCriterion("trigger_mode <>", value, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeGreaterThan(String value) { + addCriterion("trigger_mode >", value, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeGreaterThanOrEqualTo(String value) { + addCriterion("trigger_mode >=", value, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeLessThan(String value) { + addCriterion("trigger_mode <", value, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeLessThanOrEqualTo(String value) { + addCriterion("trigger_mode <=", value, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeLike(String value) { + addCriterion("trigger_mode like", value, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeNotLike(String value) { + addCriterion("trigger_mode not like", value, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeIn(List values) { + addCriterion("trigger_mode in", values, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeNotIn(List values) { + addCriterion("trigger_mode not in", values, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeBetween(String value1, String value2) { + addCriterion("trigger_mode between", value1, value2, "triggerMode"); + return (Criteria) this; + } + + public Criteria andTriggerModeNotBetween(String value1, String value2) { + addCriterion("trigger_mode not between", value1, value2, "triggerMode"); + return (Criteria) this; + } + + public Criteria andPassThresholdIsNull() { + addCriterion("pass_threshold is null"); + return (Criteria) this; + } + + public Criteria andPassThresholdIsNotNull() { + addCriterion("pass_threshold is not null"); + return (Criteria) this; + } + + public Criteria andPassThresholdEqualTo(Long value) { + addCriterion("pass_threshold =", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdNotEqualTo(Long value) { + addCriterion("pass_threshold <>", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdGreaterThan(Long value) { + addCriterion("pass_threshold >", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdGreaterThanOrEqualTo(Long value) { + addCriterion("pass_threshold >=", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdLessThan(Long value) { + addCriterion("pass_threshold <", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdLessThanOrEqualTo(Long value) { + addCriterion("pass_threshold <=", value, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdIn(List values) { + addCriterion("pass_threshold in", values, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdNotIn(List values) { + addCriterion("pass_threshold not in", values, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdBetween(Long value1, Long value2) { + addCriterion("pass_threshold between", value1, value2, "passThreshold"); + return (Criteria) this; + } + + public Criteria andPassThresholdNotBetween(Long value1, Long value2) { + addCriterion("pass_threshold not between", value1, value2, "passThreshold"); + return (Criteria) this; + } + public Criteria andProjectIdIsNull() { addCriterion("project_id is null"); return (Criteria) this; diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanConfigMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanConfigMapper.xml index d953157f91..02c2316dfc 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanConfigMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanConfigMapper.xml @@ -5,8 +5,8 @@ - + @@ -67,7 +67,7 @@ - test_plan_id, automatic_status_update, repeat_case, pass_threshold, test_planning + test_plan_id, automatic_status_update, repeat_case, test_planning, pass_threshold @@ -160,12 +160,12 @@ repeat_case = #{record.repeatCase,jdbcType=BIT}, - - pass_threshold = #{record.passThreshold,jdbcType=DOUBLE}, - test_planning = #{record.testPlanning,jdbcType=BIT}, + + pass_threshold = #{record.passThreshold,jdbcType=DECIMAL}, + @@ -176,8 +176,8 @@ set test_plan_id = #{record.testPlanId,jdbcType=VARCHAR}, automatic_status_update = #{record.automaticStatusUpdate,jdbcType=BIT}, repeat_case = #{record.repeatCase,jdbcType=BIT}, - pass_threshold = #{record.passThreshold,jdbcType=DOUBLE}, - test_planning = #{record.testPlanning,jdbcType=BIT} + test_planning = #{record.testPlanning,jdbcType=BIT}, + pass_threshold = #{record.passThreshold,jdbcType=DECIMAL} @@ -191,12 +191,12 @@ repeat_case = #{repeatCase,jdbcType=BIT}, - - pass_threshold = #{passThreshold,jdbcType=DOUBLE}, - test_planning = #{testPlanning,jdbcType=BIT}, + + pass_threshold = #{passThreshold,jdbcType=DECIMAL}, + where test_plan_id = #{testPlanId,jdbcType=VARCHAR} @@ -204,18 +204,18 @@ update test_plan_config set automatic_status_update = #{automaticStatusUpdate,jdbcType=BIT}, repeat_case = #{repeatCase,jdbcType=BIT}, - pass_threshold = #{passThreshold,jdbcType=DOUBLE}, - test_planning = #{testPlanning,jdbcType=BIT} + test_planning = #{testPlanning,jdbcType=BIT}, + pass_threshold = #{passThreshold,jdbcType=DECIMAL} where test_plan_id = #{testPlanId,jdbcType=VARCHAR} insert into test_plan_config - (test_plan_id, automatic_status_update, repeat_case, pass_threshold, test_planning + (test_plan_id, automatic_status_update, repeat_case, test_planning, pass_threshold ) values (#{item.testPlanId,jdbcType=VARCHAR}, #{item.automaticStatusUpdate,jdbcType=BIT}, - #{item.repeatCase,jdbcType=BIT}, #{item.passThreshold,jdbcType=DOUBLE}, #{item.testPlanning,jdbcType=BIT} + #{item.repeatCase,jdbcType=BIT}, #{item.testPlanning,jdbcType=BIT}, #{item.passThreshold,jdbcType=DECIMAL} ) @@ -238,12 +238,12 @@ #{item.repeatCase,jdbcType=BIT} - - #{item.passThreshold,jdbcType=DOUBLE} - #{item.testPlanning,jdbcType=BIT} + + #{item.passThreshold,jdbcType=DECIMAL} + ) 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 7f4045f8ce..d7bbf536a6 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 @@ -7,13 +7,14 @@ + - - + + @@ -77,8 +78,9 @@ - id, test_plan_id, `name`, create_user, create_time, start_time, end_time, trigger_mode, - exec_status, result_status, pass_threshold, pass_rate, project_id, integrated, deleted + 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 + + \ No newline at end of file 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 99528a2aa3..3fde34d800 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 @@ -3,7 +3,9 @@ package io.metersphere.plan.controller; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; import io.metersphere.plan.constants.TestPlanResourceConfig; +import io.metersphere.plan.domain.TestPlanReport; import io.metersphere.plan.dto.request.TestPlanReportBatchRequest; +import io.metersphere.plan.dto.request.TestPlanReportGenRequest; import io.metersphere.plan.dto.request.TestPlanReportPageRequest; import io.metersphere.plan.dto.response.TestPlanReportPageResponse; import io.metersphere.plan.service.TestPlanManagementService; @@ -77,4 +79,12 @@ public class TestPlanReportController { public void batchDelete(@Validated @RequestBody TestPlanReportBatchRequest request) { testPlanReportService.batchDelete(request, SessionUtils.getUserId()); } + + @PostMapping("/gen") + @Operation(summary = "测试计划-详情-生成报告") + @RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE) + @CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan") + public TestPlanReport genReportByManual(@Validated @RequestBody TestPlanReportGenRequest request) { + return testPlanReportService.genReportByManual(request, SessionUtils.getUserId()); + } } 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 new file mode 100644 index 0000000000..de2bf6cc7b --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportGenPreParam.java @@ -0,0 +1,32 @@ +package io.metersphere.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class TestPlanReportGenPreParam { + + @Schema(description = "项目ID") + private String projectId; + + @Schema(description = "计划ID") + private String testPlanId; + + @Schema(description = "计划名称") + private String testPlanName; + + @Schema(description = "计划开始时间") + private Long startTime; + + @Schema(description = "触发方式") + private String triggerMode; + + @Schema(description = "执行状态") + private String execStatus; + + @Schema(description = "结果状态") + private String resultStatus; + + @Schema(description = "是否集成报告") + private Boolean integrated; +} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportPostParam.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportPostParam.java new file mode 100644 index 0000000000..026c984ccc --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/TestPlanReportPostParam.java @@ -0,0 +1,26 @@ +package io.metersphere.plan.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class TestPlanReportPostParam { + + @Schema(description = "项目ID") + private String projectId; + + @Schema(description = "计划ID") + private String testPlanId; + + @Schema(description = "报告ID") + private String reportId; + + @Schema(description = "计划开始执行时间") + private Long executeTime; + + @Schema(description = "计划结束时间") + private Long endTime; + + @Schema(description = "执行状态") + private String execStatus; +} 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 new file mode 100644 index 0000000000..fc4d2ea8d6 --- /dev/null +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/dto/request/TestPlanReportGenRequest.java @@ -0,0 +1,17 @@ +package io.metersphere.plan.dto.request; + +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.NotBlank; +import lombok.Data; + +@Data +public class TestPlanReportGenRequest { + + @Schema(description = "项目ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan.project_id.not_blank}") + private String projectId; + + @Schema(description = "计划ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan.id.not_blank}") + private String testPlanId; +} diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.java b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.java index b2e9076499..1df8a31023 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.java +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.java @@ -27,6 +27,13 @@ public interface ExtTestPlanReportMapper { */ List getReportBatchIdsByParam(@Param("request") TestPlanReportBatchRequest request); + /** + * 统计报告中执行通过的功能用例数量 + * @param reportId 报告ID + * @return 用例数量 + */ + Long countExecuteSuccessFunctionalCase(@Param("id") String reportId); + List selectReportByIds(@Param("ids") List ids); List getNoticeList(@Param("ids") List subList); diff --git a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.xml b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.xml index 337a3492be..985d67ac67 100644 --- a/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.xml +++ b/backend/services/test-plan/src/main/java/io/metersphere/plan/mapper/ExtTestPlanReportMapper.xml @@ -15,6 +15,12 @@ join test_plan tp on tpr.test_plan_id = tp.id + + +