diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReport.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReport.java index 866a9ff0bd..307e2fe352 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReport.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReport.java @@ -148,9 +148,6 @@ public class ApiReport implements Serializable { @NotNull(message = "{api_report.plan.not_blank}", groups = {Created.class}) private Boolean plan; - @Schema(description = "关联任务id(集合报告)/任务项id") - private String associatedTaskId; - private static final long serialVersionUID = 1L; public enum Column { @@ -186,8 +183,7 @@ public class ApiReport implements Serializable { assertionPassRate("assertion_pass_rate", "assertionPassRate", "VARCHAR", false), scriptIdentifier("script_identifier", "scriptIdentifier", "VARCHAR", false), execStatus("exec_status", "execStatus", "VARCHAR", false), - plan("plan", "plan", "BIT", true), - associatedTaskId("associated_task_id", "associatedTaskId", "VARCHAR", false); + plan("plan", "plan", "BIT", true); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportExample.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportExample.java index 8ba1150c1a..8aadf7e809 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportExample.java @@ -2273,76 +2273,6 @@ public class ApiReportExample { addCriterion("`plan` not between", value1, value2, "plan"); return (Criteria) this; } - - public Criteria andAssociatedTaskIdIsNull() { - addCriterion("associated_task_id is null"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdIsNotNull() { - addCriterion("associated_task_id is not null"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdEqualTo(String value) { - addCriterion("associated_task_id =", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdNotEqualTo(String value) { - addCriterion("associated_task_id <>", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdGreaterThan(String value) { - addCriterion("associated_task_id >", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdGreaterThanOrEqualTo(String value) { - addCriterion("associated_task_id >=", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdLessThan(String value) { - addCriterion("associated_task_id <", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdLessThanOrEqualTo(String value) { - addCriterion("associated_task_id <=", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdLike(String value) { - addCriterion("associated_task_id like", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdNotLike(String value) { - addCriterion("associated_task_id not like", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdIn(List values) { - addCriterion("associated_task_id in", values, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdNotIn(List values) { - addCriterion("associated_task_id not in", values, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdBetween(String value1, String value2) { - addCriterion("associated_task_id between", value1, value2, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdNotBetween(String value1, String value2) { - addCriterion("associated_task_id not between", value1, value2, "associatedTaskId"); - return (Criteria) this; - } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportRelateTask.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportRelateTask.java new file mode 100644 index 0000000000..995895d21d --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportRelateTask.java @@ -0,0 +1,98 @@ +package io.metersphere.api.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.Size; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import lombok.Data; + +@Data +public class ApiReportRelateTask implements Serializable { + @Schema(title = "任务id/任务项id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_report_relate_task.task_resource_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{api_report_relate_task.task_resource_id.length_range}", groups = {Created.class, Updated.class}) + private String taskResourceId; + + @Schema(title = "报告id", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{api_report_relate_task.report_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{api_report_relate_task.report_id.length_range}", groups = {Created.class, Updated.class}) + private String reportId; + + private static final long serialVersionUID = 1L; + + public enum Column { + taskResourceId("task_resource_id", "taskResourceId", "VARCHAR", false), + reportId("report_id", "reportId", "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/api/domain/ApiReportRelateTaskExample.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportRelateTaskExample.java new file mode 100644 index 0000000000..52941d356b --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiReportRelateTaskExample.java @@ -0,0 +1,340 @@ +package io.metersphere.api.domain; + +import java.util.ArrayList; +import java.util.List; + +public class ApiReportRelateTaskExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public ApiReportRelateTaskExample() { + 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 andTaskResourceIdIsNull() { + addCriterion("task_resource_id is null"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdIsNotNull() { + addCriterion("task_resource_id is not null"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdEqualTo(String value) { + addCriterion("task_resource_id =", value, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdNotEqualTo(String value) { + addCriterion("task_resource_id <>", value, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdGreaterThan(String value) { + addCriterion("task_resource_id >", value, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdGreaterThanOrEqualTo(String value) { + addCriterion("task_resource_id >=", value, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdLessThan(String value) { + addCriterion("task_resource_id <", value, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdLessThanOrEqualTo(String value) { + addCriterion("task_resource_id <=", value, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdLike(String value) { + addCriterion("task_resource_id like", value, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdNotLike(String value) { + addCriterion("task_resource_id not like", value, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdIn(List values) { + addCriterion("task_resource_id in", values, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdNotIn(List values) { + addCriterion("task_resource_id not in", values, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdBetween(String value1, String value2) { + addCriterion("task_resource_id between", value1, value2, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andTaskResourceIdNotBetween(String value1, String value2) { + addCriterion("task_resource_id not between", value1, value2, "taskResourceId"); + return (Criteria) this; + } + + public Criteria andReportIdIsNull() { + addCriterion("report_id is null"); + return (Criteria) this; + } + + public Criteria andReportIdIsNotNull() { + addCriterion("report_id is not null"); + return (Criteria) this; + } + + public Criteria andReportIdEqualTo(String value) { + addCriterion("report_id =", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotEqualTo(String value) { + addCriterion("report_id <>", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThan(String value) { + addCriterion("report_id >", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdGreaterThanOrEqualTo(String value) { + addCriterion("report_id >=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThan(String value) { + addCriterion("report_id <", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLessThanOrEqualTo(String value) { + addCriterion("report_id <=", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdLike(String value) { + addCriterion("report_id like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotLike(String value) { + addCriterion("report_id not like", value, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdIn(List values) { + addCriterion("report_id in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotIn(List values) { + addCriterion("report_id not in", values, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdBetween(String value1, String value2) { + addCriterion("report_id between", value1, value2, "reportId"); + return (Criteria) this; + } + + public Criteria andReportIdNotBetween(String value1, String value2) { + addCriterion("report_id not between", value1, value2, "reportId"); + 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/api/domain/ApiScenarioReport.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReport.java index fc1d5772ea..00b6de4557 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReport.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReport.java @@ -151,9 +151,6 @@ public class ApiScenarioReport implements Serializable { @NotNull(message = "{api_scenario_report.plan.not_blank}", groups = {Created.class}) private Boolean plan; - @Schema(description = "关联任务id(集合报告)/任务项id") - private String associatedTaskId; - private static final long serialVersionUID = 1L; public enum Column { @@ -190,8 +187,7 @@ public class ApiScenarioReport implements Serializable { scriptIdentifier("script_identifier", "scriptIdentifier", "VARCHAR", false), waitingTime("waiting_time", "waitingTime", "BIGINT", false), execStatus("exec_status", "execStatus", "VARCHAR", false), - plan("plan", "plan", "BIT", true), - associatedTaskId("associated_task_id", "associatedTaskId", "VARCHAR", false); + plan("plan", "plan", "BIT", true); private static final String BEGINNING_DELIMITER = "`"; diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportExample.java b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportExample.java index 58746eadcb..bb035ff763 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportExample.java +++ b/backend/framework/domain/src/main/java/io/metersphere/api/domain/ApiScenarioReportExample.java @@ -2333,76 +2333,6 @@ public class ApiScenarioReportExample { addCriterion("`plan` not between", value1, value2, "plan"); return (Criteria) this; } - - public Criteria andAssociatedTaskIdIsNull() { - addCriterion("associated_task_id is null"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdIsNotNull() { - addCriterion("associated_task_id is not null"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdEqualTo(String value) { - addCriterion("associated_task_id =", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdNotEqualTo(String value) { - addCriterion("associated_task_id <>", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdGreaterThan(String value) { - addCriterion("associated_task_id >", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdGreaterThanOrEqualTo(String value) { - addCriterion("associated_task_id >=", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdLessThan(String value) { - addCriterion("associated_task_id <", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdLessThanOrEqualTo(String value) { - addCriterion("associated_task_id <=", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdLike(String value) { - addCriterion("associated_task_id like", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdNotLike(String value) { - addCriterion("associated_task_id not like", value, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdIn(List values) { - addCriterion("associated_task_id in", values, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdNotIn(List values) { - addCriterion("associated_task_id not in", values, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdBetween(String value1, String value2) { - addCriterion("associated_task_id between", value1, value2, "associatedTaskId"); - return (Criteria) this; - } - - public Criteria andAssociatedTaskIdNotBetween(String value1, String value2) { - addCriterion("associated_task_id not between", value1, value2, "associatedTaskId"); - return (Criteria) this; - } } public static class Criteria extends GeneratedCriteria { diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportMapper.xml index 54f561690d..9878b86225 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportMapper.xml @@ -35,7 +35,6 @@ - @@ -101,7 +100,7 @@ pool_id, integrated, project_id, environment_id, error_count, fake_error_count, pending_count, success_count, assertion_count, assertion_success_count, request_error_rate, request_pending_rate, request_fake_error_rate, request_pass_rate, assertion_pass_rate, script_identifier, - exec_status, `plan`, associated_task_id + exec_status, `plan` @@ -480,9 +471,6 @@ `plan` = #{record.plan,jdbcType=BIT}, - - associated_task_id = #{record.associatedTaskId,jdbcType=VARCHAR}, - @@ -522,8 +510,7 @@ assertion_pass_rate = #{record.assertionPassRate,jdbcType=VARCHAR}, script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR}, exec_status = #{record.execStatus,jdbcType=VARCHAR}, - `plan` = #{record.plan,jdbcType=BIT}, - associated_task_id = #{record.associatedTaskId,jdbcType=VARCHAR} + `plan` = #{record.plan,jdbcType=BIT} @@ -627,9 +614,6 @@ `plan` = #{plan,jdbcType=BIT}, - - associated_task_id = #{associatedTaskId,jdbcType=VARCHAR}, - where id = #{id,jdbcType=VARCHAR} @@ -666,8 +650,7 @@ assertion_pass_rate = #{assertionPassRate,jdbcType=VARCHAR}, script_identifier = #{scriptIdentifier,jdbcType=VARCHAR}, exec_status = #{execStatus,jdbcType=VARCHAR}, - `plan` = #{plan,jdbcType=BIT}, - associated_task_id = #{associatedTaskId,jdbcType=VARCHAR} + `plan` = #{plan,jdbcType=BIT} where id = #{id,jdbcType=VARCHAR} @@ -677,7 +660,7 @@ pool_id, integrated, project_id, environment_id, error_count, fake_error_count, pending_count, success_count, assertion_count, assertion_success_count, request_error_rate, request_pending_rate, request_fake_error_rate, request_pass_rate, assertion_pass_rate, - script_identifier, exec_status, `plan`, associated_task_id) + script_identifier, exec_status, `plan`) values (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.testPlanCaseId,jdbcType=VARCHAR}, @@ -692,7 +675,7 @@ #{item.requestPendingRate,jdbcType=VARCHAR}, #{item.requestFakeErrorRate,jdbcType=VARCHAR}, #{item.requestPassRate,jdbcType=VARCHAR}, #{item.assertionPassRate,jdbcType=VARCHAR}, #{item.scriptIdentifier,jdbcType=VARCHAR}, #{item.execStatus,jdbcType=VARCHAR}, - #{item.plan,jdbcType=BIT}, #{item.associatedTaskId,jdbcType=VARCHAR}) + #{item.plan,jdbcType=BIT}) @@ -804,9 +787,6 @@ #{item.plan,jdbcType=BIT} - - #{item.associatedTaskId,jdbcType=VARCHAR} - ) diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportRelateTaskMapper.java b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportRelateTaskMapper.java new file mode 100644 index 0000000000..5e95ce67c0 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportRelateTaskMapper.java @@ -0,0 +1,28 @@ +package io.metersphere.api.mapper; + +import io.metersphere.api.domain.ApiReportRelateTask; +import io.metersphere.api.domain.ApiReportRelateTaskExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface ApiReportRelateTaskMapper { + long countByExample(ApiReportRelateTaskExample example); + + int deleteByExample(ApiReportRelateTaskExample example); + + int deleteByPrimaryKey(@Param("taskResourceId") String taskResourceId, @Param("reportId") String reportId); + + int insert(ApiReportRelateTask record); + + int insertSelective(ApiReportRelateTask record); + + List selectByExample(ApiReportRelateTaskExample example); + + int updateByExampleSelective(@Param("record") ApiReportRelateTask record, @Param("example") ApiReportRelateTaskExample example); + + int updateByExample(@Param("record") ApiReportRelateTask record, @Param("example") ApiReportRelateTaskExample example); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") ApiReportRelateTask.Column ... selective); +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportRelateTaskMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportRelateTaskMapper.xml new file mode 100644 index 0000000000..4138e5289c --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiReportRelateTaskMapper.xml @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + 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} + + + + + + + + + + + task_resource_id, report_id + + + + delete from api_report_relate_task + where task_resource_id = #{taskResourceId,jdbcType=VARCHAR} + and report_id = #{reportId,jdbcType=VARCHAR} + + + delete from api_report_relate_task + + + + + + insert into api_report_relate_task (task_resource_id, report_id) + values (#{taskResourceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}) + + + insert into api_report_relate_task + + + task_resource_id, + + + report_id, + + + + + #{taskResourceId,jdbcType=VARCHAR}, + + + #{reportId,jdbcType=VARCHAR}, + + + + + + update api_report_relate_task + + + task_resource_id = #{record.taskResourceId,jdbcType=VARCHAR}, + + + report_id = #{record.reportId,jdbcType=VARCHAR}, + + + + + + + + update api_report_relate_task + set task_resource_id = #{record.taskResourceId,jdbcType=VARCHAR}, + report_id = #{record.reportId,jdbcType=VARCHAR} + + + + + + insert into api_report_relate_task + (task_resource_id, report_id) + values + + (#{item.taskResourceId,jdbcType=VARCHAR}, #{item.reportId,jdbcType=VARCHAR}) + + + + insert into api_report_relate_task ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.taskResourceId,jdbcType=VARCHAR} + + + #{item.reportId,jdbcType=VARCHAR} + + + ) + + + \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioReportMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioReportMapper.xml index ff4443eed7..26e3deca91 100644 --- a/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioReportMapper.xml +++ b/backend/framework/domain/src/main/java/io/metersphere/api/mapper/ApiScenarioReportMapper.xml @@ -36,7 +36,6 @@ - @@ -102,7 +101,7 @@ run_mode, pool_id, integrated, project_id, environment_id, error_count, fake_error_count, pending_count, success_count, assertion_count, assertion_success_count, request_error_rate, request_pending_rate, request_fake_error_rate, request_pass_rate, assertion_pass_rate, - script_identifier, waiting_time, exec_status, `plan`, associated_task_id + script_identifier, waiting_time, exec_status, `plan` @@ -490,9 +483,6 @@ `plan` = #{record.plan,jdbcType=BIT}, - - associated_task_id = #{record.associatedTaskId,jdbcType=VARCHAR}, - @@ -533,8 +523,7 @@ script_identifier = #{record.scriptIdentifier,jdbcType=VARCHAR}, waiting_time = #{record.waitingTime,jdbcType=BIGINT}, exec_status = #{record.execStatus,jdbcType=VARCHAR}, - `plan` = #{record.plan,jdbcType=BIT}, - associated_task_id = #{record.associatedTaskId,jdbcType=VARCHAR} + `plan` = #{record.plan,jdbcType=BIT} @@ -641,9 +630,6 @@ `plan` = #{plan,jdbcType=BIT}, - - associated_task_id = #{associatedTaskId,jdbcType=VARCHAR}, - where id = #{id,jdbcType=VARCHAR} @@ -681,8 +667,7 @@ script_identifier = #{scriptIdentifier,jdbcType=VARCHAR}, waiting_time = #{waitingTime,jdbcType=BIGINT}, exec_status = #{execStatus,jdbcType=VARCHAR}, - `plan` = #{plan,jdbcType=BIT}, - associated_task_id = #{associatedTaskId,jdbcType=VARCHAR} + `plan` = #{plan,jdbcType=BIT} where id = #{id,jdbcType=VARCHAR} @@ -692,7 +677,7 @@ run_mode, pool_id, integrated, project_id, environment_id, error_count, fake_error_count, pending_count, success_count, assertion_count, assertion_success_count, request_error_rate, request_pending_rate, request_fake_error_rate, request_pass_rate, assertion_pass_rate, - script_identifier, waiting_time, exec_status, `plan`, associated_task_id) + script_identifier, waiting_time, exec_status, `plan`) values (#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.testPlanScenarioId,jdbcType=VARCHAR}, @@ -707,8 +692,7 @@ #{item.requestPendingRate,jdbcType=VARCHAR}, #{item.requestFakeErrorRate,jdbcType=VARCHAR}, #{item.requestPassRate,jdbcType=VARCHAR}, #{item.assertionPassRate,jdbcType=VARCHAR}, #{item.scriptIdentifier,jdbcType=VARCHAR}, #{item.waitingTime,jdbcType=BIGINT}, - #{item.execStatus,jdbcType=VARCHAR}, #{item.plan,jdbcType=BIT}, #{item.associatedTaskId,jdbcType=VARCHAR} - ) + #{item.execStatus,jdbcType=VARCHAR}, #{item.plan,jdbcType=BIT}) @@ -823,9 +807,6 @@ #{item.plan,jdbcType=BIT} - - #{item.associatedTaskId,jdbcType=VARCHAR} - ) diff --git a/backend/framework/domain/src/main/resources/migration/3.4.0/ddl/V3.4.0_2__ga_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.4.0/ddl/V3.4.0_2__ga_ddl.sql index 12c2e0d870..dca8d8999e 100644 --- a/backend/framework/domain/src/main/resources/migration/3.4.0/ddl/V3.4.0_2__ga_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.4.0/ddl/V3.4.0_2__ga_ddl.sql @@ -8,7 +8,7 @@ CREATE TABLE IF NOT EXISTS exec_task( `task_name` VARCHAR(255) NOT NULL COMMENT '任务名称' , `status` VARCHAR(20) NOT NULL COMMENT '状态' , `case_count` BIGINT NOT NULL COMMENT '用例数量' , - `result` VARCHAR(64) NOT NULL DEFAULT 'PENDING' COMMENT '执行结果' , + `result` VARCHAR(20) NOT NULL DEFAULT 'PENDING' COMMENT '执行结果' , `task_type` VARCHAR(50) NOT NULL COMMENT '任务类型' , `resource_id` VARCHAR(50) COMMENT '测试计划id/测试计划组id' , `trigger_mode` VARCHAR(20) NOT NULL COMMENT '执行模式' , @@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS exec_task_item( `resource_name` VARCHAR(255) NOT NULL COMMENT '资源名称' , `task_origin` VARCHAR(50) COMMENT '任务来源(任务组下的任务id)' , `status` VARCHAR(20) NOT NULL COMMENT '执行状态' , - `result` VARCHAR(255) NOT NULL DEFAULT 'PENDING' COMMENT '执行结果' , + `result` VARCHAR(20) NOT NULL DEFAULT 'PENDING' COMMENT '执行结果' , `resource_pool_id` VARCHAR(50) NOT NULL COMMENT '资源池ID' , `resource_pool_node` VARCHAR(50) COMMENT '节点' , `resource_type` VARCHAR(50) NOT NULL COMMENT '资源类型' , @@ -99,9 +99,14 @@ CREATE TABLE api_doc_share ( DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '接口文档分享'; - -ALTER TABLE api_report ADD COLUMN associated_task_id VARCHAR(50) COMMENT '关联任务id(集合报告)/任务项id'; -ALTER TABLE api_scenario_report ADD COLUMN associated_task_id VARCHAR(50) COMMENT '关联任务id(集合报告)/任务项id'; +-- 报告与任务关联表 +CREATE TABLE IF NOT EXISTS api_report_relate_task( + `task_resource_id` VARCHAR(50) NOT NULL COMMENT '任务id/任务项id' , + `report_id` VARCHAR(50) NOT NULL COMMENT '报告id' , + PRIMARY KEY (task_resource_id,report_id) + ) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_general_ci COMMENT = '报告与任务关联表'; -- set innodb lock wait timeout to default SET SESSION innodb_lock_wait_timeout = DEFAULT; diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java index dc2ad4d2f6..1a25f68cb6 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/service/BaseTaskHubService.java @@ -108,7 +108,7 @@ public class BaseTaskHubService { return; } List projectIds = list.stream().map(TaskHubDTO::getProjectId).distinct().toList(); - List organizationIds = list.stream().map(TaskHubDTO::getProjectId).distinct().toList(); + List organizationIds = list.stream().map(TaskHubDTO::getOrganizationId).distinct().toList(); List userIds = list.stream().map(TaskHubDTO::getCreateUser).distinct().toList(); Map projectMaps = getProjectMaps(projectIds); Map organizationMaps = getOrganizationMaps(organizationIds);