feat: 测试跟踪版本管理初步提交

This commit is contained in:
zhangdahai111 2021-12-17 17:11:12 +08:00 committed by 刘瑞斌
parent 09aad16a0c
commit 6e29f06940
33 changed files with 1281 additions and 552 deletions

View File

@ -9,6 +9,8 @@ public class TestCase implements Serializable {
private String nodeId;
private String testId;
private String nodePath;
private String projectId;
@ -27,8 +29,6 @@ public class TestCase implements Serializable {
private Long updateTime;
private String testId;
private Integer sort;
private Integer num;
@ -45,10 +45,10 @@ public class TestCase implements Serializable {
private String status;
private String customNum;
private String stepModel;
private String customNum;
private String createUser;
private String originalStatus;
@ -61,5 +61,9 @@ public class TestCase implements Serializable {
private Boolean casePublic;
private String versionId;
private String refId;
private static final long serialVersionUID = 1L;
}

View File

@ -244,6 +244,76 @@ public class TestCaseExample {
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<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> 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 andNodePathIsNull() {
addCriterion("node_path is null");
return (Criteria) this;
@ -854,76 +924,6 @@ public class TestCaseExample {
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<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> 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 andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
@ -1464,76 +1464,6 @@ public class TestCaseExample {
return (Criteria) this;
}
public Criteria andCustomNumIsNull() {
addCriterion("custom_num is null");
return (Criteria) this;
}
public Criteria andCustomNumIsNotNull() {
addCriterion("custom_num is not null");
return (Criteria) this;
}
public Criteria andCustomNumEqualTo(String value) {
addCriterion("custom_num =", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotEqualTo(String value) {
addCriterion("custom_num <>", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThan(String value) {
addCriterion("custom_num >", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThanOrEqualTo(String value) {
addCriterion("custom_num >=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThan(String value) {
addCriterion("custom_num <", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThanOrEqualTo(String value) {
addCriterion("custom_num <=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLike(String value) {
addCriterion("custom_num like", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotLike(String value) {
addCriterion("custom_num not like", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumIn(List<String> values) {
addCriterion("custom_num in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotIn(List<String> values) {
addCriterion("custom_num not in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumBetween(String value1, String value2) {
addCriterion("custom_num between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotBetween(String value1, String value2) {
addCriterion("custom_num not between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andStepModelIsNull() {
addCriterion("step_model is null");
return (Criteria) this;
@ -1604,6 +1534,76 @@ public class TestCaseExample {
return (Criteria) this;
}
public Criteria andCustomNumIsNull() {
addCriterion("custom_num is null");
return (Criteria) this;
}
public Criteria andCustomNumIsNotNull() {
addCriterion("custom_num is not null");
return (Criteria) this;
}
public Criteria andCustomNumEqualTo(String value) {
addCriterion("custom_num =", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotEqualTo(String value) {
addCriterion("custom_num <>", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThan(String value) {
addCriterion("custom_num >", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThanOrEqualTo(String value) {
addCriterion("custom_num >=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThan(String value) {
addCriterion("custom_num <", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThanOrEqualTo(String value) {
addCriterion("custom_num <=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLike(String value) {
addCriterion("custom_num like", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotLike(String value) {
addCriterion("custom_num not like", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumIn(List<String> values) {
addCriterion("custom_num in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotIn(List<String> values) {
addCriterion("custom_num not in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumBetween(String value1, String value2) {
addCriterion("custom_num between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotBetween(String value1, String value2) {
addCriterion("custom_num not between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
@ -1993,6 +1993,146 @@ public class TestCaseExample {
addCriterion("case_public not between", value1, value2, "casePublic");
return (Criteria) this;
}
public Criteria andVersionIdIsNull() {
addCriterion("version_id is null");
return (Criteria) this;
}
public Criteria andVersionIdIsNotNull() {
addCriterion("version_id is not null");
return (Criteria) this;
}
public Criteria andVersionIdEqualTo(String value) {
addCriterion("version_id =", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotEqualTo(String value) {
addCriterion("version_id <>", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThan(String value) {
addCriterion("version_id >", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdGreaterThanOrEqualTo(String value) {
addCriterion("version_id >=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThan(String value) {
addCriterion("version_id <", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLessThanOrEqualTo(String value) {
addCriterion("version_id <=", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdLike(String value) {
addCriterion("version_id like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotLike(String value) {
addCriterion("version_id not like", value, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdIn(List<String> values) {
addCriterion("version_id in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotIn(List<String> values) {
addCriterion("version_id not in", values, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdBetween(String value1, String value2) {
addCriterion("version_id between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andVersionIdNotBetween(String value1, String value2) {
addCriterion("version_id not between", value1, value2, "versionId");
return (Criteria) this;
}
public Criteria andRefIdIsNull() {
addCriterion("ref_id is null");
return (Criteria) this;
}
public Criteria andRefIdIsNotNull() {
addCriterion("ref_id is not null");
return (Criteria) this;
}
public Criteria andRefIdEqualTo(String value) {
addCriterion("ref_id =", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotEqualTo(String value) {
addCriterion("ref_id <>", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdGreaterThan(String value) {
addCriterion("ref_id >", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdGreaterThanOrEqualTo(String value) {
addCriterion("ref_id >=", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLessThan(String value) {
addCriterion("ref_id <", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLessThanOrEqualTo(String value) {
addCriterion("ref_id <=", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdLike(String value) {
addCriterion("ref_id like", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotLike(String value) {
addCriterion("ref_id not like", value, "refId");
return (Criteria) this;
}
public Criteria andRefIdIn(List<String> values) {
addCriterion("ref_id in", values, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotIn(List<String> values) {
addCriterion("ref_id not in", values, "refId");
return (Criteria) this;
}
public Criteria andRefIdBetween(String value1, String value2) {
addCriterion("ref_id between", value1, value2, "refId");
return (Criteria) this;
}
public Criteria andRefIdNotBetween(String value1, String value2) {
addCriterion("ref_id not between", value1, value2, "refId");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCase">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="node_id" jdbcType="VARCHAR" property="nodeId" />
<result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="node_path" jdbcType="VARCHAR" property="nodePath" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
@ -13,7 +14,6 @@
<result column="method" jdbcType="VARCHAR" property="method" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="other_test_name" jdbcType="VARCHAR" property="otherTestName" />
@ -22,14 +22,16 @@
<result column="demand_id" jdbcType="VARCHAR" property="demandId" />
<result column="demand_name" jdbcType="VARCHAR" property="demandName" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="custom_num" jdbcType="VARCHAR" property="customNum" />
<result column="step_model" jdbcType="VARCHAR" property="stepModel" />
<result column="custom_num" jdbcType="VARCHAR" property="customNum" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="original_status" jdbcType="VARCHAR" property="originalStatus" />
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
<result column="order" jdbcType="BIGINT" property="order" />
<result column="case_public" jdbcType="BIT" property="casePublic"/>
<result column="case_public" jdbcType="BIT" property="casePublic" />
<result column="version_id" jdbcType="VARCHAR" property="versionId" />
<result column="ref_id" jdbcType="VARCHAR" property="refId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
<result column="prerequisite" jdbcType="LONGVARCHAR" property="prerequisite" />
@ -98,11 +100,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id
, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
create_time, update_time, test_id, sort, num, other_test_name, review_status, tags,
demand_id, demand_name, `status`, custom_num, step_model, create_user, original_status,
delete_time, delete_user_id, `order`, case_public
id, node_id, test_id, node_path, project_id, `name`, `type`, maintainer, priority,
`method`, create_time, update_time, sort, num, other_test_name, review_status, tags,
demand_id, demand_name, `status`, step_model, custom_num, create_user, original_status,
delete_time, delete_user_id, `order`, case_public, version_id, ref_id
</sql>
<sql id="Blob_Column_List">
prerequisite, remark, steps, step_description, expected_result, custom_fields
@ -156,31 +157,32 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
insert into test_case (id, node_id, node_path,
project_id, `name`, `type`,
maintainer, priority, `method`,
create_time, update_time, test_id,
sort, num, other_test_name,
review_status, tags, demand_id,
demand_name, `status`, custom_num,
step_model, create_user, original_status,
delete_time, delete_user_id, `order`,
case_public, prerequisite, remark,
steps, step_description, expected_result,
custom_fields)
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{testId,jdbcType=VARCHAR},
#{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{otherTestName,jdbcType=VARCHAR},
#{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR},
#{demandName,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR},
#{stepModel,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
#{casePublic,jdbcType=BIT}, #{prerequisite,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR},
#{steps,jdbcType=LONGVARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR},
#{expectedResult,jdbcType=LONGVARCHAR},
#{customFields,jdbcType=LONGVARCHAR})
insert into test_case (id, node_id, test_id,
node_path, project_id, `name`,
`type`, maintainer, priority,
`method`, create_time, update_time,
sort, num, other_test_name,
review_status, tags, demand_id,
demand_name, `status`, step_model,
custom_num, create_user, original_status,
delete_time, delete_user_id, `order`,
case_public, version_id, ref_id,
prerequisite, remark, steps,
step_description, expected_result,
custom_fields)
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
#{nodePath,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{otherTestName,jdbcType=VARCHAR},
#{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR},
#{demandName,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR},
#{customNum,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
#{casePublic,jdbcType=BIT}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
#{prerequisite,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR},
#{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR},
#{customFields,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
insert into test_case
@ -191,6 +193,9 @@
<if test="nodeId != null">
node_id,
</if>
<if test="testId != null">
test_id,
</if>
<if test="nodePath != null">
node_path,
</if>
@ -218,9 +223,6 @@
<if test="updateTime != null">
update_time,
</if>
<if test="testId != null">
test_id,
</if>
<if test="sort != null">
sort,
</if>
@ -245,48 +247,54 @@
<if test="status != null">
`status`,
</if>
<if test="stepModel != null">
step_model,
</if>
<if test="customNum != null">
custom_num,
</if>
<if test="stepModel != null">
step_model,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="originalStatus != null">
original_status,
</if>
<if test="deleteTime != null">
delete_time,
</if>
<if test="deleteUserId != null">
delete_user_id,
</if>
<if test="order != null">
`order`,
</if>
<if test="casePublic != null">
case_public,
</if>
<if test="prerequisite != null">
prerequisite,
</if>
<if test="remark != null">
remark,
</if>
<if test="steps != null">
steps,
</if>
<if test="stepDescription != null">
step_description,
</if>
<if test="expectedResult != null">
expected_result,
</if>
<if test="customFields != null">
custom_fields,
</if>
<if test="createUser != null">
create_user,
</if>
<if test="originalStatus != null">
original_status,
</if>
<if test="deleteTime != null">
delete_time,
</if>
<if test="deleteUserId != null">
delete_user_id,
</if>
<if test="order != null">
`order`,
</if>
<if test="casePublic != null">
case_public,
</if>
<if test="versionId != null">
version_id,
</if>
<if test="refId != null">
ref_id,
</if>
<if test="prerequisite != null">
prerequisite,
</if>
<if test="remark != null">
remark,
</if>
<if test="steps != null">
steps,
</if>
<if test="stepDescription != null">
step_description,
</if>
<if test="expectedResult != null">
expected_result,
</if>
<if test="customFields != null">
custom_fields,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -295,6 +303,9 @@
<if test="nodeId != null">
#{nodeId,jdbcType=VARCHAR},
</if>
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="nodePath != null">
#{nodePath,jdbcType=VARCHAR},
</if>
@ -322,9 +333,6 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
@ -349,48 +357,54 @@
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="stepModel != null">
#{stepModel,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
#{customNum,jdbcType=VARCHAR},
</if>
<if test="stepModel != null">
#{stepModel,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="originalStatus != null">
#{originalStatus,jdbcType=VARCHAR},
</if>
<if test="deleteTime != null">
#{deleteTime,jdbcType=BIGINT},
</if>
<if test="deleteUserId != null">
#{deleteUserId,jdbcType=VARCHAR},
</if>
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
</if>
<if test="prerequisite != null">
#{prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=LONGVARCHAR},
</if>
<if test="steps != null">
#{steps,jdbcType=LONGVARCHAR},
</if>
<if test="stepDescription != null">
#{stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="expectedResult != null">
#{expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="customFields != null">
#{customFields,jdbcType=LONGVARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
<if test="originalStatus != null">
#{originalStatus,jdbcType=VARCHAR},
</if>
<if test="deleteTime != null">
#{deleteTime,jdbcType=BIGINT},
</if>
<if test="deleteUserId != null">
#{deleteUserId,jdbcType=VARCHAR},
</if>
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
<if test="casePublic != null">
#{casePublic,jdbcType=BIT},
</if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
#{refId,jdbcType=VARCHAR},
</if>
<if test="prerequisite != null">
#{prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="remark != null">
#{remark,jdbcType=LONGVARCHAR},
</if>
<if test="steps != null">
#{steps,jdbcType=LONGVARCHAR},
</if>
<if test="stepDescription != null">
#{stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="expectedResult != null">
#{expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="customFields != null">
#{customFields,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseExample" resultType="java.lang.Long">
@ -408,6 +422,9 @@
<if test="record.nodeId != null">
node_id = #{record.nodeId,jdbcType=VARCHAR},
</if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.nodePath != null">
node_path = #{record.nodePath,jdbcType=VARCHAR},
</if>
@ -435,9 +452,6 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
@ -462,48 +476,54 @@
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.stepModel != null">
step_model = #{record.stepModel,jdbcType=VARCHAR},
</if>
<if test="record.customNum != null">
custom_num = #{record.customNum,jdbcType=VARCHAR},
</if>
<if test="record.stepModel != null">
step_model = #{record.stepModel,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.originalStatus != null">
original_status = #{record.originalStatus,jdbcType=VARCHAR},
</if>
<if test="record.deleteTime != null">
delete_time = #{record.deleteTime,jdbcType=BIGINT},
</if>
<if test="record.deleteUserId != null">
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
</if>
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
</if>
<if test="record.prerequisite != null">
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=LONGVARCHAR},
</if>
<if test="record.steps != null">
steps = #{record.steps,jdbcType=LONGVARCHAR},
</if>
<if test="record.stepDescription != null">
step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="record.expectedResult != null">
expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="record.customFields != null">
custom_fields = #{record.customFields,jdbcType=LONGVARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
<if test="record.originalStatus != null">
original_status = #{record.originalStatus,jdbcType=VARCHAR},
</if>
<if test="record.deleteTime != null">
delete_time = #{record.deleteTime,jdbcType=BIGINT},
</if>
<if test="record.deleteUserId != null">
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
</if>
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
<if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT},
</if>
<if test="record.versionId != null">
version_id = #{record.versionId,jdbcType=VARCHAR},
</if>
<if test="record.refId != null">
ref_id = #{record.refId,jdbcType=VARCHAR},
</if>
<if test="record.prerequisite != null">
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="record.remark != null">
remark = #{record.remark,jdbcType=LONGVARCHAR},
</if>
<if test="record.steps != null">
steps = #{record.steps,jdbcType=LONGVARCHAR},
</if>
<if test="record.stepDescription != null">
step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="record.expectedResult != null">
expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="record.customFields != null">
custom_fields = #{record.customFields,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -513,6 +533,7 @@
update test_case
set id = #{record.id,jdbcType=VARCHAR},
node_id = #{record.nodeId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
node_path = #{record.nodePath,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
@ -522,7 +543,6 @@
`method` = #{record.method,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
num = #{record.num,jdbcType=INTEGER},
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
@ -531,28 +551,31 @@
demand_id = #{record.demandId,jdbcType=VARCHAR},
demand_name = #{record.demandName,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
step_model = #{record.stepModel,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
original_status = #{record.originalStatus,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT},
case_public = #{record.casePublic,jdbcType=BIT},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR},
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
remark = #{record.remark,jdbcType=LONGVARCHAR},
steps = #{record.steps,jdbcType=LONGVARCHAR},
step_description = #{record.stepDescription,jdbcType=LONGVARCHAR},
expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
custom_fields = #{record.customFields,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_case
set id = #{record.id,jdbcType=VARCHAR},
node_id = #{record.nodeId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
node_path = #{record.nodePath,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
@ -562,7 +585,6 @@
`method` = #{record.method,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
num = #{record.num,jdbcType=INTEGER},
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
@ -571,17 +593,19 @@
demand_id = #{record.demandId,jdbcType=VARCHAR},
demand_name = #{record.demandName,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
step_model = #{record.stepModel,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
original_status = #{record.originalStatus,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT},
case_public = #{record.casePublic,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/>
</if>
case_public = #{record.casePublic,jdbcType=BIT},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
update test_case
@ -589,6 +613,9 @@
<if test="nodeId != null">
node_id = #{nodeId,jdbcType=VARCHAR},
</if>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
</if>
<if test="nodePath != null">
node_path = #{nodePath,jdbcType=VARCHAR},
</if>
@ -616,9 +643,6 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
@ -643,117 +667,127 @@
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="stepModel != null">
step_model = #{stepModel,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
custom_num = #{customNum,jdbcType=VARCHAR},
</if>
<if test="stepModel != null">
step_model = #{stepModel,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="originalStatus != null">
original_status = #{originalStatus,jdbcType=VARCHAR},
</if>
<if test="deleteTime != null">
delete_time = #{deleteTime,jdbcType=BIGINT},
</if>
<if test="deleteUserId != null">
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
</if>
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
</if>
<if test="prerequisite != null">
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
<if test="steps != null">
steps = #{steps,jdbcType=LONGVARCHAR},
</if>
<if test="stepDescription != null">
step_description = #{stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="expectedResult != null">
expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="customFields != null">
custom_fields = #{customFields,jdbcType=LONGVARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
<if test="originalStatus != null">
original_status = #{originalStatus,jdbcType=VARCHAR},
</if>
<if test="deleteTime != null">
delete_time = #{deleteTime,jdbcType=BIGINT},
</if>
<if test="deleteUserId != null">
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
</if>
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT},
</if>
<if test="versionId != null">
version_id = #{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
ref_id = #{refId,jdbcType=VARCHAR},
</if>
<if test="prerequisite != null">
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
</if>
<if test="remark != null">
remark = #{remark,jdbcType=LONGVARCHAR},
</if>
<if test="steps != null">
steps = #{steps,jdbcType=LONGVARCHAR},
</if>
<if test="stepDescription != null">
step_description = #{stepDescription,jdbcType=LONGVARCHAR},
</if>
<if test="expectedResult != null">
expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
</if>
<if test="customFields != null">
custom_fields = #{customFields,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
update test_case
set node_id = #{nodeId,jdbcType=VARCHAR},
node_path = #{nodePath,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
maintainer = #{maintainer,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR},
review_status = #{reviewStatus,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
demand_id = #{demandId,jdbcType=VARCHAR},
demand_name = #{demandName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
original_status = #{originalStatus,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
case_public = #{casePublic,jdbcType=BIT},
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
remark = #{remark,jdbcType=LONGVARCHAR},
steps = #{steps,jdbcType=LONGVARCHAR},
step_description = #{stepDescription,jdbcType=LONGVARCHAR},
expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
custom_fields = #{customFields,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
update test_case
set node_id = #{nodeId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
node_path = #{nodePath,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
maintainer = #{maintainer,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR},
review_status = #{reviewStatus,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
demand_id = #{demandId,jdbcType=VARCHAR},
demand_name = #{demandName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
original_status = #{originalStatus,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
case_public = #{casePublic,jdbcType=BIT},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR},
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
remark = #{remark,jdbcType=LONGVARCHAR},
steps = #{steps,jdbcType=LONGVARCHAR},
step_description = #{stepDescription,jdbcType=LONGVARCHAR},
expected_result = #{expectedResult,jdbcType=LONGVARCHAR},
custom_fields = #{customFields,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCase">
update test_case
set node_id = #{nodeId,jdbcType=VARCHAR},
node_path = #{nodePath,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
maintainer = #{maintainer,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR},
review_status = #{reviewStatus,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
demand_id = #{demandId,jdbcType=VARCHAR},
demand_name = #{demandName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
original_status = #{originalStatus,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
case_public = #{casePublic,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
update test_case
set node_id = #{nodeId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
node_path = #{nodePath,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
maintainer = #{maintainer,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR},
`method` = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR},
review_status = #{reviewStatus,jdbcType=VARCHAR},
tags = #{tags,jdbcType=VARCHAR},
demand_id = #{demandId,jdbcType=VARCHAR},
demand_name = #{demandName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
original_status = #{originalStatus,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
case_public = #{casePublic,jdbcType=BIT},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -12,6 +12,9 @@
<if test="request.name != null and request.name != ''">
AND project_version.name LIKE #{request.name, jdbcType=VARCHAR}
</if>
<if test="request.latest != null and request.latest != ''">
AND project_version.latest = #{request.latest, jdbcType=INTEGER}
</if>
<if test="request.filters != null and request.filters.size() > 0">
<foreach collection="request.filters.entrySet()" index="key" item="values">
<if test="values != null and values.size() > 0">

View File

@ -38,7 +38,7 @@ public interface ExtTestCaseMapper {
* @param request
* @return
*/
List<TestCase> getTestCaseByNotInPlan(@Param("request") QueryTestCaseRequest request);
List<TestCaseDTO> getTestCaseByNotInPlan(@Param("request") QueryTestCaseRequest request);
/**
* 获取不在测试缺陷中的用例
@ -54,7 +54,7 @@ public interface ExtTestCaseMapper {
* @param request
* @return
*/
List<TestCase> getTestCaseByNotInReview(@Param("request") QueryTestCaseRequest request);
List<TestCaseDTO> getTestCaseByNotInReview(@Param("request") QueryTestCaseRequest request);
/**
* 检查某工作空间下是否有某用例

View File

@ -83,10 +83,18 @@
update test_case set custom_num = num where (custom_num is null or custom_num = '') and project_id = #{projectId}
</update>
<select id="getTestCaseByNotInReview" resultType="io.metersphere.base.domain.TestCase">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status from test_case
as test_case
<select id="getTestCaseByNotInReview" resultType="io.metersphere.track.dto.TestCaseDTO">
select
test_case.id,
test_case.name,
test_case.priority,
test_case.type,
test_case.review_status,
project_version.name as versionName,
project_version.id as versionId
from test_case
left join test_case_review_test_case as T2 on test_case.id=T2.case_id and T2.review_id =#{request.reviewId}
left join project_version on test_case.version_id = project_version.id
<include refid="notInQueryWhereCondition"/>
and T2.case_id is null
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
@ -119,14 +127,44 @@
#{nodeId}
</foreach>
</if>
<if test="request.versionId != null">
and test_case.version_id = #{request.versionId}
</if>
<if test="request.refId != null">
and test_case.ref_id = #{request.refId}
</if>
<if test="request.versionId == null and request.refId == null and request.id == null">
AND (
version_id = (SELECT project_version.id
FROM test_case tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
WHERE ref_id = test_case.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
FROM test_case tmp
JOIN project_version ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id
WHERE ref_id = test_case.ref_id
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
LIMIT 1)
)
</if>
<include refid="filters"/>
</where>
</sql>
<select id="getTestCaseByNotInPlan" resultType="io.metersphere.base.domain.TestCase">
<select id="getTestCaseByNotInPlan" resultType="io.metersphere.track.dto.TestCaseDTO">
select test_case.id, test_case.name, test_case.priority, test_case.type, test_case.review_status,
test_case.num, test_case.custom_num, test_case.priority, test_case.tags, test_case.create_time, test_case.update_time
from test_case as test_case
test_case.num, test_case.custom_num, test_case.priority, test_case.tags, test_case.create_time,
test_case.update_time,
project_version.name versionName, test_case.version_id versionId
from test_case
left join project_version on project_version.project_id = test_case.project_id and project_version.id =
test_case.version_id
<if test="!request.repeatCase">
left join test_plan_test_case as T2 on test_case.id=T2.case_id and T2.plan_id =#{request.planId}
</if>
@ -168,6 +206,8 @@
<select id="list" resultType="io.metersphere.track.dto.TestCaseDTO">
select
deleteUser.name AS delete_user_id,test_case.delete_time,
project_version.name as versionName,
project_version.id as versionId,
<if test="request.selectFields != null and request.selectFields.size() > 0">
<foreach collection="request.selectFields" item="field" separator=",">
${field}
@ -185,6 +225,8 @@
from test_case left join user u on test_case.create_user=u.id
left join user deleteUser on test_case.delete_user_id=deleteUser.id
left join project on test_case.project_id = project.id
left join project_version on project.id = project_version.project_id and project_version.id =
test_case.version_id
<include refid="queryWhereCondition"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select>
@ -407,6 +449,12 @@
#{value}
</foreach>
</when>
<when test="key=='version_id'">
and test_case.version_id in
<foreach collection="values" open="(" close=")" separator="," item="value">
#{value}
</foreach>
</when>
</choose>
</if>
<if test="key=='status' and (values == null || values.size() == 0)">
@ -474,6 +522,32 @@
<if test="request.caseCoverage == 'coverage' ">
and test_case.id in (select distinct test_case_test.test_case_id from test_case_test)
</if>
<if test="request.versionId != null">
and test_case.version_id = #{request.versionId}
</if>
<if test="request.refId != null">
and test_case.ref_id = #{request.refId}
</if>
<if test="request.versionId == null and request.refId == null and request.id == null">
AND (
version_id = (SELECT project_version.id
FROM test_case tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
WHERE ref_id = test_case.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
FROM test_case tmp
JOIN project_version ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id
WHERE ref_id = test_case.ref_id
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
LIMIT 1)
)
</if>
</where>
</sql>

View File

@ -171,6 +171,32 @@
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
<if test="request.versionId != null">
and test_case.version_id = #{request.versionId}
</if>
<if test="request.refId != null">
and test_case.ref_id = #{request.refId}
</if>
<if test="request.versionId == null and request.refId == null and request.id == null">
AND (
version_id = (SELECT project_version.id
FROM test_case tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
WHERE ref_id = test_case.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
FROM test_case tmp
JOIN project_version ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id
WHERE ref_id = test_case.ref_id
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
LIMIT 1)
)
</if>
and test_case.status != 'Trash'
<include refid="filter"/>
</where>
@ -211,6 +237,12 @@
#{value}
</foreach>
</when>
<when test="key=='version_id'">
and test_case.version_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<otherwise>
and test_plan_test_case.status in
<foreach collection="values" item="value" separator="," open="(" close=")">
@ -232,11 +264,13 @@
test_plan_test_case.actual_result,
test_plan_test_case.update_time, test_plan_test_case.create_time,test_case_node.name as model, project.name as
projectName,test_plan_test_case.issues as issues,test_plan_test_case.issues_count as issuesCount,
test_plan_test_case.plan_id as planId
test_plan_test_case.plan_id as planId,test_case.version_id as versionId,
project_version.name as versionName
from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id = test_case.node_id
inner join project on project.id = test_case.project_id
left join project_version on project_version.id = test_case.version_id and project.id = project_version.project_id
<include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0">
order by

View File

@ -104,11 +104,13 @@
test_case.custom_num) as customNum, test_case.review_status,
test_case.remark as remark, test_case.maintainer, test_case.steps as steps, test_case.node_id as nodeId,
test_case_node.name as model,
project.name as projectName
project.name as projectName,
project_version.name as versionName,project_version.id as versionId
from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id
left join test_case_node on test_case_node.id=test_case.node_id
inner join project on project.id = test_case.project_id
left join project_version on project_version.project_id = project.id and test_case.version_id = project_version.id
<include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0">
order by
@ -165,6 +167,32 @@
<if test="request.method != null">
and test_case.method = #{request.method}
</if>
<if test="request.versionId != null">
and test_case.version_id = #{request.versionId}
</if>
<if test="request.refId != null">
and test_case.ref_id = #{request.refId}
</if>
<if test="request.versionId == null and request.refId == null and request.id == null">
AND (
version_id = (SELECT project_version.id
FROM test_case tmp
JOIN project_version
ON tmp.project_id = project_version.project_id AND tmp.version_id = project_version.id AND latest = TRUE
WHERE ref_id = test_case.ref_id
LIMIT 1)
OR
version_id = (SELECT project_version.id
FROM test_case tmp
JOIN project_version ON tmp.project_id = project_version.project_id AND
tmp.version_id = project_version.id
WHERE ref_id = test_case.ref_id
GROUP BY ref_id
HAVING MAX(latest) = 0
ORDER BY MAX(project_version.create_time) DESC
LIMIT 1)
)
</if>
<include refid="filter"/>
</where>
</sql>
@ -203,6 +231,12 @@
#{value}
</foreach>
</when>
<when test="key=='version_id'">
and test_case.version_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose>
</if>
</foreach>

View File

@ -71,4 +71,14 @@ public class BaseQueryRequest {
* 要查询的字段
*/
private List<String> selectFields;
/**
* 版本 ID
*/
private String versionId;
/**
* 版本来源字段
*/
private String refId;
}

View File

@ -12,6 +12,7 @@ public class ProjectVersionRequest {
private String name;
private String projectId;
private String createUser;
private Boolean latest;
private List<OrderRequest> orders;
private Map<String, List<String>> filters;
private Map<String, Object> combine;

View File

@ -133,7 +133,7 @@ public class TestCaseController {
}
@PostMapping("/relate/{goPage}/{pageSize}")
public Pager<List<TestCase>> getTestCaseRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
public Pager<List<TestCaseDTO>> getTestCaseRelateList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
// Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return testCaseService.getTestCaseRelateList(request, goPage, pageSize);
}
@ -183,7 +183,7 @@ public class TestCaseController {
}
@PostMapping("/reviews/case/{goPage}/{pageSize}")
public Pager<List<TestCase>> getReviewCase(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
public Pager<List<TestCaseDTO>> getReviewCase(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestCaseRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testCaseService.getReviewCase(request));
}
@ -400,4 +400,19 @@ public class TestCaseController {
public void editTestFollows(@PathVariable String caseId,@RequestBody List<String> follows) {
testCaseService.saveFollows(caseId,follows);
}
@GetMapping("versions/{caseId}")
public List<TestCaseDTO> getTestCaseVersions(@PathVariable String caseId) {
return testCaseService.getTestCaseVersions(caseId);
}
@GetMapping("get/{version}/{refId}")
public TestCaseDTO getTestCase(@PathVariable String version, @PathVariable String refId) {
return testCaseService.getTestCaseByVersion(refId, version);
}
@GetMapping("delete/{version}/{refId}")
public void deleteApiDefinition(@PathVariable String version, @PathVariable String refId) {
testCaseService.deleteTestCaseByVersion(refId, version);
}
}

View File

@ -19,6 +19,7 @@ public class TestCaseDTO extends TestCaseWithBLOBs {
private String projectName;
private String createName;
private String lastExecuteResult;
private String versionName;
private List<String> caseTags = new ArrayList<>();
private List<IssuesDao> issueList = new ArrayList<>();

View File

@ -24,6 +24,7 @@ public class TestPlanCaseDTO extends TestCaseWithBLOBs {
private String maintainerName;
private Boolean isCustomNum;
private int issuesCount;
private String versionName;
private List<TestCaseTestDTO> list;
private List<IssuesDao> issueList;

View File

@ -19,5 +19,6 @@ public class TestReviewCaseDTO extends TestCaseWithBLOBs {
private String issues;
private String model;
private String projectName;
private String versionName;
private List<TestCaseTestDTO> list;
}

View File

@ -42,4 +42,8 @@ public class QueryCaseReviewRequest extends TestCaseReviewTestCase {
private String projectName;
private String reviewerId;
private String versionId;
private String refId;
}

View File

@ -26,6 +26,7 @@ import io.metersphere.notice.sender.NoticeModel;
import io.metersphere.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.dto.TestReviewDTOWithMetric;
@ -360,7 +361,7 @@ public class TestCaseReviewService {
// 如果是关联全部指令则根据条件查询未关联的案例
if (testCaseIds.get(0).equals("all")) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
List<TestCaseDTO> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
}
@ -634,7 +635,7 @@ public class TestCaseReviewService {
List<String> testCaseIds = request.getTestCaseIds();
List<String> names = new ArrayList<>();
if (testCaseIds.get(0).equals("all")) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
List<TestCaseDTO> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
if (!testCases.isEmpty()) {
names = testCases.stream().map(TestCase::getName).collect(Collectors.toList());
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());

View File

@ -24,6 +24,7 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.ProjectVersionRequest;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.dto.*;
@ -152,6 +153,8 @@ public class TestCaseService {
private TestPlanService testPlanService;
@Resource
private MinderExtraNodeService minderExtraNodeService;
@Resource
private ProjectVersionService projectVersionService;
private void setNode(TestCaseWithBLOBs testCase) {
if (StringUtils.isEmpty(testCase.getNodeId()) || "default-module".equals(testCase.getNodeId())) {
@ -183,6 +186,23 @@ public class TestCaseService {
request.setCreateUser(SessionUtils.getUserId());
this.setNode(request);
request.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extTestCaseMapper::getLastOrder));
//直接点保存
if (StringUtils.isAllBlank(request.getRefId(), request.getVersionId())) {
//新创建测试用例默认使用最新版本
request.setRefId(request.getId());
ProjectVersionRequest pvr = new ProjectVersionRequest();
pvr.setProjectId(request.getProjectId());
pvr.setLatest(true);
List<ProjectVersionDTO> pvs = projectVersionService.getVersionList(pvr);
if (pvs.size() == 0) {
MSException.throwException(Translator.get("no_version_exists"));
}
request.setVersionId(pvs.get(0).getId());
} else if (StringUtils.isBlank(request.getRefId()) && StringUtils.isNotBlank(request.getVersionId())) {
//从版本选择直接创建
request.setRefId(request.getId());
}
testCaseMapper.insert(request);
saveFollows(request.getId(), request.getFollows());
return request;
@ -245,6 +265,22 @@ public class TestCaseService {
public int editTestCase(TestCaseWithBLOBs testCase) {
checkTestCustomNum(testCase);
testCase.setUpdateTime(System.currentTimeMillis());
// 更新数据
TestCaseExample example = new TestCaseExample();
example.createCriteria().andIdEqualTo(testCase.getId()).andVersionIdEqualTo(testCase.getVersionId());
if (testCaseMapper.updateByExampleSelective(testCase, example) == 0) {
// 插入新版本的数据
TestCaseWithBLOBs oldTestCase = testCaseMapper.selectByPrimaryKey(testCase.getId());
testCase.setId(UUID.randomUUID().toString());
testCase.setNum(oldTestCase.getNum());
testCase.setVersionId(testCase.getVersionId());
testCase.setCreateTime(System.currentTimeMillis());
testCase.setUpdateTime(System.currentTimeMillis());
testCase.setCreateUser(SessionUtils.getUserId());
testCase.setOrder(oldTestCase.getOrder());
testCase.setRefId(oldTestCase.getRefId());
testCaseMapper.insertSelective(testCase);
}
return testCaseMapper.updateByPrimaryKeySelective(testCase);
}
@ -375,12 +411,6 @@ public class TestCaseService {
return extTestCaseMapper.deleteToGc(testCase);
}
public int deleteTestCasePublic(String testCaseId) {
TestCase testCase = new TestCase();
testCase.setId(testCaseId);
return extTestCaseMapper.deletePublic(testCase);
}
public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) {
this.initRequest(request, true);
setDefaultOrder(request);
@ -403,6 +433,7 @@ public class TestCaseService {
return returnList;
}
public void setDefaultOrder(QueryTestCaseRequest request) {
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
OrderRequest order = new OrderRequest();
@ -417,9 +448,9 @@ public class TestCaseService {
TestCaseExcelData excelData = new TestCaseExcelDataFactory().getTestCaseExcelDataLocal();
for (TestCaseDTO data : returnList) {
String lastStatus = extTestCaseMapper.getLastExecStatusById(data.getId());
if(StringUtils.isNotEmpty(lastStatus)){
if (StringUtils.isNotEmpty(lastStatus)) {
data.setLastExecuteResult(lastStatus);
}else {
} else {
data.setLastExecuteResult(null);
}
String dataStatus = excelData.parseStatus(data.getStatus());
@ -486,7 +517,7 @@ public class TestCaseService {
* @param request
* @return
*/
public Pager<List<TestCase>> getTestCaseRelateList(QueryTestCaseRequest request, int goPage, int pageSize) {
public Pager<List<TestCaseDTO>> getTestCaseRelateList(QueryTestCaseRequest request, int goPage, int pageSize) {
setDefaultOrder(request);
request.getOrders().forEach(order -> {
order.setPrefix("test_case");
@ -498,7 +529,7 @@ public class TestCaseService {
return PageUtils.setPageInfo(page, getTestCaseByNotInPlan(request));
}
public List<TestCase> getTestCaseByNotInPlan(QueryTestCaseRequest request) {
public List<TestCaseDTO> getTestCaseByNotInPlan(QueryTestCaseRequest request) {
return extTestCaseMapper.getTestCaseByNotInPlan(request);
}
@ -523,7 +554,7 @@ public class TestCaseService {
});
}
public List<TestCase> getReviewCase(QueryTestCaseRequest request) {
public List<TestCaseDTO> getReviewCase(QueryTestCaseRequest request) {
setDefaultOrder(request);
request.getOrders().forEach(order -> {
order.setPrefix("test_case");
@ -732,15 +763,15 @@ public class TestCaseService {
try {
JSONArray newArr = new JSONArray();
JSONArray customArr = JSONArray.parseArray(customFields);
for(int i = 0; i < customArr.size();i++){
for (int i = 0; i < customArr.size(); i++) {
JSONObject obj = customArr.getJSONObject(i);
if(obj.containsKey("name") && StringUtils.equalsIgnoreCase(obj.getString("name"),"用例等级")){
obj.put("value",priority);
if (obj.containsKey("name") && StringUtils.equalsIgnoreCase(obj.getString("name"), "用例等级")) {
obj.put("value", priority);
}
newArr.add(obj);
}
customFields = newArr.toJSONString();
}catch (Exception e){
} catch (Exception e) {
}
return customFields;
@ -755,6 +786,8 @@ public class TestCaseService {
*/
public void updateImportDataCarryId(List<TestCaseWithBLOBs> testCases, String projectId) {
Map<String, String> nodePathMap = testCaseNodeService.createNodeByTestCases(testCases, projectId);
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
/*
获取用例的网页上所显示id数据库ID映射
@ -769,21 +802,19 @@ public class TestCaseService {
Map<Integer, String> numIdMap = testCasesList.stream()
.collect(Collectors.toMap(TestCase::getNum, TestCase::getId));
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
try {
if (!testCases.isEmpty()) {
AtomicInteger sort = new AtomicInteger();
testCases.forEach(testcase -> {
testcase.setUpdateTime(System.currentTimeMillis());
testcase.setNodeId(nodePathMap.get(testcase.getNodePath()));
testcase.setSort(sort.getAndIncrement());
testcase.setId(numIdMap.get(testcase.getNum()));
mapper.updateByPrimaryKeySelective(testcase);
});
}
sqlSession.flushStatements();
} finally {
if (!testCases.isEmpty()) {
AtomicInteger sort = new AtomicInteger();
testCases.forEach(testcase -> {
testcase.setUpdateTime(System.currentTimeMillis());
testcase.setNodeId(nodePathMap.get(testcase.getNodePath()));
testcase.setSort(sort.getAndIncrement());
testcase.setId(numIdMap.get(testcase.getNum()));
mapper.updateByPrimaryKeySelective(testcase);
});
}
sqlSession.flushStatements();
if (sqlSession != null && sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
}
@ -853,9 +884,9 @@ public class TestCaseService {
List<List<String>> headList = testCaseExcelData.getHead(importFileNeedNum, customFields);
EasyExcelExporter easyExcelExporter = new EasyExcelExporter(testCaseExcelData.getClass());
Map<String,List<String>> caseLevelAndStatusValueMap = testCaseTemplateService.getCaseLevelAndStatusMapByProjectId(projectId);
FunctionCaseTemplateWriteHandler handler = new FunctionCaseTemplateWriteHandler(importFileNeedNum,headList,caseLevelAndStatusValueMap);
easyExcelExporter.exportByCustomWriteHandler(response,headList, generateExportDatas(importFileNeedNum),
Map<String, List<String>> caseLevelAndStatusValueMap = testCaseTemplateService.getCaseLevelAndStatusMapByProjectId(projectId);
FunctionCaseTemplateWriteHandler handler = new FunctionCaseTemplateWriteHandler(importFileNeedNum, headList, caseLevelAndStatusValueMap);
easyExcelExporter.exportByCustomWriteHandler(response, headList, generateExportDatas(importFileNeedNum),
Translator.get("test_case_import_template_name"), Translator.get("test_case_import_template_sheet"), handler);
} catch (Exception e) {
@ -975,9 +1006,9 @@ public class TestCaseService {
}
List<List<String>> headList = testCaseExcelData.getHead(importFileNeedNum, customFields);
List<List<Object>> testCaseDataByExcelList = this.generateTestCaseExcel(headList,datas);
List<List<Object>> testCaseDataByExcelList = this.generateTestCaseExcel(headList, datas);
EasyExcelExporter easyExcelExporter = new EasyExcelExporter(testCaseExcelData.getClass());
easyExcelExporter.exportByCustomWriteHandler(response,headList, testCaseDataByExcelList,
easyExcelExporter.exportByCustomWriteHandler(response, headList, testCaseDataByExcelList,
Translator.get("test_case_import_template_name"), Translator.get("test_case_import_template_sheet"));
@ -991,12 +1022,12 @@ public class TestCaseService {
public void testCaseXmindExport(HttpServletResponse response, TestCaseBatchRequest request) {
try {
request.getCondition().setStatusIsNot("Trash");
List<TestCaseDTO> testCaseDTOList= this.findByBatchRequest(request);
List<TestCaseDTO> testCaseDTOList = this.findByBatchRequest(request);
TestCaseXmindData rootXmindData = this.generateTestCaseXmind(testCaseDTOList);
boolean isUseCustomId = projectService.useCustomNum(request.getProjectId());
XmindExportUtil xmindExportUtil = new XmindExportUtil(isUseCustomId);
xmindExportUtil.exportXmind(response,rootXmindData);
xmindExportUtil.exportXmind(response, rootXmindData);
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);
MSException.throwException(e);
@ -1004,83 +1035,84 @@ public class TestCaseService {
}
private TestCaseXmindData generateTestCaseXmind(List<TestCaseDTO> testCaseDTOList) {
Map<String,List<TestCaseDTO>> moduleTestCaseMap = new HashMap<>();
Map<String, List<TestCaseDTO>> moduleTestCaseMap = new HashMap<>();
for (TestCaseDTO dto : testCaseDTOList) {
String moduleId = dto.getNodeId();
if(StringUtils.isEmpty(moduleId)){
if (StringUtils.isEmpty(moduleId)) {
moduleId = "default";
}
if(moduleTestCaseMap.containsKey(moduleId)){
moduleTestCaseMap.get(moduleId).add(dto);
}else {
List<TestCaseDTO> list = new ArrayList<>();
list.add(dto);
moduleTestCaseMap.put(moduleId,list);
}
if (moduleTestCaseMap.containsKey(moduleId)) {
moduleTestCaseMap.get(moduleId).add(dto);
} else {
List<TestCaseDTO> list = new ArrayList<>();
list.add(dto);
moduleTestCaseMap.put(moduleId, list);
}
}
TestCaseXmindData rootMind = new TestCaseXmindData("ROOT","ROOT");
TestCaseXmindData rootMind = new TestCaseXmindData("ROOT", "ROOT");
for (Map.Entry<String,List<TestCaseDTO>> entry:moduleTestCaseMap.entrySet()) {
for (Map.Entry<String, List<TestCaseDTO>> entry : moduleTestCaseMap.entrySet()) {
String moduleId = entry.getKey();
List<TestCaseDTO> dataList = entry.getValue();
if(StringUtils.equals(moduleId,"ROOT")){
if (StringUtils.equals(moduleId, "ROOT")) {
rootMind.setTestCaseList(dataList);
}else {
} else {
LinkedList<TestCaseNode> modulePathDataList = testCaseNodeService.getPathNodeById(moduleId);
rootMind.setItem(modulePathDataList,dataList);
rootMind.setItem(modulePathDataList, dataList);
}
}
return rootMind;
}
private List<List<Object>> generateTestCaseExcel(List<List<String>> headListParams,List<TestCaseExcelData> datas) {
private List<List<Object>> generateTestCaseExcel(List<List<String>> headListParams, List<TestCaseExcelData> datas) {
List<List<Object>> returnDatas = new ArrayList<>();
//转化excel头
List<String> headList = new ArrayList<>();
for (List<String> list:headListParams){
for (String head : list){
for (List<String> list : headListParams) {
for (String head : list) {
headList.add(head);
}
}
for(TestCaseExcelData model : datas){
for (TestCaseExcelData model : datas) {
List<Object> list = new ArrayList<>();
Map<String,String> customDataMaps = model.getCustomDatas();
if(customDataMaps == null){
Map<String, String> customDataMaps = model.getCustomDatas();
if (customDataMaps == null) {
customDataMaps = new HashMap<>();
}
for(String head : headList){
if(StringUtils.equalsAnyIgnoreCase(head,"ID")){
for (String head : headList) {
if (StringUtils.equalsAnyIgnoreCase(head, "ID")) {
list.add(model.getCustomNum());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Name","用例名稱","用例名称")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Name", "用例名稱", "用例名称")) {
list.add(model.getName());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Module","所屬模塊","所属模块")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Module", "所屬模塊", "所属模块")) {
list.add(model.getNodePath());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Tag","標簽","标签")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Tag", "標簽", "标签")) {
String tags = "";
try {
if(model.getTags()!=null){
if (model.getTags() != null) {
JSONArray arr = JSONArray.parseArray(model.getTags());
for(int i = 0; i < arr.size(); i ++){
for (int i = 0; i < arr.size(); i++) {
tags += arr.getString(i) + ",";
}
}
}catch (Exception e){}
} catch (Exception e) {
}
list.add(tags);
}else if(StringUtils.equalsAnyIgnoreCase(head,"Prerequisite","前置條件","前置条件")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Prerequisite", "前置條件", "前置条件")) {
list.add(model.getPrerequisite());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Remark","備註","备注")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Remark", "備註", "备注")) {
list.add(model.getRemark());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Step description","步驟描述","步骤描述")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Step description", "步驟描述", "步骤描述")) {
list.add(model.getStepDesc());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Step result","預期結果","预期结果")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Step result", "預期結果", "预期结果")) {
list.add(model.getStepResult());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Edit Model","編輯模式","编辑模式")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Edit Model", "編輯模式", "编辑模式")) {
list.add(model.getStepModel());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Priority","用例等級","用例等级")){
} else if (StringUtils.equalsAnyIgnoreCase(head, "Priority", "用例等級", "用例等级")) {
list.add(model.getPriority());
// }else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){
// list.add(model.getStatus());
@ -1102,7 +1134,7 @@ public class TestCaseService {
return returnDatas;
}
public List<TestCaseDTO> findByBatchRequest(TestCaseBatchRequest request){
public List<TestCaseDTO> findByBatchRequest(TestCaseBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extTestCaseMapper.selectIds(query));
QueryTestCaseRequest condition = request.getCondition();
@ -1127,7 +1159,7 @@ public class TestCaseService {
StringBuilder step = new StringBuilder("");
StringBuilder result = new StringBuilder("");
Map<String,Map<String,String>> customSelectValueMap = new HashMap<>();
Map<String, Map<String, String>> customSelectValueMap = new HashMap<>();
TestCaseTemplateService testCaseTemplateService = CommonBeanFactory.getBean(TestCaseTemplateService.class);
TestCaseTemplateDao testCaseTemplate = testCaseTemplateService.getTemplate(request.getProjectId());
@ -1137,31 +1169,32 @@ public class TestCaseService {
} else {
customFieldList = testCaseTemplate.getCustomFields();
}
for (CustomFieldDao dto :customFieldList) {
Map<String,String> map = new HashMap<>();
if(StringUtils.equals("select",dto.getType())){
for (CustomFieldDao dto : customFieldList) {
Map<String, String> map = new HashMap<>();
if (StringUtils.equals("select", dto.getType())) {
try {
JSONArray optionsArr = JSONArray.parseArray(dto.getOptions());
for (int i = 0; i < optionsArr.size();i++) {
for (int i = 0; i < optionsArr.size(); i++) {
JSONObject obj = optionsArr.getJSONObject(i);
if(obj.containsKey("text") && obj.containsKey("value")){
if (obj.containsKey("text") && obj.containsKey("value")) {
String value = obj.getString("value");
String text = obj.getString("text");
if(StringUtils.equals(text,"test_track.case.status_finished")){
if (StringUtils.equals(text, "test_track.case.status_finished")) {
text = Translator.get("test_case_status_finished");
}else if(StringUtils.equals(text,"test_track.case.status_prepare")){
} else if (StringUtils.equals(text, "test_track.case.status_prepare")) {
text = Translator.get("test_case_status_prepare");
}else if(StringUtils.equals(text,"test_track.case.status_running")){
} else if (StringUtils.equals(text, "test_track.case.status_running")) {
text = Translator.get("test_case_status_running");
}
if(StringUtils.isNotEmpty(value)){
map.put(value,text);
if (StringUtils.isNotEmpty(value)) {
map.put(value, text);
}
}
}
}catch (Exception e){}
} catch (Exception e) {
}
}
customSelectValueMap.put(dto.getName(),map);
customSelectValueMap.put(dto.getName(), map);
}
@ -1241,25 +1274,26 @@ public class TestCaseService {
data.setMaintainer(t.getMaintainer());
data.setStatus(t.getStatus());
String customFields = t.getCustomFields();
try{
try {
JSONArray customFieldsArr = JSONArray.parseArray(customFields);
Map<String,String> map = new HashMap<>();
for(int index = 0; index < customFieldsArr.size(); index ++){
Map<String, String> map = new HashMap<>();
for (int index = 0; index < customFieldsArr.size(); index++) {
JSONObject obj = customFieldsArr.getJSONObject(index);
if(obj.containsKey("name") && obj.containsKey("value")){
if (obj.containsKey("name") && obj.containsKey("value")) {
//进行key value对换
String name = obj.getString("name");
String value = obj.getString("value");
if(customSelectValueMap.containsKey(name)){
if(customSelectValueMap.get(name).containsKey(value)){
if (customSelectValueMap.containsKey(name)) {
if (customSelectValueMap.get(name).containsKey(value)) {
value = customSelectValueMap.get(name).get(value);
}
}
map.put(name,value);
map.put(name, value);
}
}
data.setCustomDatas(map);
}catch (Exception e){}
} catch (Exception e) {
}
list.add(data);
});
return list;
@ -1267,6 +1301,7 @@ public class TestCaseService {
/**
* 更新自定义字段
*
* @param request
*/
public void editTestCaseBath(TestCaseBatchRequest request) {
@ -1580,7 +1615,7 @@ public class TestCaseService {
testCaseMap = testCaseWithBLOBs.stream().collect(Collectors.toMap(TestCaseWithBLOBs::getId, t -> t));
}
for (TestCaseMinderEditRequest.TestCaseMinderEditItem item: data) {
for (TestCaseMinderEditRequest.TestCaseMinderEditItem item : data) {
if (StringUtils.isBlank(item.getNodeId()) || item.getNodeId().equals("root")) {
item.setNodeId("");
}
@ -2094,6 +2129,7 @@ public class TestCaseService {
/**
* 用例自定义排序
*
* @param request
*/
public void updateOrder(ResetOrderRequest request) {
@ -2114,7 +2150,7 @@ public class TestCaseService {
public List<RelationshipEdgeDTO> getRelationshipCase(String id, String relationshipType) {
List<RelationshipEdge> relationshipEdges= relationshipEdgeService.getRelationshipEdgeByType(id, relationshipType);
List<RelationshipEdge> relationshipEdges = relationshipEdgeService.getRelationshipEdgeByType(id, relationshipType);
List<String> ids = relationshipEdgeService.getRelationIdsByType(relationshipType, relationshipEdges);
if (CollectionUtils.isNotEmpty(ids)) {
@ -2215,4 +2251,40 @@ public class TestCaseService {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
}
public List<TestCaseDTO> getTestCaseVersions(String caseId) {
TestCaseWithBLOBs testCase = testCaseMapper.selectByPrimaryKey(caseId);
if (testCase == null) {
return new ArrayList<>();
}
QueryTestCaseRequest request = new QueryTestCaseRequest();
request.setRefId(testCase.getRefId());
return this.listTestCase(request);
}
public TestCaseDTO getTestCaseByVersion(String refId, String version) {
QueryTestCaseRequest request = new QueryTestCaseRequest();
request.setRefId(refId);
request.setVersionId(version);
List<TestCaseDTO> testCaseList = this.listTestCase(request);
if (CollectionUtils.isEmpty(testCaseList)) {
return null;
}
return testCaseList.get(0);
}
public void deleteTestCaseByVersion(String refId, String version) {
TestCaseExample e = new TestCaseExample();
e.createCriteria().andRefIdEqualTo(refId).andVersionIdEqualTo(version);
List<TestCaseWithBLOBs> testCaseList = testCaseMapper.selectByExampleWithBLOBs(e);
if (CollectionUtils.isNotEmpty(testCaseList)) {
testCaseMapper.deleteByExample(e);
}
}
public int deleteTestCasePublic(String testCaseId) {
TestCase testCase = new TestCase();
testCase.setId(testCaseId);
return extTestCaseMapper.deletePublic(testCase);
}
}

View File

@ -172,3 +172,21 @@ alter table project
alter table project
add clean_load_report_expr varchar(50) null;
-- test_case
ALTER TABLE test_case
ADD version_id VARCHAR(50) NULL COMMENT '版本ID';
ALTER TABLE test_case
ADD ref_id VARCHAR(50) NULL COMMENT '指向初始版本ID';
CREATE INDEX test_case_version_id_index ON test_case (version_id);
CREATE INDEX test_case_ref_id_index ON test_case (ref_id);
UPDATE test_case
SET ref_id = id;
UPDATE test_case
INNER JOIN project_version ON project_version.project_id = test_case.project_id
SET version_id = project_version.id;

View File

@ -296,3 +296,5 @@ environment_group_exist = already exists
error_report_library=Error report
issue_jira_info_error=Check the service integration information or Jira project ID
error_code_is_unique=Error code is not unique
no_version_exists=version not exists

View File

@ -295,3 +295,4 @@ environment_group_exist = 已存在
error_report_library=误报库
issue_jira_info_error=请检查服务集成信息或Jira项目ID
error_code_is_unique=错误代码不可重复
no_version_exists=不存在版本!请先创建项目的版本

View File

@ -295,3 +295,5 @@ environment_group_exist = 已存在
error_report_library=誤報庫
issue_jira_info_error=請檢查服務集成信息或Jira項目ID
error_code_is_unique=錯誤代碼不可重複
no_version_exists=不存在版本!請先創建項目的版本

View File

@ -70,6 +70,9 @@
:right-tip="$t('test_track.case.minder')"
:right-content="$t('test_track.case.minder')"
:middle-button-enable="false">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
<test-case-list
v-if="activeDom === 'left'"
:checkRedirectID="checkRedirectID"
@ -77,6 +80,7 @@
:tree-nodes="treeNodes"
:trash-enable="false"
:public-enable="false"
:current-version="currentVersion"
@refreshTable="refresh"
@testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase"
@ -110,6 +114,7 @@
@refresh="refreshTable"
@caseEdit="handleCaseCreateOrEdit($event,'edit')"
@caseCreate="handleCaseCreateOrEdit($event,'add')"
@checkout="checkout($event, item)"
:read-only="testCaseReadOnly"
:tree-nodes="treeNodes"
:select-node="selectNode"
@ -136,6 +141,9 @@
ref="testCaseEditShow">
</test-case-edit-show>
</div>
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
</el-tab-pane>
<el-tab-pane name="add" v-if="hasPermission('PROJECT_TRACK_CASE:READ+CREATE')">
<template v-slot:label>
@ -184,6 +192,9 @@ import IsChangeConfirm from "@/business/components/common/components/IsChangeCon
import {openMinderConfirm, saveMinderConfirm} from "@/business/components/track/common/minder/minderUtils";
import TestCaseEditShow from "@/business/components/track/case/components/TestCaseEditShow";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "TestCase",
components: {
@ -192,7 +203,8 @@ export default {
MsTabButton,
TestCaseNodeTree,
MsMainContainer,
MsAsideContainer, MsContainer, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, TestCaseEditShow
MsAsideContainer, MsContainer, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, TestCaseEditShow,
'VersionSelect': VersionSelect.default,
},
comments: {},
data() {
@ -215,7 +227,8 @@ export default {
tmpActiveDom: null,
total: 0,
publicTotal: 0,
tmpPath: null
tmpPath: null,
currentVersion: null,
};
},
mounted() {
@ -617,6 +630,22 @@ export default {
this.activeName = "trash"
}
},
changeVersion(currentVersion) {
this.currentVersion = currentVersion || null;
},
checkout(testCase, item) {
Object.assign(item.testCaseInfo, testCase)
// copy
this.$refs.testCaseEdit[0].changeType("copy");
this.$refs.testCaseEdit[0].initEdit(item.testCaseInfo, () => {
this.$nextTick(() => {
let vh = this.$refs.testCaseEdit[0].$refs.versionHistory;
vh.getVersionOptionList(vh.handleVersionOptions);
vh.show = false;
vh.loading = false;
});
});
}
}
};
@ -640,4 +669,8 @@ export default {
padding-right: 100%;
}
.version-select {
padding-left: 10px;
}
</style>

View File

@ -18,6 +18,12 @@
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="form.id">
{{ $t('operating_log.change_history') }}
</el-link>
<!-- 版本历史 -->
<ms-version-history v-xpack
ref="versionHistory"
:version-data="versionData"
:current-id="currentTestCaseInfo.id"
@compare="compare" @checkout="checkout" @create="create" @del="del"/>
<el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{ $t('commons.save') }}
@ -179,6 +185,9 @@ import MsChangeHistory from "../../../history/ChangeHistory";
import {getTestTemplate} from "@/network/custom-field-template";
import CustomFiledFormItem from "@/business/components/common/components/form/CustomFiledFormItem";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const versionHistory = requireComponent.keys().length > 0 ? requireComponent("./version/VersionHistory.vue") : {};
export default {
name: "TestCaseEdit",
components: {
@ -194,7 +203,8 @@ export default {
ReviewCommentItem,
TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment,
MsTestCaseStepRichText,
MsChangeHistory
MsChangeHistory,
'MsVersionHistory': versionHistory.default,
},
data() {
return {
@ -282,7 +292,8 @@ export default {
id: 'id',
label: 'name',
},
tabId: getUUID()
tabId: getUUID(),
versionData: [],
};
},
props: {
@ -422,6 +433,9 @@ export default {
} else {
this.isXpack = false;
}
if (hasLicense()) {
this.getVersionHistory();
}
},
methods: {
alert:alert,
@ -545,7 +559,7 @@ export default {
initFuc(testCase);
});
},
initEdit(testCase) {
initEdit(testCase, callback) {
if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.close);
@ -586,6 +600,9 @@ export default {
this.customFieldForm = parseCustomField(this.form, this.testCaseTemplate, this.customFieldRules);
this.reload();
}
if (callback) {
callback();
}
},
handlePre() {
this.index--;
@ -726,10 +743,14 @@ export default {
this.close();
}
this.form.id = response.data.id;
this.currentTestCaseInfo.id = response.data.id;
if (callback) {
callback(this);
}
if (hasLicense()) {
this.getVersionHistory();
}
//
});
}
@ -907,6 +928,51 @@ export default {
});
}
}
},
getVersionHistory() {
this.$get('/test/case/versions/' + this.currentTestCaseInfo.id, response => {
this.versionData = response.data;
this.$refs.versionHistory.loading = false;
});
},
compare(row) {
// console.log(row);
},
checkout(row) {
this.$refs.versionHistory.loading = true;
let testCase = this.versionData.filter(v => v.versionId === row.id)[0];
if (testCase) {
this.$get('test/case/get/' + testCase.id, response => {
let testCase = response.data;
this.$emit("checkout", testCase);
this.$refs.versionHistory.loading = false;
});
}
},
create(row) {
//
this.form.versionId = row.id;
this.saveCase();
},
del(row) {
let that = this;
this.$alert(this.$t('api_test.definition.request.delete_confirm') + ' ' + row.name + " ", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.$get('/test/case/delete/' + row.id + '/' + this.form.refId, () => {
this.$success(this.$t('commons.delete_success'));
this.getVersionHistory();
});
} else {
that.$refs.versionHistory.loading = false;
}
}
});
},
changeType(type) {
this.type = type;
}
}
}

View File

@ -140,6 +140,18 @@
min-width="150px">
</ms-table-column>
<ms-table-column
:label="$t('project.version.name')"
:field="item"
:fields-width="fieldsWidth"
:filters="versionFilters"
min-width="100px"
prop="versionId">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column
prop="nodePath"
:field="item"
@ -149,8 +161,6 @@
min-width="150px">
</ms-table-column>
<ms-table-column
prop="updateTime"
sortable
@ -248,7 +258,7 @@ import {
} from "@/common/js/tableUtils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import PlanStatusTableItem from "@/business/components/track/common/tableItems/plan/PlanStatusTableItem";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils";
import {getTestTemplate} from "@/network/custom-field-template";
import {getProjectMember} from "@/network/user";
import MsTable from "@/business/components/common/components/table/MsTable";
@ -305,6 +315,7 @@ export default {
components: TEST_CASE_CONFIGS,
filters: {}
},
versionFilters: [],
graphData: {},
priorityFilters: [
{text: 'P0', value: 'P0'},
@ -468,6 +479,7 @@ export default {
type: Boolean,
default: false,
},
currentVersion: String,
},
computed: {
projectId() {
@ -495,6 +507,8 @@ export default {
this.initTableData();
let redirectParam = this.$route.query.dataSelectRange;
this.checkRedirectEditPage(redirectParam);
// tab
this.condition.versionId = this.currentVersion;
if (this.trashEnable) {
this.operators = this.trashOperators;
this.batchButtons = this.trashButtons;
@ -526,6 +540,7 @@ export default {
}
this.initTableData();
this.condition.ids = null;
this.getVersionOptions();
},
watch: {
selectNodeIds() {
@ -570,7 +585,11 @@ export default {
this.batchButtons = this.simpleButtons;
this.condition.filters.status = [];
}
}
},
currentVersion() {
this.condition.versionId = this.currentVersion;
this.initTableData();
},
},
methods: {
getTemplateField() {
@ -1093,7 +1112,16 @@ export default {
this.$refs.testBatchMove.close();
this.refresh();
});
}
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
}
};
</script>

View File

@ -19,6 +19,7 @@
</el-menu>
</template>
</ms-test-plan-header-bar>
<test-plan-functional v-if="activeIndex === 'functional'" :redirectCharType="redirectCharType"
:clickType="clickType" :plan-id="planId" ref="testPlanFunctional"/>
<test-plan-api v-if="activeIndex === 'api'" :redirectCharType="redirectCharType" :clickType="clickType"

View File

@ -45,6 +45,17 @@
<ms-table-column prop="name" :label="$t('commons.name')"/>
<ms-table-column
prop="versionId"
:field="item"
:filters="versionFilters"
:label="$t('commons.version')"
min-width="120px">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column
prop="priority"
:filters="priorityFilters"
@ -101,6 +112,7 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
import MsTable from "@/business/components/common/components/table/MsTable";
import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTag from "@/business/components/common/components/MsTag";
import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
export default {
name: "FunctionalRelevance",
@ -117,6 +129,9 @@ export default {
MsTableAdvSearchBar,
MsTableHeader,
},
mounted(){
this.getVersionOptions();
},
data() {
return {
openType: 'relevance',
@ -134,7 +149,8 @@ export default {
{text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'}
]
],
versionFilters: []
};
},
props: {
@ -229,7 +245,17 @@ export default {
this.projectId = projectId;
}
this.getNodeTree(this);
}
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionOptions= response.data;
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
}
}
</script>

View File

@ -57,6 +57,18 @@
:label="$t('commons.name')"
min-width="120px"/>
<ms-table-column
prop="versionId"
:field="item"
:filters="versionFilters"
:fields-width="fieldsWidth"
:label="$t('commons.version')"
min-width="120px">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column
prop="priority"
:field="item"
@ -258,7 +270,7 @@ import {
TEST_PLAN_FUNCTION_TEST_CASE,
TokenKey,
} from "@/common/js/constants";
import {getCurrentProjectID, hasPermission} from "@/common/js/utils";
import {getCurrentProjectID, hasPermission, hasLicense} from "@/common/js/utils";
import PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import StatusTableItem from "../../../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../../../common/tableItems/planview/TypeTableItem";
@ -385,7 +397,7 @@ export default {
},
selectDataRange: "all",
testCaseTemplate: {},
versionFilters: []
};
},
props: {
@ -396,6 +408,7 @@ export default {
selectNodeIds: {
type: Array
},
currentVersion: null
},
computed: {
editTestPlanTestCaseOrder() {
@ -422,6 +435,10 @@ export default {
condition() {
this.$emit('setCondition', this.condition);
},
currentVersion(){
this.condition.versionId = this.currentVersion;
this.initTableData();
}
},
created() {
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
@ -437,6 +454,7 @@ export default {
this.hasEditPermission = hasPermission('PROJECT_TRACK_PLAN:READ+EDIT');
this.getMaintainerOptions();
this.getTemplateField();
this.getVersionOptions();
},
beforeDestroy() {
hub.$off("openFailureTestCase");
@ -631,6 +649,16 @@ export default {
});
});
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionOptions= response.data;
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
}
};
</script>

View File

@ -17,12 +17,16 @@
:right-tip="$t('test_track.case.minder')"
:right-content="$t('test_track.case.minder')"
:middle-button-enable="false">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
<functional-test-case-list
class="table-list"
v-if="activeDom === 'left'"
@openTestCaseRelevanceDialog="openTestCaseRelevanceDialog"
@refresh="refresh"
@setCondition="setCondition"
:current-version="currentVersion"
:plan-id="planId"
:clickType="clickType"
:select-node-ids="selectNodeIds"
@ -63,6 +67,8 @@ import TestPlanFunctionalRelevance
from "@/business/components/track/plan/view/comonents/functional/TestPlanFunctionalRelevance";
import IsChangeConfirm from "@/business/components/common/components/IsChangeConfirm";
import {openMinderConfirm, saveMinderConfirm} from "@/business/components/track/common/minder/minderUtils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "TestPlanFunctional",
@ -74,6 +80,7 @@ export default {
FunctionalTestCaseList,
MsTestPlanCommonComponent,
NodeTree,
'VersionSelect': VersionSelect.default,
},
data() {
return {
@ -84,7 +91,8 @@ export default {
selectNode: {},
condition: {},
tmpActiveDom: null,
tmpPath: null
tmpPath: null,
currentVersion: null,
};
},
props: [
@ -175,6 +183,9 @@ export default {
return true;
}
},
changeVersion(currentVersion) {
this.currentVersion = currentVersion || null;
}
}
};
@ -184,4 +195,7 @@ export default {
/deep/ .el-button-group > .el-button:first-child {
padding: 4px 1px !important;
}
.version-select {
padding-left: 10px;
}
</style>

View File

@ -18,6 +18,9 @@
:right-tip="$t('test_track.case.minder')"
:right-content="$t('test_track.case.minder')"
:middle-button-enable="false">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
<test-review-test-case-list
class="table-list"
v-if="activeDom === 'left'"
@ -26,6 +29,7 @@
@setCondition="setCondition"
:review-id="reviewId"
:clickType="clickType"
:current-version="currentVersion"
ref="testPlanTestCaseList"/>
<test-review-minder
:tree-nodes="treeNodes"
@ -61,6 +65,8 @@ import TestReviewMinder from "@/business/components/track/common/minder/TestRevi
import {getCurrentProjectID} from "@/common/js/utils";
import IsChangeConfirm from "@/business/components/common/components/IsChangeConfirm";
import {openMinderConfirm, saveMinderConfirm} from "@/business/components/track/common/minder/minderUtils";
const requireComponent = require.context('@/business/components/xpack/', true, /\.vue$/);
const VersionSelect = requireComponent.keys().length > 0 ? requireComponent("./version/VersionSelect.vue") : {};
export default {
name: "TestReviewFunction",
@ -69,7 +75,8 @@ export default {
TestReviewMinder,
MsTabButton,
TestReviewTestCaseList,
TestReviewRelevance, MsNodeTree, MsTestPlanCommonComponent
TestReviewRelevance, MsNodeTree, MsTestPlanCommonComponent,
'VersionSelect': VersionSelect.default,
},
data() {
return {
@ -83,7 +90,8 @@ export default {
activeDom: 'left',
condition: {},
tmpActiveDom: null,
tmpPath: null
tmpPath: null,
currentVersion : null
}
},
props: [
@ -141,6 +149,9 @@ export default {
return true;
}
},
changeVersion(currentVersion) {
this.currentVersion = currentVersion || null;
}
}
}
</script>
@ -149,4 +160,8 @@ export default {
/deep/ .el-button-group>.el-button:first-child {
padding: 4px 1px !important;
}
.version-select {
padding-left: 10px;
}
</style>

View File

@ -34,12 +34,25 @@
ref="table">
<el-table-column type="selection"/>
<el-table-column
prop="name"
:label="$t('test_track.case.name')"
style="width: 100%">
<template v-slot:default="scope">
{{scope.row.name}}
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column
v-if="hasLicense()"
prop="versionName"
:label="$t('test_track.case.version')"
column-key="versionId"
:filters="versionFilters"
style="width: 100%">
<template v-slot:default="scope">
{{ scope.row.versionName }}
</template>
</el-table-column>
@ -108,7 +121,7 @@ import ReviewStatus from "@/business/components/track/case/components/ReviewStat
import elTableInfiniteScroll from 'el-table-infinite-scroll';
import SelectMenu from "../../../common/SelectMenu";
import {_filter} from "@/common/js/tableUtils";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId} from "@/common/js/utils";
import {getCurrentProjectID, getCurrentUserId, getCurrentWorkspaceId, hasLicense} from "@/common/js/utils";
export default {
@ -138,6 +151,7 @@ export default {
dialogFormVisible: false,
isCheckAll: false,
testReviews: [],
versionFilters: [],
selectIds: new Set(),
treeNodes: [],
selectNodeIds: [],
@ -189,10 +203,18 @@ export default {
this.getProjectNode();
}
},
mounted() {
if (hasLicense()) {
this.getVersionOptions();
}
},
updated() {
this.toggleSelection(this.testReviews);
},
methods: {
hasLicense(){
return hasLicense();
},
openTestReviewRelevanceDialog() {
this.getProject();
this.dialogFormVisible = true;
@ -364,7 +386,16 @@ export default {
});
this.selectNodeIds = [];
}
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
}
}
</script>

View File

@ -8,6 +8,7 @@
<ms-table-button v-permission="['PROJECT_TRACK_REVIEW:READ+RELEVANCE_OR_CANCEL']" icon="el-icon-connection"
:content="$t('test_track.review_view.relevance_case')"
@click="$emit('openTestReviewRelevanceDialog')"/>
</template>
</ms-table-header>
@ -53,6 +54,18 @@
:label="$t('commons.name')"
min-width="120px"/>
<ms-table-column
prop="versionId"
:field="item"
:filters="versionFilters"
:fields-width="fieldsWidth"
:label="$t('commons.version')"
min-width="120px">
<template v-slot:default="scope">
<span>{{ scope.row.versionName }}</span>
</template>
</ms-table-column>
<ms-table-column
prop="priority"
:field="item"
@ -185,6 +198,7 @@ import MsTableHeaderSelectPopover from "@/business/components/common/components/
import MsTableColumn from "@/business/components/common/components/table/MsTableColumn";
import MsTable from "@/business/components/common/components/table/MsTable";
import {editTestReviewTestCaseOrder} from "@/network/testCase";
import {getCurrentProjectID, hasLicense} from "@/common/js/utils";
export default {
name: "TestReviewTestCaseList",
@ -270,12 +284,16 @@ export default {
{name: this.$t('test_track.review.un_pass'), id: 'UnPass'},
]
},
versionFilters: []
};
},
props: {
reviewId: {
type: String
},
currentVersion: {
type: String
}
},
watch: {
reviewId() {
@ -287,6 +305,10 @@ export default {
condition() {
this.$emit('setCondition', this.condition);
},
currentVersion() {
this.condition.versionId = this.currentVersion;
this.initTableData();
}
},
computed: {
selectNodeIds() {
@ -304,6 +326,7 @@ export default {
this.refreshTableAndReview();
this.isTestManagerOrTestUser = true;
this.initTableHeader();
this.getVersionOptions();
},
methods: {
initTableHeader() {
@ -456,7 +479,16 @@ export default {
if (this.$refs.table) {
this.$refs.table.clear();
}
}
},
getVersionOptions() {
if (hasLicense()) {
this.$get('/project/version/get-project-versions/' + getCurrentProjectID(), response => {
this.versionFilters = response.data.map(u => {
return {text: u.name, value: u.id};
});
});
}
},
}
};
</script>

View File

@ -98,6 +98,7 @@ export let CUSTOM_TABLE_HEADER = {
TEST_CASE_REVIEW_FUNCTION_TEST_CASE: [
{id: 'num', key: '1', label: 'commons.id'},
{id: 'name', key: '2', label: 'commons.name'},
{id: 'versionId', key: 'b', label: 'commons.version'},
{id: 'priority', key: '3', label: 'test_track.case.priority'},
{id: 'type', key: '4', label: 'test_track.case.type'},
{id: 'nodePath', key: '5', label: 'test_track.case.module'},
@ -132,6 +133,7 @@ export let CUSTOM_TABLE_HEADER = {
TEST_PLAN_FUNCTION_TEST_CASE: [
{id: 'num', key: '1', label: 'commons.id'},
{id: 'name', key: '2', label: 'commons.name'},
{id: 'versionId', key: 'b', label: 'project.version.name', xpack: true},
{id: 'tags', key: '3', label: 'commons.tag'},
{id: 'nodePath', key: '4', label: 'test_track.case.module'},
{id: 'projectName', key: '5', label: 'test_track.review.review_project'},
@ -187,6 +189,7 @@ export let CUSTOM_TABLE_HEADER = {
{id: 'name', key: '2', label: 'commons.name'},
{id: 'reviewStatus', key: '3', label: 'test_track.case.status'},
{id: 'tags', key: '4', label: 'commons.tag'},
{id: 'versionId', key: 'a', label: 'project.version.name', xpack: true},
{id: 'nodePath', key: '5', label: 'test_track.case.module'},
{id: 'projectName', key: 'a', label: 'test_track.review.review_project'},
{id: 'updateTime', key: '6', label: 'commons.update_time'},

View File

@ -2018,8 +2018,8 @@ export default {
export_tip: "请切换成接口列表勾选用例导出!"
},
case_desc: "用例描述",
passing_rate: '用例通过率'
passing_rate:'用例通过率',
version: "版本"
},
plan: {
test_plan: "测试计划",