diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseTest.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseTest.java new file mode 100644 index 0000000000..16f0754d4f --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseTest.java @@ -0,0 +1,18 @@ +package io.metersphere.base.domain; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class TestCaseTest implements Serializable { + private String id; + + private String testCaseId; + + private String testId; + + private String testType; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/domain/TestCaseTestExample.java b/backend/src/main/java/io/metersphere/base/domain/TestCaseTestExample.java new file mode 100644 index 0000000000..dade071131 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/domain/TestCaseTestExample.java @@ -0,0 +1,480 @@ +package io.metersphere.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class TestCaseTestExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public TestCaseTestExample() { + 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 andTestCaseIdIsNull() { + addCriterion("test_case_id is null"); + return (Criteria) this; + } + + public Criteria andTestCaseIdIsNotNull() { + addCriterion("test_case_id is not null"); + return (Criteria) this; + } + + public Criteria andTestCaseIdEqualTo(String value) { + addCriterion("test_case_id =", value, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdNotEqualTo(String value) { + addCriterion("test_case_id <>", value, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdGreaterThan(String value) { + addCriterion("test_case_id >", value, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdGreaterThanOrEqualTo(String value) { + addCriterion("test_case_id >=", value, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdLessThan(String value) { + addCriterion("test_case_id <", value, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdLessThanOrEqualTo(String value) { + addCriterion("test_case_id <=", value, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdLike(String value) { + addCriterion("test_case_id like", value, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdNotLike(String value) { + addCriterion("test_case_id not like", value, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdIn(List values) { + addCriterion("test_case_id in", values, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdNotIn(List values) { + addCriterion("test_case_id not in", values, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdBetween(String value1, String value2) { + addCriterion("test_case_id between", value1, value2, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestCaseIdNotBetween(String value1, String value2) { + addCriterion("test_case_id not between", value1, value2, "testCaseId"); + return (Criteria) this; + } + + public Criteria andTestIdIsNull() { + addCriterion("test_id is null"); + return (Criteria) this; + } + + public Criteria andTestIdIsNotNull() { + addCriterion("test_id is not null"); + return (Criteria) this; + } + + public Criteria andTestIdEqualTo(String value) { + addCriterion("test_id =", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdNotEqualTo(String value) { + addCriterion("test_id <>", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdGreaterThan(String value) { + addCriterion("test_id >", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdGreaterThanOrEqualTo(String value) { + addCriterion("test_id >=", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdLessThan(String value) { + addCriterion("test_id <", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdLessThanOrEqualTo(String value) { + addCriterion("test_id <=", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdLike(String value) { + addCriterion("test_id like", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdNotLike(String value) { + addCriterion("test_id not like", value, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdIn(List values) { + addCriterion("test_id in", values, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdNotIn(List values) { + addCriterion("test_id not in", values, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdBetween(String value1, String value2) { + addCriterion("test_id between", value1, value2, "testId"); + return (Criteria) this; + } + + public Criteria andTestIdNotBetween(String value1, String value2) { + addCriterion("test_id not between", value1, value2, "testId"); + return (Criteria) this; + } + + public Criteria andTestTypeIsNull() { + addCriterion("test_type is null"); + return (Criteria) this; + } + + public Criteria andTestTypeIsNotNull() { + addCriterion("test_type is not null"); + return (Criteria) this; + } + + public Criteria andTestTypeEqualTo(String value) { + addCriterion("test_type =", value, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeNotEqualTo(String value) { + addCriterion("test_type <>", value, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeGreaterThan(String value) { + addCriterion("test_type >", value, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeGreaterThanOrEqualTo(String value) { + addCriterion("test_type >=", value, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeLessThan(String value) { + addCriterion("test_type <", value, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeLessThanOrEqualTo(String value) { + addCriterion("test_type <=", value, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeLike(String value) { + addCriterion("test_type like", value, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeNotLike(String value) { + addCriterion("test_type not like", value, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeIn(List values) { + addCriterion("test_type in", values, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeNotIn(List values) { + addCriterion("test_type not in", values, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeBetween(String value1, String value2) { + addCriterion("test_type between", value1, value2, "testType"); + return (Criteria) this; + } + + public Criteria andTestTypeNotBetween(String value1, String value2) { + addCriterion("test_type not between", value1, value2, "testType"); + 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/src/main/java/io/metersphere/base/mapper/TestCaseReviewScenarioMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewScenarioMapper.xml index 2059c38ce8..af6f9b2498 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewScenarioMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseReviewScenarioMapper.xml @@ -2,18 +2,18 @@ - - - - - - - - - + + + + + + + + + - + @@ -80,46 +80,46 @@ environment - + select + + distinct + + + , + + from test_case_review_scenario + + order by ${orderByClause} - + select + + distinct + + + from test_case_review_scenario + + + + order by ${orderByClause} - + delete from test_case_review_scenario where id = #{id,jdbcType=VARCHAR} @@ -131,14 +131,14 @@ - insert into test_case_review_scenario (id, test_case_review_id, api_scenario_id, - `status`, create_time, update_time, - pass_rate, last_result, report_id, - environment) - values (#{id,jdbcType=VARCHAR}, #{testCaseReviewId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR}, - #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, - #{environment,jdbcType=LONGVARCHAR}) + insert into test_case_review_scenario (id, test_case_review_id, api_scenario_id, + `status`, create_time, update_time, + pass_rate, last_result, report_id, + environment) + values (#{id,jdbcType=VARCHAR}, #{testCaseReviewId,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR}, + #{status,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{passRate,jdbcType=VARCHAR}, #{lastResult,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, + #{environment,jdbcType=LONGVARCHAR}) insert into test_case_review_scenario @@ -248,37 +248,37 @@ - + - update test_case_review_scenario - set id = #{record.id,jdbcType=VARCHAR}, - test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR}, - api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR}, - `status` = #{record.status,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - pass_rate = #{record.passRate,jdbcType=VARCHAR}, - last_result = #{record.lastResult,jdbcType=VARCHAR}, - report_id = #{record.reportId,jdbcType=VARCHAR}, - environment = #{record.environment,jdbcType=LONGVARCHAR} - - + update test_case_review_scenario + set id = #{record.id,jdbcType=VARCHAR}, + test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR}, + api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + pass_rate = #{record.passRate,jdbcType=VARCHAR}, + last_result = #{record.lastResult,jdbcType=VARCHAR}, + report_id = #{record.reportId,jdbcType=VARCHAR}, + environment = #{record.environment,jdbcType=LONGVARCHAR} + + - update test_case_review_scenario - set id = #{record.id,jdbcType=VARCHAR}, - test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR}, - api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR}, - `status` = #{record.status,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - pass_rate = #{record.passRate,jdbcType=VARCHAR}, - last_result = #{record.lastResult,jdbcType=VARCHAR}, + update test_case_review_scenario + set id = #{record.id,jdbcType=VARCHAR}, + test_case_review_id = #{record.testCaseReviewId,jdbcType=VARCHAR}, + api_scenario_id = #{record.apiScenarioId,jdbcType=VARCHAR}, + `status` = #{record.status,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + pass_rate = #{record.passRate,jdbcType=VARCHAR}, + last_result = #{record.lastResult,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR} - + @@ -316,28 +316,28 @@ where id = #{id,jdbcType=VARCHAR} - update test_case_review_scenario - set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR}, - api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR}, - `status` = #{status,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - pass_rate = #{passRate,jdbcType=VARCHAR}, - last_result = #{lastResult,jdbcType=VARCHAR}, - report_id = #{reportId,jdbcType=VARCHAR}, - environment = #{environment,jdbcType=LONGVARCHAR} - where id = #{id,jdbcType=VARCHAR} + update test_case_review_scenario + set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR}, + api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + pass_rate = #{passRate,jdbcType=VARCHAR}, + last_result = #{lastResult,jdbcType=VARCHAR}, + report_id = #{reportId,jdbcType=VARCHAR}, + environment = #{environment,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=VARCHAR} - update test_case_review_scenario - set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR}, - api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR}, - `status` = #{status,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - pass_rate = #{passRate,jdbcType=VARCHAR}, - last_result = #{lastResult,jdbcType=VARCHAR}, - report_id = #{reportId,jdbcType=VARCHAR} - where id = #{id,jdbcType=VARCHAR} + update test_case_review_scenario + set test_case_review_id = #{testCaseReviewId,jdbcType=VARCHAR}, + api_scenario_id = #{apiScenarioId,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + pass_rate = #{passRate,jdbcType=VARCHAR}, + last_result = #{lastResult,jdbcType=VARCHAR}, + report_id = #{reportId,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java new file mode 100644 index 0000000000..444584fe4e --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.java @@ -0,0 +1,31 @@ +package io.metersphere.base.mapper; + +import io.metersphere.base.domain.TestCaseTest; +import io.metersphere.base.domain.TestCaseTestExample; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +public interface TestCaseTestMapper { + long countByExample(TestCaseTestExample example); + + int deleteByExample(TestCaseTestExample example); + + int deleteByPrimaryKey(String id); + + int insert(TestCaseTest record); + + int insertSelective(TestCaseTest record); + + List selectByExample(TestCaseTestExample example); + + TestCaseTest selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example); + + int updateByExample(@Param("record") TestCaseTest record, @Param("example") TestCaseTestExample example); + + int updateByPrimaryKeySelective(TestCaseTest record); + + int updateByPrimaryKey(TestCaseTest record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml new file mode 100644 index 0000000000..af19225f39 --- /dev/null +++ b/backend/src/main/java/io/metersphere/base/mapper/TestCaseTestMapper.xml @@ -0,0 +1,201 @@ + + + + + + + + + + + + + + + + + + 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_case_id, test_id, test_type + + + + + delete + from test_case_test + where id = #{id,jdbcType=VARCHAR} + + + delete from test_case_test + + + + + + insert into test_case_test (id, test_case_id, test_id, + test_type) + values (#{id,jdbcType=VARCHAR}, #{testCaseId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, + #{testType,jdbcType=VARCHAR}) + + + insert into test_case_test + + + id, + + + test_case_id, + + + test_id, + + + test_type, + + + + + #{id,jdbcType=VARCHAR}, + + + #{testCaseId,jdbcType=VARCHAR}, + + + #{testId,jdbcType=VARCHAR}, + + + #{testType,jdbcType=VARCHAR}, + + + + + + update test_case_test + + + id = #{record.id,jdbcType=VARCHAR}, + + + test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, + + + test_id = #{record.testId,jdbcType=VARCHAR}, + + + test_type = #{record.testType,jdbcType=VARCHAR}, + + + + + + + + update test_case_test + set id = #{record.id,jdbcType=VARCHAR}, + test_case_id = #{record.testCaseId,jdbcType=VARCHAR}, + test_id = #{record.testId,jdbcType=VARCHAR}, + test_type = #{record.testType,jdbcType=VARCHAR} + + + + + + update test_case_test + + + test_case_id = #{testCaseId,jdbcType=VARCHAR}, + + + test_id = #{testId,jdbcType=VARCHAR}, + + + test_type = #{testType,jdbcType=VARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update test_case_test + set test_case_id = #{testCaseId,jdbcType=VARCHAR}, + test_id = #{testId,jdbcType=VARCHAR}, + test_type = #{testType,jdbcType=VARCHAR} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml b/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml index daa5b8cd4a..6103aa3e95 100644 --- a/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml +++ b/backend/src/main/java/io/metersphere/base/mapper/TestPlanMapper.xml @@ -140,20 +140,20 @@ - insert into test_plan (id, workspace_id, report_id, - `name`, description, `status`, - stage, principal, test_case_match_rule, - executor_match_rule, create_time, update_time, - actual_end_time, planned_start_time, planned_end_time, - actual_start_time, creator, project_id, - execution_times, tags) - values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, - #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, - #{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR}, - #{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, - #{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT}, - #{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, - #{executionTimes,jdbcType=INTEGER}, #{tags,jdbcType=LONGVARCHAR}) + insert into test_plan (id, workspace_id, report_id, + `name`, description, `status`, + stage, principal, test_case_match_rule, + executor_match_rule, create_time, update_time, + actual_end_time, planned_start_time, planned_end_time, + actual_start_time, creator, project_id, + execution_times, tags) + values (#{id,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, + #{name,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, + #{stage,jdbcType=VARCHAR}, #{principal,jdbcType=VARCHAR}, #{testCaseMatchRule,jdbcType=VARCHAR}, + #{executorMatchRule,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{actualEndTime,jdbcType=BIGINT}, #{plannedStartTime,jdbcType=BIGINT}, #{plannedEndTime,jdbcType=BIGINT}, + #{actualStartTime,jdbcType=BIGINT}, #{creator,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, + #{executionTimes,jdbcType=INTEGER}, #{tags,jdbcType=LONGVARCHAR}) insert into test_plan @@ -357,8 +357,8 @@ - update test_plan - set id = #{record.id,jdbcType=VARCHAR}, + update test_plan + set id = #{record.id,jdbcType=VARCHAR}, workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR}, @@ -366,44 +366,44 @@ `status` = #{record.status,jdbcType=VARCHAR}, stage = #{record.stage,jdbcType=VARCHAR}, principal = #{record.principal,jdbcType=VARCHAR}, - test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR}, - executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - actual_end_time = #{record.actualEndTime,jdbcType=BIGINT}, - planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT}, - planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT}, - actual_start_time = #{record.actualStartTime,jdbcType=BIGINT}, - creator = #{record.creator,jdbcType=VARCHAR}, - project_id = #{record.projectId,jdbcType=VARCHAR}, - execution_times = #{record.executionTimes,jdbcType=INTEGER}, - tags = #{record.tags,jdbcType=LONGVARCHAR} - + test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR}, + executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + actual_end_time = #{record.actualEndTime,jdbcType=BIGINT}, + planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT}, + planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT}, + actual_start_time = #{record.actualStartTime,jdbcType=BIGINT}, + creator = #{record.creator,jdbcType=VARCHAR}, + project_id = #{record.projectId,jdbcType=VARCHAR}, + execution_times = #{record.executionTimes,jdbcType=INTEGER}, + tags = #{record.tags,jdbcType=LONGVARCHAR} + - update test_plan - set id = #{record.id,jdbcType=VARCHAR}, + update test_plan + set id = #{record.id,jdbcType=VARCHAR}, workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR}, description = #{record.description,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR}, stage = #{record.stage,jdbcType=VARCHAR}, - principal = #{record.principal,jdbcType=VARCHAR}, - test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR}, - executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR}, - create_time = #{record.createTime,jdbcType=BIGINT}, - update_time = #{record.updateTime,jdbcType=BIGINT}, - actual_end_time = #{record.actualEndTime,jdbcType=BIGINT}, - planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT}, - planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT}, - actual_start_time = #{record.actualStartTime,jdbcType=BIGINT}, - creator = #{record.creator,jdbcType=VARCHAR}, - project_id = #{record.projectId,jdbcType=VARCHAR}, - execution_times = #{record.executionTimes,jdbcType=INTEGER} - + principal = #{record.principal,jdbcType=VARCHAR}, + test_case_match_rule = #{record.testCaseMatchRule,jdbcType=VARCHAR}, + executor_match_rule = #{record.executorMatchRule,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + actual_end_time = #{record.actualEndTime,jdbcType=BIGINT}, + planned_start_time = #{record.plannedStartTime,jdbcType=BIGINT}, + planned_end_time = #{record.plannedEndTime,jdbcType=BIGINT}, + actual_start_time = #{record.actualStartTime,jdbcType=BIGINT}, + creator = #{record.creator,jdbcType=VARCHAR}, + project_id = #{record.projectId,jdbcType=VARCHAR}, + execution_times = #{record.executionTimes,jdbcType=INTEGER} + @@ -471,48 +471,48 @@ where id = #{id,jdbcType=VARCHAR} - update test_plan - set workspace_id = #{workspaceId,jdbcType=VARCHAR}, - report_id = #{reportId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, - `status` = #{status,jdbcType=VARCHAR}, - stage = #{stage,jdbcType=VARCHAR}, - principal = #{principal,jdbcType=VARCHAR}, - test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR}, - executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - actual_end_time = #{actualEndTime,jdbcType=BIGINT}, - planned_start_time = #{plannedStartTime,jdbcType=BIGINT}, - planned_end_time = #{plannedEndTime,jdbcType=BIGINT}, - actual_start_time = #{actualStartTime,jdbcType=BIGINT}, - creator = #{creator,jdbcType=VARCHAR}, - project_id = #{projectId,jdbcType=VARCHAR}, - execution_times = #{executionTimes,jdbcType=INTEGER}, - tags = #{tags,jdbcType=LONGVARCHAR} - where id = #{id,jdbcType=VARCHAR} + update test_plan + set workspace_id = #{workspaceId,jdbcType=VARCHAR}, + report_id = #{reportId,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + description = #{description,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + stage = #{stage,jdbcType=VARCHAR}, + principal = #{principal,jdbcType=VARCHAR}, + test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR}, + executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + actual_end_time = #{actualEndTime,jdbcType=BIGINT}, + planned_start_time = #{plannedStartTime,jdbcType=BIGINT}, + planned_end_time = #{plannedEndTime,jdbcType=BIGINT}, + actual_start_time = #{actualStartTime,jdbcType=BIGINT}, + creator = #{creator,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, + execution_times = #{executionTimes,jdbcType=INTEGER}, + tags = #{tags,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=VARCHAR} - update test_plan - set workspace_id = #{workspaceId,jdbcType=VARCHAR}, - report_id = #{reportId,jdbcType=VARCHAR}, - `name` = #{name,jdbcType=VARCHAR}, - description = #{description,jdbcType=VARCHAR}, - `status` = #{status,jdbcType=VARCHAR}, - stage = #{stage,jdbcType=VARCHAR}, - principal = #{principal,jdbcType=VARCHAR}, - test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR}, - executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR}, - create_time = #{createTime,jdbcType=BIGINT}, - update_time = #{updateTime,jdbcType=BIGINT}, - actual_end_time = #{actualEndTime,jdbcType=BIGINT}, - planned_start_time = #{plannedStartTime,jdbcType=BIGINT}, - planned_end_time = #{plannedEndTime,jdbcType=BIGINT}, - actual_start_time = #{actualStartTime,jdbcType=BIGINT}, - creator = #{creator,jdbcType=VARCHAR}, - project_id = #{projectId,jdbcType=VARCHAR}, - execution_times = #{executionTimes,jdbcType=INTEGER} - where id = #{id,jdbcType=VARCHAR} + update test_plan + set workspace_id = #{workspaceId,jdbcType=VARCHAR}, + report_id = #{reportId,jdbcType=VARCHAR}, + `name` = #{name,jdbcType=VARCHAR}, + description = #{description,jdbcType=VARCHAR}, + `status` = #{status,jdbcType=VARCHAR}, + stage = #{stage,jdbcType=VARCHAR}, + principal = #{principal,jdbcType=VARCHAR}, + test_case_match_rule = #{testCaseMatchRule,jdbcType=VARCHAR}, + executor_match_rule = #{executorMatchRule,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + actual_end_time = #{actualEndTime,jdbcType=BIGINT}, + planned_start_time = #{plannedStartTime,jdbcType=BIGINT}, + planned_end_time = #{plannedEndTime,jdbcType=BIGINT}, + actual_start_time = #{actualStartTime,jdbcType=BIGINT}, + creator = #{creator,jdbcType=VARCHAR}, + project_id = #{projectId,jdbcType=VARCHAR}, + execution_times = #{executionTimes,jdbcType=INTEGER} + where id = #{id,jdbcType=VARCHAR} \ No newline at end of file diff --git a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java index 85e342970a..56f477e3bc 100644 --- a/backend/src/main/java/io/metersphere/track/service/TestCaseService.java +++ b/backend/src/main/java/io/metersphere/track/service/TestCaseService.java @@ -30,6 +30,7 @@ import io.metersphere.track.request.testcase.QueryTestCaseRequest; import io.metersphere.track.request.testcase.TestCaseBatchRequest; import io.metersphere.track.request.testcase.TestCaseMinderEditRequest; import io.metersphere.xmind.XmindCaseParser; +import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.session.ExecutorType; @@ -37,7 +38,6 @@ import org.apache.ibatis.session.SqlSession; import org.apache.ibatis.session.SqlSessionFactory; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import org.apache.commons.collections.CollectionUtils; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; @@ -88,6 +88,8 @@ public class TestCaseService { FileService fileService; @Resource TestCaseFileMapper testCaseFileMapper; + @Resource + TestCaseTestMapper testCaseTestMapper; public TestCaseWithBLOBs addTestCase(TestCaseWithBLOBs testCase) { testCase.setName(testCase.getName()); @@ -181,6 +183,9 @@ public class TestCaseService { testPlanTestCaseMapper.deleteByExample(example); testCaseIssueService.delTestCaseIssues(testCaseId); testCaseCommentService.deleteCaseComment(testCaseId); + TestCaseTestExample examples = new TestCaseTestExample(); + examples.createCriteria().andTestCaseIdEqualTo(testCaseId); + testCaseTestMapper.deleteByExample(examples); return testCaseMapper.deleteByPrimaryKey(testCaseId); } @@ -652,7 +657,18 @@ public class TestCaseService { } final TestCaseWithBLOBs testCaseWithBLOBs = addTestCase(request); - + //插入测试与用例关系表 + if (!CollectionUtils.isEmpty(request.getSelected())) { + List> selecteds = request.getSelected(); + TestCaseTest test = new TestCaseTest(); + selecteds.forEach(id -> { + test.setTestType(id.get(0)); + test.setTestId(id.get(1)); + test.setId(UUID.randomUUID().toString()); + test.setTestCaseId(request.getId()); + testCaseTestMapper.insert(test); + }); + } // 复制用例时传入文件ID进行复制 if (!CollectionUtils.isEmpty(request.getFileIds())) { List fileIds = request.getFileIds(); @@ -665,6 +681,7 @@ public class TestCaseService { }); } + files.forEach(file -> { final FileMetadata fileMetadata = fileService.saveFile(file, testCaseWithBLOBs.getProjectId()); TestCaseFile testCaseFile = new TestCaseFile(); @@ -680,7 +697,21 @@ public class TestCaseService { if (testCaseWithBLOBs == null) { MSException.throwException(Translator.get("edit_load_test_not_found") + request.getId()); } - + //插入测试与用例关系表 + if (!CollectionUtils.isEmpty(request.getSelected())) { + TestCaseTestExample example = new TestCaseTestExample(); + example.createCriteria().andTestCaseIdEqualTo(request.getId()); + testCaseTestMapper.deleteByExample(example); + List> selecteds = request.getSelected(); + TestCaseTest test = new TestCaseTest(); + selecteds.forEach(id -> { + test.setTestType(id.get(0)); + test.setTestId(id.get(1)); + test.setId(UUID.randomUUID().toString()); + test.setTestCaseId(request.getId()); + testCaseTestMapper.insert(test); + }); + } // 新选择了一个文件,删除原来的文件 List updatedFiles = request.getUpdatedFileList(); List originFiles = fileService.getFileMetadataByCaseId(request.getId()); diff --git a/backend/src/main/resources/db/migration/V78__v1.8_release.sql b/backend/src/main/resources/db/migration/V78__v1.8_release.sql index 732b89b25d..122ecbbe44 100644 --- a/backend/src/main/resources/db/migration/V78__v1.8_release.sql +++ b/backend/src/main/resources/db/migration/V78__v1.8_release.sql @@ -162,18 +162,32 @@ SET file_metadata.project_id = temp.project_id; CREATE TABLE IF NOT EXISTS `esb_api_params` ( - id varchar(50) not null, - resource_id varchar(50), - data_struct LONGTEXT null, - fronted_script LONGTEXT null, - response_data_struct LONGTEXT null, - backed_script LONGTEXT null, + id varchar(50) not null, + resource_id varchar(50), + data_struct LONGTEXT null, + fronted_script LONGTEXT null, + response_data_struct LONGTEXT null, + backed_script LONGTEXT null, primary key (id), - UNIQUE KEY `resource_id` ( `resource_id` ) + UNIQUE KEY `resource_id` (`resource_id`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4; -- add execution_times testPlan alter table test_plan add execution_times int null; -alter table test_case modify method varchar(15) null comment 'Test case method type'; \ No newline at end of file +alter table test_case + modify method varchar(15) null comment 'Test case method type'; +-- add test_case_test +create table test_case_test +( + id varchar(70) null, + test_case_id varchar(70) null, + test_id varchar(70) null, + test_type varchar(70) null, + constraint test_case_test_pk + primary key (id) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4; +alter table test_case + modify test_id varchar(2000) null; \ No newline at end of file diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 22bd8330e7..d3b0c38faf 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -76,6 +76,7 @@
+
\ No newline at end of file diff --git a/frontend/src/business/components/api/definition/model/JsonData.js b/frontend/src/business/components/api/definition/model/JsonData.js index 6d16657b77..e9e4d441db 100644 --- a/frontend/src/business/components/api/definition/model/JsonData.js +++ b/frontend/src/business/components/api/definition/model/JsonData.js @@ -71,6 +71,12 @@ export const API_STATUS = [ {id: 'Underway', label: '进行中'}, {id: 'Completed', label: '已完成'} ] +export const TEST = [ + {id: 'performance', name: '性能测试'}, + {id: 'api', name: '接口测试'}, + {id: 'testcase', name: '测试用例'}, + {id: 'automation', name: '场景测试'} + ] export const API_METHOD_COLOUR = [ ['GET', "#61AFFE"], ['POST', '#49CC90'], ['PUT', '#fca130'], diff --git a/frontend/src/business/components/track/case/TestCase.vue b/frontend/src/business/components/track/case/TestCase.vue index d682a7ce7c..b9e418e40f 100644 --- a/frontend/src/business/components/track/case/TestCase.vue +++ b/frontend/src/business/components/track/case/TestCase.vue @@ -197,6 +197,7 @@ export default { } }, addTab(tab) { + this.projectId=getCurrentProjectID(); if (!this.projectId) { this.$warning(this.$t('commons.check_project_tip')); return; @@ -257,6 +258,7 @@ export default { this.testCaseReadOnly = true; } let caseId = this.$route.params.caseId; + this.projectId=getCurrentProjectID(); if (!this.projectId) { this.$warning(this.$t('commons.check_project_tip')); return; diff --git a/frontend/src/business/components/track/case/components/TestCaseEdit.vue b/frontend/src/business/components/track/case/components/TestCaseEdit.vue index a323c4acd7..583b8704c7 100644 --- a/frontend/src/business/components/track/case/components/TestCaseEdit.vue +++ b/frontend/src/business/components/track/case/components/TestCaseEdit.vue @@ -99,37 +99,15 @@ - - - - - - - - + + + - - - - - - - - - - + @@ -146,6 +124,7 @@ + @@ -310,7 +289,6 @@