diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanCaseExecuteHistory.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanCaseExecuteHistory.java new file mode 100644 index 0000000000..e519b2ed8f --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanCaseExecuteHistory.java @@ -0,0 +1,133 @@ +package io.metersphere.plan.domain; + +import io.metersphere.validation.groups.*; +import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.*; +import java.io.Serializable; +import java.util.ArrayList; +import java.util.Arrays; +import lombok.Data; + +@Data +public class TestPlanCaseExecuteHistory implements Serializable { + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_case_execute_history.id.not_blank}", groups = {Updated.class}) + @Size(min = 1, max = 50, message = "{test_plan_case_execute_history.id.length_range}", groups = {Created.class, Updated.class}) + private String id; + + @Schema(description = "测试计划ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_case_execute_history.test_plan_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{test_plan_case_execute_history.test_plan_id.length_range}", groups = {Created.class, Updated.class}) + private String testPlanId; + + @Schema(description = "用例ID", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_case_execute_history.case_id.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 50, message = "{test_plan_case_execute_history.case_id.length_range}", groups = {Created.class, Updated.class}) + private String caseId; + + @Schema(description = "执行结果:成功/失败/阻塞", requiredMode = Schema.RequiredMode.REQUIRED) + @NotBlank(message = "{test_plan_case_execute_history.status.not_blank}", groups = {Created.class}) + @Size(min = 1, max = 64, message = "{test_plan_case_execute_history.status.length_range}", groups = {Created.class, Updated.class}) + private String status; + + @Schema(description = "是否是取消关联或执行被删除的:0-否,1-是", requiredMode = Schema.RequiredMode.REQUIRED) + @NotNull(message = "{test_plan_case_execute_history.deleted.not_blank}", groups = {Created.class}) + private Boolean deleted; + + @Schema(description = "通知人") + private String notifier; + + @Schema(description = "操作人") + private String createUser; + + @Schema(description = "操作时间") + private Long createTime; + + @Schema(description = "执行评论意见") + private byte[] content; + + @Schema(description = "用例步骤执行记录(JSON),step_model 为 Step 时启用") + private byte[] steps; + + private static final long serialVersionUID = 1L; + + public enum Column { + id("id", "id", "VARCHAR", false), + testPlanId("test_plan_id", "testPlanId", "VARCHAR", false), + caseId("case_id", "caseId", "VARCHAR", false), + status("status", "status", "VARCHAR", true), + deleted("deleted", "deleted", "BIT", false), + notifier("notifier", "notifier", "VARCHAR", false), + createUser("create_user", "createUser", "VARCHAR", false), + createTime("create_time", "createTime", "BIGINT", false), + content("content", "content", "LONGVARBINARY", false), + steps("steps", "steps", "LONGVARBINARY", 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/TestPlanCaseExecuteHistoryExample.java b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanCaseExecuteHistoryExample.java new file mode 100644 index 0000000000..2ea7b16a86 --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/domain/TestPlanCaseExecuteHistoryExample.java @@ -0,0 +1,740 @@ +package io.metersphere.plan.domain; + +import java.util.ArrayList; +import java.util.List; + +public class TestPlanCaseExecuteHistoryExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public TestPlanCaseExecuteHistoryExample() { + 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 andTestPlanIdIsNull() { + addCriterion("test_plan_id is null"); + return (Criteria) this; + } + + public Criteria andTestPlanIdIsNotNull() { + addCriterion("test_plan_id is not null"); + return (Criteria) this; + } + + public Criteria andTestPlanIdEqualTo(String value) { + addCriterion("test_plan_id =", value, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdNotEqualTo(String value) { + addCriterion("test_plan_id <>", value, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdGreaterThan(String value) { + addCriterion("test_plan_id >", value, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdGreaterThanOrEqualTo(String value) { + addCriterion("test_plan_id >=", value, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdLessThan(String value) { + addCriterion("test_plan_id <", value, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdLessThanOrEqualTo(String value) { + addCriterion("test_plan_id <=", value, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdLike(String value) { + addCriterion("test_plan_id like", value, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdNotLike(String value) { + addCriterion("test_plan_id not like", value, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdIn(List values) { + addCriterion("test_plan_id in", values, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdNotIn(List values) { + addCriterion("test_plan_id not in", values, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdBetween(String value1, String value2) { + addCriterion("test_plan_id between", value1, value2, "testPlanId"); + return (Criteria) this; + } + + public Criteria andTestPlanIdNotBetween(String value1, String value2) { + addCriterion("test_plan_id not between", value1, value2, "testPlanId"); + return (Criteria) this; + } + + public Criteria andCaseIdIsNull() { + addCriterion("case_id is null"); + return (Criteria) this; + } + + public Criteria andCaseIdIsNotNull() { + addCriterion("case_id is not null"); + return (Criteria) this; + } + + public Criteria andCaseIdEqualTo(String value) { + addCriterion("case_id =", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotEqualTo(String value) { + addCriterion("case_id <>", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdGreaterThan(String value) { + addCriterion("case_id >", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdGreaterThanOrEqualTo(String value) { + addCriterion("case_id >=", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdLessThan(String value) { + addCriterion("case_id <", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdLessThanOrEqualTo(String value) { + addCriterion("case_id <=", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdLike(String value) { + addCriterion("case_id like", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotLike(String value) { + addCriterion("case_id not like", value, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdIn(List values) { + addCriterion("case_id in", values, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotIn(List values) { + addCriterion("case_id not in", values, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdBetween(String value1, String value2) { + addCriterion("case_id between", value1, value2, "caseId"); + return (Criteria) this; + } + + public Criteria andCaseIdNotBetween(String value1, String value2) { + addCriterion("case_id not between", value1, value2, "caseId"); + return (Criteria) this; + } + + public Criteria andStatusIsNull() { + addCriterion("`status` is null"); + return (Criteria) this; + } + + public Criteria andStatusIsNotNull() { + addCriterion("`status` is not null"); + return (Criteria) this; + } + + public Criteria andStatusEqualTo(String value) { + addCriterion("`status` =", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotEqualTo(String value) { + addCriterion("`status` <>", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThan(String value) { + addCriterion("`status` >", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusGreaterThanOrEqualTo(String value) { + addCriterion("`status` >=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThan(String value) { + addCriterion("`status` <", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLessThanOrEqualTo(String value) { + addCriterion("`status` <=", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusLike(String value) { + addCriterion("`status` like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotLike(String value) { + addCriterion("`status` not like", value, "status"); + return (Criteria) this; + } + + public Criteria andStatusIn(List values) { + addCriterion("`status` in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotIn(List values) { + addCriterion("`status` not in", values, "status"); + return (Criteria) this; + } + + public Criteria andStatusBetween(String value1, String value2) { + addCriterion("`status` between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andStatusNotBetween(String value1, String value2) { + addCriterion("`status` not between", value1, value2, "status"); + return (Criteria) this; + } + + public Criteria andDeletedIsNull() { + addCriterion("deleted is null"); + return (Criteria) this; + } + + public Criteria andDeletedIsNotNull() { + addCriterion("deleted is not null"); + return (Criteria) this; + } + + public Criteria andDeletedEqualTo(Boolean value) { + addCriterion("deleted =", value, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedNotEqualTo(Boolean value) { + addCriterion("deleted <>", value, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedGreaterThan(Boolean value) { + addCriterion("deleted >", value, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedGreaterThanOrEqualTo(Boolean value) { + addCriterion("deleted >=", value, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedLessThan(Boolean value) { + addCriterion("deleted <", value, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedLessThanOrEqualTo(Boolean value) { + addCriterion("deleted <=", value, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedIn(List values) { + addCriterion("deleted in", values, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedNotIn(List values) { + addCriterion("deleted not in", values, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedBetween(Boolean value1, Boolean value2) { + addCriterion("deleted between", value1, value2, "deleted"); + return (Criteria) this; + } + + public Criteria andDeletedNotBetween(Boolean value1, Boolean value2) { + addCriterion("deleted not between", value1, value2, "deleted"); + return (Criteria) this; + } + + public Criteria andNotifierIsNull() { + addCriterion("notifier is null"); + return (Criteria) this; + } + + public Criteria andNotifierIsNotNull() { + addCriterion("notifier is not null"); + return (Criteria) this; + } + + public Criteria andNotifierEqualTo(String value) { + addCriterion("notifier =", value, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierNotEqualTo(String value) { + addCriterion("notifier <>", value, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierGreaterThan(String value) { + addCriterion("notifier >", value, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierGreaterThanOrEqualTo(String value) { + addCriterion("notifier >=", value, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierLessThan(String value) { + addCriterion("notifier <", value, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierLessThanOrEqualTo(String value) { + addCriterion("notifier <=", value, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierLike(String value) { + addCriterion("notifier like", value, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierNotLike(String value) { + addCriterion("notifier not like", value, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierIn(List values) { + addCriterion("notifier in", values, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierNotIn(List values) { + addCriterion("notifier not in", values, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierBetween(String value1, String value2) { + addCriterion("notifier between", value1, value2, "notifier"); + return (Criteria) this; + } + + public Criteria andNotifierNotBetween(String value1, String value2) { + addCriterion("notifier not between", value1, value2, "notifier"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNull() { + addCriterion("create_user is null"); + return (Criteria) this; + } + + public Criteria andCreateUserIsNotNull() { + addCriterion("create_user is not null"); + return (Criteria) this; + } + + public Criteria andCreateUserEqualTo(String value) { + addCriterion("create_user =", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotEqualTo(String value) { + addCriterion("create_user <>", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThan(String value) { + addCriterion("create_user >", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserGreaterThanOrEqualTo(String value) { + addCriterion("create_user >=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThan(String value) { + addCriterion("create_user <", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLessThanOrEqualTo(String value) { + addCriterion("create_user <=", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserLike(String value) { + addCriterion("create_user like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotLike(String value) { + addCriterion("create_user not like", value, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserIn(List values) { + addCriterion("create_user in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotIn(List values) { + addCriterion("create_user not in", values, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserBetween(String value1, String value2) { + addCriterion("create_user between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateUserNotBetween(String value1, String value2) { + addCriterion("create_user not between", value1, value2, "createUser"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + 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/mapper/TestPlanCaseExecuteHistoryMapper.java b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanCaseExecuteHistoryMapper.java new file mode 100644 index 0000000000..5013bf4c3f --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanCaseExecuteHistoryMapper.java @@ -0,0 +1,40 @@ +package io.metersphere.plan.mapper; + +import io.metersphere.plan.domain.TestPlanCaseExecuteHistory; +import io.metersphere.plan.domain.TestPlanCaseExecuteHistoryExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface TestPlanCaseExecuteHistoryMapper { + long countByExample(TestPlanCaseExecuteHistoryExample example); + + int deleteByExample(TestPlanCaseExecuteHistoryExample example); + + int deleteByPrimaryKey(String id); + + int insert(TestPlanCaseExecuteHistory record); + + int insertSelective(TestPlanCaseExecuteHistory record); + + List selectByExampleWithBLOBs(TestPlanCaseExecuteHistoryExample example); + + List selectByExample(TestPlanCaseExecuteHistoryExample example); + + TestPlanCaseExecuteHistory selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") TestPlanCaseExecuteHistory record, @Param("example") TestPlanCaseExecuteHistoryExample example); + + int updateByExampleWithBLOBs(@Param("record") TestPlanCaseExecuteHistory record, @Param("example") TestPlanCaseExecuteHistoryExample example); + + int updateByExample(@Param("record") TestPlanCaseExecuteHistory record, @Param("example") TestPlanCaseExecuteHistoryExample example); + + int updateByPrimaryKeySelective(TestPlanCaseExecuteHistory record); + + int updateByPrimaryKeyWithBLOBs(TestPlanCaseExecuteHistory record); + + int updateByPrimaryKey(TestPlanCaseExecuteHistory record); + + int batchInsert(@Param("list") List list); + + int batchInsertSelective(@Param("list") List list, @Param("selective") TestPlanCaseExecuteHistory.Column ... selective); +} \ No newline at end of file diff --git a/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanCaseExecuteHistoryMapper.xml b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanCaseExecuteHistoryMapper.xml new file mode 100644 index 0000000000..f6e7e5387f --- /dev/null +++ b/backend/framework/domain/src/main/java/io/metersphere/plan/mapper/TestPlanCaseExecuteHistoryMapper.xml @@ -0,0 +1,394 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 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_id, case_id, `status`, deleted, notifier, create_user, create_time + + + content, steps + + + + + + delete from test_plan_case_execute_history + where id = #{id,jdbcType=VARCHAR} + + + delete from test_plan_case_execute_history + + + + + + insert into test_plan_case_execute_history (id, test_plan_id, case_id, + `status`, deleted, notifier, + create_user, create_time, content, + steps) + values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, #{notifier,jdbcType=VARCHAR}, + #{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARBINARY}, + #{steps,jdbcType=LONGVARBINARY}) + + + insert into test_plan_case_execute_history + + + id, + + + test_plan_id, + + + case_id, + + + `status`, + + + deleted, + + + notifier, + + + create_user, + + + create_time, + + + content, + + + steps, + + + + + #{id,jdbcType=VARCHAR}, + + + #{testPlanId,jdbcType=VARCHAR}, + + + #{caseId,jdbcType=VARCHAR}, + + + #{status,jdbcType=VARCHAR}, + + + #{deleted,jdbcType=BIT}, + + + #{notifier,jdbcType=VARCHAR}, + + + #{createUser,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{content,jdbcType=LONGVARBINARY}, + + + #{steps,jdbcType=LONGVARBINARY}, + + + + + + update test_plan_case_execute_history + + + id = #{record.id,jdbcType=VARCHAR}, + + + test_plan_id = #{record.testPlanId,jdbcType=VARCHAR}, + + + case_id = #{record.caseId,jdbcType=VARCHAR}, + + + `status` = #{record.status,jdbcType=VARCHAR}, + + + deleted = #{record.deleted,jdbcType=BIT}, + + + notifier = #{record.notifier,jdbcType=VARCHAR}, + + + create_user = #{record.createUser,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + content = #{record.content,jdbcType=LONGVARBINARY}, + + + steps = #{record.steps,jdbcType=LONGVARBINARY}, + + + + + + + + update test_plan_case_execute_history + set id = #{record.id,jdbcType=VARCHAR}, + test_plan_id = #{record.testPlanId,jdbcType=VARCHAR}, + case_id = #{record.caseId,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR}, + deleted = #{record.deleted,jdbcType=BIT}, + notifier = #{record.notifier,jdbcType=VARCHAR}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + content = #{record.content,jdbcType=LONGVARBINARY}, + steps = #{record.steps,jdbcType=LONGVARBINARY} + + + + + + update test_plan_case_execute_history + set id = #{record.id,jdbcType=VARCHAR}, + test_plan_id = #{record.testPlanId,jdbcType=VARCHAR}, + case_id = #{record.caseId,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR}, + deleted = #{record.deleted,jdbcType=BIT}, + notifier = #{record.notifier,jdbcType=VARCHAR}, + create_user = #{record.createUser,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT} + + + + + + update test_plan_case_execute_history + + + test_plan_id = #{testPlanId,jdbcType=VARCHAR}, + + + case_id = #{caseId,jdbcType=VARCHAR}, + + + `status` = #{status,jdbcType=VARCHAR}, + + + deleted = #{deleted,jdbcType=BIT}, + + + notifier = #{notifier,jdbcType=VARCHAR}, + + + create_user = #{createUser,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + content = #{content,jdbcType=LONGVARBINARY}, + + + steps = #{steps,jdbcType=LONGVARBINARY}, + + + where id = #{id,jdbcType=VARCHAR} + + + update test_plan_case_execute_history + set test_plan_id = #{testPlanId,jdbcType=VARCHAR}, + case_id = #{caseId,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + deleted = #{deleted,jdbcType=BIT}, + notifier = #{notifier,jdbcType=VARCHAR}, + create_user = #{createUser,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + content = #{content,jdbcType=LONGVARBINARY}, + steps = #{steps,jdbcType=LONGVARBINARY} + where id = #{id,jdbcType=VARCHAR} + + + update test_plan_case_execute_history + set test_plan_id = #{testPlanId,jdbcType=VARCHAR}, + case_id = #{caseId,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + deleted = #{deleted,jdbcType=BIT}, + notifier = #{notifier,jdbcType=VARCHAR}, + create_user = #{createUser,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT} + where id = #{id,jdbcType=VARCHAR} + + + insert into test_plan_case_execute_history + (id, test_plan_id, case_id, `status`, deleted, notifier, create_user, create_time, + content, steps) + values + + (#{item.id,jdbcType=VARCHAR}, #{item.testPlanId,jdbcType=VARCHAR}, #{item.caseId,jdbcType=VARCHAR}, + #{item.status,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT}, #{item.notifier,jdbcType=VARCHAR}, + #{item.createUser,jdbcType=VARCHAR}, #{item.createTime,jdbcType=BIGINT}, #{item.content,jdbcType=LONGVARBINARY}, + #{item.steps,jdbcType=LONGVARBINARY}) + + + + insert into test_plan_case_execute_history ( + + ${column.escapedColumnName} + + ) + values + + ( + + + #{item.id,jdbcType=VARCHAR} + + + #{item.testPlanId,jdbcType=VARCHAR} + + + #{item.caseId,jdbcType=VARCHAR} + + + #{item.status,jdbcType=VARCHAR} + + + #{item.deleted,jdbcType=BIT} + + + #{item.notifier,jdbcType=VARCHAR} + + + #{item.createUser,jdbcType=VARCHAR} + + + #{item.createTime,jdbcType=BIGINT} + + + #{item.content,jdbcType=LONGVARBINARY} + + + #{item.steps,jdbcType=LONGVARBINARY} + + + ) + + + \ No newline at end of file diff --git a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_12__beta_ddl.sql b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_12__beta_ddl.sql index eecf605974..ee55e63d19 100644 --- a/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_12__beta_ddl.sql +++ b/backend/framework/domain/src/main/resources/migration/3.0.0/ddl/V3.0.0_12__beta_ddl.sql @@ -42,6 +42,29 @@ CREATE INDEX idx_test_plan_id ON test_plan_allocation(test_plan_id); ALTER TABLE test_plan_functional_case DROP COLUMN num; +CREATE TABLE IF NOT EXISTS test_plan_case_execute_history( + `id` VARCHAR(50) NOT NULL COMMENT 'ID' , + `test_plan_id` VARCHAR(50) NOT NULL COMMENT '测试计划ID' , + `case_id` VARCHAR(50) NOT NULL COMMENT '用例ID' , + `status` VARCHAR(64) NOT NULL COMMENT '执行结果:成功/失败/阻塞' , + `content` LONGBLOB COMMENT '执行评论意见' , + `steps` LONGBLOB COMMENT '用例步骤执行记录(JSON),step_model 为 Step 时启用' , + `deleted` BIT(1) NOT NULL DEFAULT 0 COMMENT '是否是取消关联或执行被删除的:0-否,1-是' , + `notifier` VARCHAR(1000) COMMENT '通知人' , + `create_user` VARCHAR(50) NOT NULL COMMENT '操作人' , + `create_time` BIGINT NOT NULL COMMENT '操作时间' , + PRIMARY KEY (id) + )ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 + COLLATE = utf8mb4_general_ci COMMENT = '功能用例执行历史表'; + + +CREATE INDEX idx_case_id ON test_plan_case_execute_history(case_id); +CREATE INDEX idx_test_plan_id ON test_plan_case_execute_history(test_plan_id); +CREATE INDEX idx_test_plan_id_case_id ON test_plan_case_execute_history(test_plan_id,case_id); +CREATE INDEX idx_status ON test_plan_case_execute_history(status); +CREATE INDEX idx_deleted ON test_plan_case_execute_history(deleted); + -- set innodb lock wait timeout to default SET SESSION innodb_lock_wait_timeout = DEFAULT; diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalTestCaseController.java b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalTestCaseController.java index 650be8d4c7..ef0e3b9215 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalTestCaseController.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/controller/FunctionalTestCaseController.java @@ -6,6 +6,7 @@ import io.metersphere.dto.BugProviderDTO; import io.metersphere.dto.TestCaseProviderDTO; import io.metersphere.functional.dto.FunctionalCaseTestDTO; import io.metersphere.functional.dto.FunctionalCaseTestPlanDTO; +import io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO; import io.metersphere.functional.request.AssociatePlanPageRequest; import io.metersphere.functional.request.DisassociateOtherCaseRequest; import io.metersphere.functional.request.FunctionalCaseTestRequest; @@ -136,4 +137,12 @@ public class FunctionalTestCaseController { Page page = PageHelper.startPage(request.getCurrent(), request.getPageSize()); return PageUtils.setPageInfo(page, functionalTestCaseService.hasAssociatePlanPage(request)); } + + @GetMapping("/plan/comment/{caseId}") + @Operation(summary = "用例管理-功能用例-测试计划-获取执行评论历史") + @RequiresPermissions(PermissionConstants.FUNCTIONAL_CASE_READ) + @CheckOwner(resourceId = "#caseId", resourceType = "functional_case") + public List getTestPlanCaseExecuteHistory(@PathVariable String caseId) { + return functionalTestCaseService.getTestPlanCaseExecuteHistory(caseId); + } } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/dto/TestPlanCaseExecuteHistoryDTO.java b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/TestPlanCaseExecuteHistoryDTO.java new file mode 100644 index 0000000000..0e95001c7b --- /dev/null +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/dto/TestPlanCaseExecuteHistoryDTO.java @@ -0,0 +1,28 @@ +package io.metersphere.functional.dto; + +import io.metersphere.plan.domain.TestPlanCaseExecuteHistory; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Data +public class TestPlanCaseExecuteHistoryDTO extends TestPlanCaseExecuteHistory { + + @Schema(description = "执行人头像") + private String userLogo; + + @Schema(description = "执行人名") + private String userName; + + @Schema(description = "执行人邮箱") + private String email; + + @Schema(description = "执行解析内容") + private String contentText; + + @Schema(description = "执行解析内容") + private String stepsText; + + @Schema(description = "测试计划名称") + private String testPlanName; + +} diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseTestMapper.java b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseTestMapper.java index 19b4d073aa..058f7ae1d8 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseTestMapper.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseTestMapper.java @@ -2,6 +2,7 @@ package io.metersphere.functional.mapper; import io.metersphere.functional.dto.FunctionalCaseTestDTO; import io.metersphere.functional.dto.FunctionalCaseTestPlanDTO; +import io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO; import io.metersphere.functional.request.AssociatePlanPageRequest; import io.metersphere.functional.request.DisassociateOtherCaseRequest; import io.metersphere.functional.request.FunctionalCaseTestRequest; @@ -17,4 +18,6 @@ public interface ExtFunctionalCaseTestMapper { List getPlanList(@Param("request") AssociatePlanPageRequest request); + ListgetPlanExecuteHistoryList(@Param("caseId") String caseId, @Param("planId") String planId); + } diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseTestMapper.xml b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseTestMapper.xml index abd5d390c2..2b17c90932 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseTestMapper.xml +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/mapper/ExtFunctionalCaseTestMapper.xml @@ -76,6 +76,34 @@ + + functional_case_test.source_id not in diff --git a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalTestCaseService.java b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalTestCaseService.java index 985406d862..5f58446145 100644 --- a/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalTestCaseService.java +++ b/backend/services/case-management/src/main/java/io/metersphere/functional/service/FunctionalTestCaseService.java @@ -9,6 +9,7 @@ import io.metersphere.functional.domain.FunctionalCaseTest; import io.metersphere.functional.domain.FunctionalCaseTestExample; import io.metersphere.functional.dto.FunctionalCaseTestDTO; import io.metersphere.functional.dto.FunctionalCaseTestPlanDTO; +import io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO; import io.metersphere.functional.mapper.ExtFunctionalCaseModuleMapper; import io.metersphere.functional.mapper.ExtFunctionalCaseTestMapper; import io.metersphere.functional.mapper.FunctionalCaseTestMapper; @@ -32,6 +33,7 @@ import org.redisson.api.IdGenerator; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -254,4 +256,17 @@ public class FunctionalTestCaseService { public List hasAssociatePlanPage(AssociatePlanPageRequest request) { return extFunctionalCaseTestMapper.getPlanList(request); } + + public List getTestPlanCaseExecuteHistory(String caseId) { + List planExecuteHistoryList = extFunctionalCaseTestMapper.getPlanExecuteHistoryList(caseId, null); + for (TestPlanCaseExecuteHistoryDTO planCaseExecuteHistoryDTO : planExecuteHistoryList) { + if (planCaseExecuteHistoryDTO.getContent() != null) { + planCaseExecuteHistoryDTO.setContentText(new String(planCaseExecuteHistoryDTO.getContent(), StandardCharsets.UTF_8)); + } + if (planCaseExecuteHistoryDTO.getSteps() != null) { + planCaseExecuteHistoryDTO.setStepsText(new String(planCaseExecuteHistoryDTO.getSteps(), StandardCharsets.UTF_8)); + } + } + return planExecuteHistoryList; + } } diff --git a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java index 1726ca7f80..ad3ac40eef 100644 --- a/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java +++ b/backend/services/case-management/src/test/java/io/metersphere/functional/controller/FunctionalTestCaseControllerTests.java @@ -13,35 +13,45 @@ import io.metersphere.functional.domain.FunctionalCase; import io.metersphere.functional.domain.FunctionalCaseTest; import io.metersphere.functional.dto.FunctionalCaseTestDTO; import io.metersphere.functional.dto.FunctionalCaseTestPlanDTO; +import io.metersphere.functional.dto.TestPlanCaseExecuteHistoryDTO; import io.metersphere.functional.mapper.FunctionalCaseMapper; import io.metersphere.functional.mapper.FunctionalCaseTestMapper; import io.metersphere.functional.request.AssociatePlanPageRequest; import io.metersphere.functional.request.DisassociateOtherCaseRequest; import io.metersphere.functional.request.FunctionalCaseTestRequest; +import io.metersphere.plan.domain.TestPlanCaseExecuteHistory; +import io.metersphere.plan.mapper.TestPlanCaseExecuteHistoryMapper; import io.metersphere.provider.BaseAssociateApiProvider; import io.metersphere.provider.BaseAssociateBugProvider; import io.metersphere.provider.BaseAssociateScenarioProvider; import io.metersphere.request.*; import io.metersphere.sdk.constants.FunctionalCaseExecuteResult; +import io.metersphere.sdk.constants.SessionConstants; import io.metersphere.sdk.util.JSON; import io.metersphere.system.base.BaseTest; import io.metersphere.system.controller.handler.ResultHolder; import io.metersphere.system.dto.sdk.BaseTreeNode; import io.metersphere.system.utils.Pager; import jakarta.annotation.Resource; +import org.apache.commons.lang3.StringUtils; import org.junit.jupiter.api.*; import org.mockito.Mockito; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; import org.springframework.test.context.jdbc.Sql; import org.springframework.test.context.jdbc.SqlConfig; import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @TestMethodOrder(MethodOrderer.OrderAnnotation.class) @AutoConfigureMockMvc @@ -67,6 +77,7 @@ public class FunctionalTestCaseControllerTests extends BaseTest { private static final String URL_ASSOCIATE_TEST_PLAN_PAGE = "/functional/case/test/has/associate/plan/page"; + private static final String URL_TEST_PLAN_EXECUTE_HISTORY = "/functional/case/test/plan/comment/"; @Resource @@ -90,6 +101,9 @@ public class FunctionalTestCaseControllerTests extends BaseTest { @Resource BaseAssociateBugProvider baseAssociateBugProvider; + @Resource + private TestPlanCaseExecuteHistoryMapper testPlanCaseExecuteHistoryMapper; + @Test @Order(1) @@ -548,4 +562,47 @@ public class FunctionalTestCaseControllerTests extends BaseTest { List list = tableData.getList(); Assertions.assertEquals(2, list.size()); } + + @Test + @Order(13) + public void testPlanExecuteHistoryList() throws Exception { + TestPlanCaseExecuteHistory testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory(); + testPlanCaseExecuteHistory.setTestPlanId("test_plan_associate_case_gyq_two"); + testPlanCaseExecuteHistory.setCaseId("gyq_associate_function_case"); + testPlanCaseExecuteHistory.setCreateUser("admin"); + testPlanCaseExecuteHistory.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString()); + testPlanCaseExecuteHistory.setId("test"); + String content = "你好评论"; + testPlanCaseExecuteHistory.setContent(content.getBytes()); + testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis()); + testPlanCaseExecuteHistoryMapper.insertSelective(testPlanCaseExecuteHistory); + List gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case"); + Assertions.assertTrue(StringUtils.isNotBlank(gyqReviewCaseTest.get(0).getContentText())); + testPlanCaseExecuteHistory = new TestPlanCaseExecuteHistory(); + testPlanCaseExecuteHistory.setTestPlanId("test_plan_associate_case_gyq_two"); + testPlanCaseExecuteHistory.setCaseId("gyq_associate_function_case"); + testPlanCaseExecuteHistory.setCreateUser("admin"); + testPlanCaseExecuteHistory.setStatus(FunctionalCaseReviewStatus.RE_REVIEWED.toString()); + testPlanCaseExecuteHistory.setId("testNoContent"); + testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis()); + String steps = "你好评论"; + testPlanCaseExecuteHistory.setSteps(steps.getBytes()); + testPlanCaseExecuteHistory.setCreateTime(System.currentTimeMillis()); + testPlanCaseExecuteHistoryMapper.insertSelective(testPlanCaseExecuteHistory); + gyqReviewCaseTest = getPlanExecuteHistoryList("gyq_associate_function_case"); + Assertions.assertTrue(gyqReviewCaseTest.size()>1); + } + + public List getPlanExecuteHistoryList(String caseId) throws Exception { + MvcResult mvcResult = mockMvc.perform(MockMvcRequestBuilders.get(URL_TEST_PLAN_EXECUTE_HISTORY + caseId).header(SessionConstants.HEADER_TOKEN, sessionId) + .header(SessionConstants.CSRF_TOKEN, csrfToken) + .header(SessionConstants.CURRENT_PROJECT, DEFAULT_PROJECT_ID) + .contentType(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andReturn(); + String contentAsString = mvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + ResultHolder resultHolder = JSON.parseObject(contentAsString, ResultHolder.class); + return JSON.parseArray(JSON.toJSONString(resultHolder.getData()), TestPlanCaseExecuteHistoryDTO.class); + + } } diff --git a/backend/services/system-setting/src/main/java/io/metersphere/system/config/interceptor/TestPlanInterceptor.java b/backend/services/system-setting/src/main/java/io/metersphere/system/config/interceptor/TestPlanInterceptor.java index 899e264440..9db5e352f3 100644 --- a/backend/services/system-setting/src/main/java/io/metersphere/system/config/interceptor/TestPlanInterceptor.java +++ b/backend/services/system-setting/src/main/java/io/metersphere/system/config/interceptor/TestPlanInterceptor.java @@ -1,6 +1,7 @@ package io.metersphere.system.config.interceptor; import io.metersphere.plan.domain.TestPlanAllocation; +import io.metersphere.plan.domain.TestPlanCaseExecuteHistory; import io.metersphere.sdk.util.CompressUtils; import io.metersphere.system.utils.MybatisInterceptorConfig; import org.springframework.context.annotation.Bean; @@ -16,6 +17,8 @@ public class TestPlanInterceptor { List configList = new ArrayList<>(); configList.add(new MybatisInterceptorConfig(TestPlanAllocation.class, "runModeConfig", CompressUtils.class, "zip", "unzip")); + configList.add(new MybatisInterceptorConfig(TestPlanCaseExecuteHistory.class, "content", CompressUtils.class, "zip", "unzip")); + configList.add(new MybatisInterceptorConfig(TestPlanCaseExecuteHistory.class, "steps", CompressUtils.class, "zip", "unzip")); return configList; }