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

View File

@ -244,6 +244,76 @@ public class TestCaseExample {
return (Criteria) this; 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() { public Criteria andNodePathIsNull() {
addCriterion("node_path is null"); addCriterion("node_path is null");
return (Criteria) this; return (Criteria) this;
@ -854,76 +924,6 @@ public class TestCaseExample {
return (Criteria) this; 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() { public Criteria andSortIsNull() {
addCriterion("sort is null"); addCriterion("sort is null");
return (Criteria) this; return (Criteria) this;
@ -1464,76 +1464,6 @@ public class TestCaseExample {
return (Criteria) this; 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() { public Criteria andStepModelIsNull() {
addCriterion("step_model is null"); addCriterion("step_model is null");
return (Criteria) this; return (Criteria) this;
@ -1604,6 +1534,76 @@ public class TestCaseExample {
return (Criteria) this; 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() { public Criteria andCreateUserIsNull() {
addCriterion("create_user is null"); addCriterion("create_user is null");
return (Criteria) this; return (Criteria) this;
@ -1993,6 +1993,146 @@ public class TestCaseExample {
addCriterion("case_public not between", value1, value2, "casePublic"); addCriterion("case_public not between", value1, value2, "casePublic");
return (Criteria) this; 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 { public static class Criteria extends GeneratedCriteria {

View File

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCase"> <resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCase">
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="node_id" jdbcType="VARCHAR" property="nodeId" /> <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="node_path" jdbcType="VARCHAR" property="nodePath" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" /> <result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
@ -13,7 +14,6 @@
<result column="method" jdbcType="VARCHAR" property="method" /> <result column="method" jdbcType="VARCHAR" property="method" />
<result column="create_time" jdbcType="BIGINT" property="createTime" /> <result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" /> <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="sort" jdbcType="INTEGER" property="sort" />
<result column="num" jdbcType="INTEGER" property="num" /> <result column="num" jdbcType="INTEGER" property="num" />
<result column="other_test_name" jdbcType="VARCHAR" property="otherTestName" /> <result column="other_test_name" jdbcType="VARCHAR" property="otherTestName" />
@ -22,14 +22,16 @@
<result column="demand_id" jdbcType="VARCHAR" property="demandId" /> <result column="demand_id" jdbcType="VARCHAR" property="demandId" />
<result column="demand_name" jdbcType="VARCHAR" property="demandName" /> <result column="demand_name" jdbcType="VARCHAR" property="demandName" />
<result column="status" jdbcType="VARCHAR" property="status" /> <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="step_model" jdbcType="VARCHAR" property="stepModel" />
<result column="custom_num" jdbcType="VARCHAR" property="customNum" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="original_status" jdbcType="VARCHAR" property="originalStatus" /> <result column="original_status" jdbcType="VARCHAR" property="originalStatus" />
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" /> <result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" /> <result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
<result column="order" jdbcType="BIGINT" property="order" /> <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>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
<result column="prerequisite" jdbcType="LONGVARCHAR" property="prerequisite" /> <result column="prerequisite" jdbcType="LONGVARCHAR" property="prerequisite" />
@ -98,11 +100,10 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id id, node_id, test_id, node_path, project_id, `name`, `type`, maintainer, priority,
, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`, `method`, create_time, update_time, sort, num, other_test_name, review_status, tags,
create_time, update_time, test_id, sort, num, other_test_name, review_status, tags, demand_id, demand_name, `status`, step_model, custom_num, create_user, original_status,
demand_id, demand_name, `status`, custom_num, step_model, create_user, original_status, delete_time, delete_user_id, `order`, case_public, version_id, ref_id
delete_time, delete_user_id, `order`, case_public
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
prerequisite, remark, steps, step_description, expected_result, custom_fields prerequisite, remark, steps, step_description, expected_result, custom_fields
@ -156,30 +157,31 @@
</if> </if>
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs"> <insert id="insert" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
insert into test_case (id, node_id, node_path, insert into test_case (id, node_id, test_id,
project_id, `name`, `type`, node_path, project_id, `name`,
maintainer, priority, `method`, `type`, maintainer, priority,
create_time, update_time, test_id, `method`, create_time, update_time,
sort, num, other_test_name, sort, num, other_test_name,
review_status, tags, demand_id, review_status, tags, demand_id,
demand_name, `status`, custom_num, demand_name, `status`, step_model,
step_model, create_user, original_status, custom_num, create_user, original_status,
delete_time, delete_user_id, `order`, delete_time, delete_user_id, `order`,
case_public, prerequisite, remark, case_public, version_id, ref_id,
steps, step_description, expected_result, prerequisite, remark, steps,
step_description, expected_result,
custom_fields) custom_fields)
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{testId,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{otherTestName,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{otherTestName,jdbcType=VARCHAR},
#{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR}, #{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR},
#{demandName,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR}, #{demandName,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR},
#{stepModel,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{originalStatus,jdbcType=VARCHAR},
#{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT}, #{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
#{casePublic,jdbcType=BIT}, #{prerequisite,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{casePublic,jdbcType=BIT}, #{versionId,jdbcType=VARCHAR}, #{refId,jdbcType=VARCHAR},
#{steps,jdbcType=LONGVARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR}, #{prerequisite,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR},
#{expectedResult,jdbcType=LONGVARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR},
#{customFields,jdbcType=LONGVARCHAR}) #{customFields,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
@ -191,6 +193,9 @@
<if test="nodeId != null"> <if test="nodeId != null">
node_id, node_id,
</if> </if>
<if test="testId != null">
test_id,
</if>
<if test="nodePath != null"> <if test="nodePath != null">
node_path, node_path,
</if> </if>
@ -218,9 +223,6 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
<if test="testId != null">
test_id,
</if>
<if test="sort != null"> <if test="sort != null">
sort, sort,
</if> </if>
@ -244,13 +246,13 @@
</if> </if>
<if test="status != null"> <if test="status != null">
`status`, `status`,
</if>
<if test="customNum != null">
custom_num,
</if> </if>
<if test="stepModel != null"> <if test="stepModel != null">
step_model, step_model,
</if> </if>
<if test="customNum != null">
custom_num,
</if>
<if test="createUser != null"> <if test="createUser != null">
create_user, create_user,
</if> </if>
@ -269,6 +271,12 @@
<if test="casePublic != null"> <if test="casePublic != null">
case_public, case_public,
</if> </if>
<if test="versionId != null">
version_id,
</if>
<if test="refId != null">
ref_id,
</if>
<if test="prerequisite != null"> <if test="prerequisite != null">
prerequisite, prerequisite,
</if> </if>
@ -295,6 +303,9 @@
<if test="nodeId != null"> <if test="nodeId != null">
#{nodeId,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR},
</if> </if>
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="nodePath != null"> <if test="nodePath != null">
#{nodePath,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
</if> </if>
@ -322,9 +333,6 @@
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="sort != null"> <if test="sort != null">
#{sort,jdbcType=INTEGER}, #{sort,jdbcType=INTEGER},
</if> </if>
@ -348,13 +356,13 @@
</if> </if>
<if test="status != null"> <if test="status != null">
#{status,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
#{customNum,jdbcType=VARCHAR},
</if> </if>
<if test="stepModel != null"> <if test="stepModel != null">
#{stepModel,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR},
</if> </if>
<if test="customNum != null">
#{customNum,jdbcType=VARCHAR},
</if>
<if test="createUser != null"> <if test="createUser != null">
#{createUser,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
</if> </if>
@ -373,6 +381,12 @@
<if test="casePublic != null"> <if test="casePublic != null">
#{casePublic,jdbcType=BIT}, #{casePublic,jdbcType=BIT},
</if> </if>
<if test="versionId != null">
#{versionId,jdbcType=VARCHAR},
</if>
<if test="refId != null">
#{refId,jdbcType=VARCHAR},
</if>
<if test="prerequisite != null"> <if test="prerequisite != null">
#{prerequisite,jdbcType=LONGVARCHAR}, #{prerequisite,jdbcType=LONGVARCHAR},
</if> </if>
@ -408,6 +422,9 @@
<if test="record.nodeId != null"> <if test="record.nodeId != null">
node_id = #{record.nodeId,jdbcType=VARCHAR}, node_id = #{record.nodeId,jdbcType=VARCHAR},
</if> </if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.nodePath != null"> <if test="record.nodePath != null">
node_path = #{record.nodePath,jdbcType=VARCHAR}, node_path = #{record.nodePath,jdbcType=VARCHAR},
</if> </if>
@ -435,9 +452,6 @@
<if test="record.updateTime != null"> <if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
</if> </if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.sort != null"> <if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER}, sort = #{record.sort,jdbcType=INTEGER},
</if> </if>
@ -461,13 +475,13 @@
</if> </if>
<if test="record.status != null"> <if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.customNum != null">
custom_num = #{record.customNum,jdbcType=VARCHAR},
</if> </if>
<if test="record.stepModel != null"> <if test="record.stepModel != null">
step_model = #{record.stepModel,jdbcType=VARCHAR}, step_model = #{record.stepModel,jdbcType=VARCHAR},
</if> </if>
<if test="record.customNum != null">
custom_num = #{record.customNum,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null"> <if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR},
</if> </if>
@ -486,6 +500,12 @@
<if test="record.casePublic != null"> <if test="record.casePublic != null">
case_public = #{record.casePublic,jdbcType=BIT}, case_public = #{record.casePublic,jdbcType=BIT},
</if> </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"> <if test="record.prerequisite != null">
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR}, prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
</if> </if>
@ -513,6 +533,7 @@
update test_case update test_case
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
node_id = #{record.nodeId,jdbcType=VARCHAR}, node_id = #{record.nodeId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
node_path = #{record.nodePath,jdbcType=VARCHAR}, node_path = #{record.nodePath,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
@ -522,7 +543,6 @@
`method` = #{record.method,jdbcType=VARCHAR}, `method` = #{record.method,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER}, sort = #{record.sort,jdbcType=INTEGER},
num = #{record.num,jdbcType=INTEGER}, num = #{record.num,jdbcType=INTEGER},
other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
@ -531,14 +551,16 @@
demand_id = #{record.demandId,jdbcType=VARCHAR}, demand_id = #{record.demandId,jdbcType=VARCHAR},
demand_name = #{record.demandName,jdbcType=VARCHAR}, demand_name = #{record.demandName,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
step_model = #{record.stepModel,jdbcType=VARCHAR}, step_model = #{record.stepModel,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR},
original_status = #{record.originalStatus,jdbcType=VARCHAR}, original_status = #{record.originalStatus,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT}, delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT}, `order` = #{record.order,jdbcType=BIGINT},
case_public = #{record.casePublic,jdbcType=BIT}, case_public = #{record.casePublic,jdbcType=BIT},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR},
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR}, prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
remark = #{record.remark,jdbcType=LONGVARCHAR}, remark = #{record.remark,jdbcType=LONGVARCHAR},
steps = #{record.steps,jdbcType=LONGVARCHAR}, steps = #{record.steps,jdbcType=LONGVARCHAR},
@ -546,13 +568,14 @@
expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR}, expected_result = #{record.expectedResult,jdbcType=LONGVARCHAR},
custom_fields = #{record.customFields,jdbcType=LONGVARCHAR} custom_fields = #{record.customFields,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByExample" parameterType="map"> <update id="updateByExample" parameterType="map">
update test_case update test_case
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
node_id = #{record.nodeId,jdbcType=VARCHAR}, node_id = #{record.nodeId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
node_path = #{record.nodePath,jdbcType=VARCHAR}, node_path = #{record.nodePath,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
@ -562,7 +585,6 @@
`method` = #{record.method,jdbcType=VARCHAR}, `method` = #{record.method,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT}, create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT}, update_time = #{record.updateTime,jdbcType=BIGINT},
test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER}, sort = #{record.sort,jdbcType=INTEGER},
num = #{record.num,jdbcType=INTEGER}, num = #{record.num,jdbcType=INTEGER},
other_test_name = #{record.otherTestName,jdbcType=VARCHAR}, other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
@ -571,16 +593,18 @@
demand_id = #{record.demandId,jdbcType=VARCHAR}, demand_id = #{record.demandId,jdbcType=VARCHAR},
demand_name = #{record.demandName,jdbcType=VARCHAR}, demand_name = #{record.demandName,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR}, `status` = #{record.status,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
step_model = #{record.stepModel,jdbcType=VARCHAR}, step_model = #{record.stepModel,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR},
original_status = #{record.originalStatus,jdbcType=VARCHAR}, original_status = #{record.originalStatus,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT}, delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT}, `order` = #{record.order,jdbcType=BIGINT},
case_public = #{record.casePublic,jdbcType=BIT} case_public = #{record.casePublic,jdbcType=BIT},
version_id = #{record.versionId,jdbcType=VARCHAR},
ref_id = #{record.refId,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause"/> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
</update> </update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs"> <update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
@ -589,6 +613,9 @@
<if test="nodeId != null"> <if test="nodeId != null">
node_id = #{nodeId,jdbcType=VARCHAR}, node_id = #{nodeId,jdbcType=VARCHAR},
</if> </if>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
</if>
<if test="nodePath != null"> <if test="nodePath != null">
node_path = #{nodePath,jdbcType=VARCHAR}, node_path = #{nodePath,jdbcType=VARCHAR},
</if> </if>
@ -616,9 +643,6 @@
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
</if> </if>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
</if>
<if test="sort != null"> <if test="sort != null">
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
</if> </if>
@ -642,13 +666,13 @@
</if> </if>
<if test="status != null"> <if test="status != null">
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
custom_num = #{customNum,jdbcType=VARCHAR},
</if> </if>
<if test="stepModel != null"> <if test="stepModel != null">
step_model = #{stepModel,jdbcType=VARCHAR}, step_model = #{stepModel,jdbcType=VARCHAR},
</if> </if>
<if test="customNum != null">
custom_num = #{customNum,jdbcType=VARCHAR},
</if>
<if test="createUser != null"> <if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR},
</if> </if>
@ -667,6 +691,12 @@
<if test="casePublic != null"> <if test="casePublic != null">
case_public = #{casePublic,jdbcType=BIT}, case_public = #{casePublic,jdbcType=BIT},
</if> </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"> <if test="prerequisite != null">
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR}, prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
</if> </if>
@ -691,6 +721,7 @@
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
update test_case update test_case
set node_id = #{nodeId,jdbcType=VARCHAR}, set node_id = #{nodeId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
node_path = #{nodePath,jdbcType=VARCHAR}, node_path = #{nodePath,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
@ -700,7 +731,6 @@
`method` = #{method,jdbcType=VARCHAR}, `method` = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER}, num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR}, other_test_name = #{otherTestName,jdbcType=VARCHAR},
@ -709,14 +739,16 @@
demand_id = #{demandId,jdbcType=VARCHAR}, demand_id = #{demandId,jdbcType=VARCHAR},
demand_name = #{demandName,jdbcType=VARCHAR}, demand_name = #{demandName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR}, step_model = #{stepModel,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR},
original_status = #{originalStatus,jdbcType=VARCHAR}, original_status = #{originalStatus,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT}, delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT}, `order` = #{order,jdbcType=BIGINT},
case_public = #{casePublic,jdbcType=BIT}, case_public = #{casePublic,jdbcType=BIT},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR},
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR}, prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
remark = #{remark,jdbcType=LONGVARCHAR}, remark = #{remark,jdbcType=LONGVARCHAR},
steps = #{steps,jdbcType=LONGVARCHAR}, steps = #{steps,jdbcType=LONGVARCHAR},
@ -728,6 +760,7 @@
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCase"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCase">
update test_case update test_case
set node_id = #{nodeId,jdbcType=VARCHAR}, set node_id = #{nodeId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
node_path = #{nodePath,jdbcType=VARCHAR}, node_path = #{nodePath,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
@ -737,7 +770,6 @@
`method` = #{method,jdbcType=VARCHAR}, `method` = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}, sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER}, num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR}, other_test_name = #{otherTestName,jdbcType=VARCHAR},
@ -746,14 +778,16 @@
demand_id = #{demandId,jdbcType=VARCHAR}, demand_id = #{demandId,jdbcType=VARCHAR},
demand_name = #{demandName,jdbcType=VARCHAR}, demand_name = #{demandName,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR}, `status` = #{status,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR}, step_model = #{stepModel,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR},
original_status = #{originalStatus,jdbcType=VARCHAR}, original_status = #{originalStatus,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT}, delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}, delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT}, `order` = #{order,jdbcType=BIGINT},
case_public = #{casePublic,jdbcType=BIT} case_public = #{casePublic,jdbcType=BIT},
version_id = #{versionId,jdbcType=VARCHAR},
ref_id = #{refId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

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

View File

@ -38,7 +38,7 @@ public interface ExtTestCaseMapper {
* @param request * @param request
* @return * @return
*/ */
List<TestCase> getTestCaseByNotInPlan(@Param("request") QueryTestCaseRequest request); List<TestCaseDTO> getTestCaseByNotInPlan(@Param("request") QueryTestCaseRequest request);
/** /**
* 获取不在测试缺陷中的用例 * 获取不在测试缺陷中的用例
@ -54,7 +54,7 @@ public interface ExtTestCaseMapper {
* @param request * @param request
* @return * @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 test_case set custom_num = num where (custom_num is null or custom_num = '') and project_id = #{projectId}
</update> </update>
<select id="getTestCaseByNotInReview" resultType="io.metersphere.base.domain.TestCase"> <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 from test_case select
as test_case 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 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"/> <include refid="notInQueryWhereCondition"/>
and T2.case_id is null and T2.case_id is null
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/> <include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
@ -119,14 +127,44 @@
#{nodeId} #{nodeId}
</foreach> </foreach>
</if> </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"/> <include refid="filters"/>
</where> </where>
</sql> </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, 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 test_case.num, test_case.custom_num, test_case.priority, test_case.tags, test_case.create_time,
from test_case as test_case 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"> <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} left join test_plan_test_case as T2 on test_case.id=T2.case_id and T2.plan_id =#{request.planId}
</if> </if>
@ -168,6 +206,8 @@
<select id="list" resultType="io.metersphere.track.dto.TestCaseDTO"> <select id="list" resultType="io.metersphere.track.dto.TestCaseDTO">
select select
deleteUser.name AS delete_user_id,test_case.delete_time, 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"> <if test="request.selectFields != null and request.selectFields.size() > 0">
<foreach collection="request.selectFields" item="field" separator=","> <foreach collection="request.selectFields" item="field" separator=",">
${field} ${field}
@ -185,6 +225,8 @@
from test_case left join user u on test_case.create_user=u.id 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 user deleteUser on test_case.delete_user_id=deleteUser.id
left join project on test_case.project_id = project.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="queryWhereCondition"/>
<include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/> <include refid="io.metersphere.base.mapper.ext.ExtBaseMapper.orders"/>
</select> </select>
@ -407,6 +449,12 @@
#{value} #{value}
</foreach> </foreach>
</when> </when>
<when test="key=='version_id'">
and test_case.version_id in
<foreach collection="values" open="(" close=")" separator="," item="value">
#{value}
</foreach>
</when>
</choose> </choose>
</if> </if>
<if test="key=='status' and (values == null || values.size() == 0)"> <if test="key=='status' and (values == null || values.size() == 0)">
@ -474,6 +522,32 @@
<if test="request.caseCoverage == 'coverage' "> <if test="request.caseCoverage == 'coverage' ">
and test_case.id in (select distinct test_case_test.test_case_id from test_case_test) and test_case.id in (select distinct test_case_test.test_case_id from test_case_test)
</if> </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> </where>
</sql> </sql>

View File

@ -171,6 +171,32 @@
<if test="request.method != null"> <if test="request.method != null">
and test_case.method = #{request.method} and test_case.method = #{request.method}
</if> </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' and test_case.status != 'Trash'
<include refid="filter"/> <include refid="filter"/>
</where> </where>
@ -211,6 +237,12 @@
#{value} #{value}
</foreach> </foreach>
</when> </when>
<when test="key=='version_id'">
and test_case.version_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
<otherwise> <otherwise>
and test_plan_test_case.status in and test_plan_test_case.status in
<foreach collection="values" item="value" separator="," open="(" close=")"> <foreach collection="values" item="value" separator="," open="(" close=")">
@ -232,11 +264,13 @@
test_plan_test_case.actual_result, 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 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, 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 from test_plan_test_case
inner join test_case on test_plan_test_case.case_id = test_case.id 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 left join test_case_node on test_case_node.id = test_case.node_id
inner join project on project.id = test_case.project_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"/> <include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0"> <if test="request.orders != null and request.orders.size() > 0">
order by order by

View File

@ -104,11 +104,13 @@
test_case.custom_num) as customNum, test_case.review_status, 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.remark as remark, test_case.maintainer, test_case.steps as steps, test_case.node_id as nodeId,
test_case_node.name as model, 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 from test_case_review_test_case
inner join test_case on test_case_review_test_case.case_id = test_case.id 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 left join test_case_node on test_case_node.id=test_case.node_id
inner join project on project.id = test_case.project_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"/> <include refid="queryWhereCondition"/>
<if test="request.orders != null and request.orders.size() > 0"> <if test="request.orders != null and request.orders.size() > 0">
order by order by
@ -165,6 +167,32 @@
<if test="request.method != null"> <if test="request.method != null">
and test_case.method = #{request.method} and test_case.method = #{request.method}
</if> </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"/> <include refid="filter"/>
</where> </where>
</sql> </sql>
@ -203,6 +231,12 @@
#{value} #{value}
</foreach> </foreach>
</when> </when>
<when test="key=='version_id'">
and test_case.version_id in
<foreach collection="values" item="value" separator="," open="(" close=")">
#{value}
</foreach>
</when>
</choose> </choose>
</if> </if>
</foreach> </foreach>

View File

@ -71,4 +71,14 @@ public class BaseQueryRequest {
* 要查询的字段 * 要查询的字段
*/ */
private List<String> selectFields; 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 name;
private String projectId; private String projectId;
private String createUser; private String createUser;
private Boolean latest;
private List<OrderRequest> orders; private List<OrderRequest> orders;
private Map<String, List<String>> filters; private Map<String, List<String>> filters;
private Map<String, Object> combine; private Map<String, Object> combine;

View File

@ -133,7 +133,7 @@ public class TestCaseController {
} }
@PostMapping("/relate/{goPage}/{pageSize}") @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); // Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return testCaseService.getTestCaseRelateList(request, goPage, pageSize); return testCaseService.getTestCaseRelateList(request, goPage, pageSize);
} }
@ -183,7 +183,7 @@ public class TestCaseController {
} }
@PostMapping("/reviews/case/{goPage}/{pageSize}") @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); Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, testCaseService.getReviewCase(request)); return PageUtils.setPageInfo(page, testCaseService.getReviewCase(request));
} }
@ -400,4 +400,19 @@ public class TestCaseController {
public void editTestFollows(@PathVariable String caseId,@RequestBody List<String> follows) { public void editTestFollows(@PathVariable String caseId,@RequestBody List<String> follows) {
testCaseService.saveFollows(caseId,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 projectName;
private String createName; private String createName;
private String lastExecuteResult; private String lastExecuteResult;
private String versionName;
private List<String> caseTags = new ArrayList<>(); private List<String> caseTags = new ArrayList<>();
private List<IssuesDao> issueList = new ArrayList<>(); private List<IssuesDao> issueList = new ArrayList<>();

View File

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

View File

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

View File

@ -42,4 +42,8 @@ public class QueryCaseReviewRequest extends TestCaseReviewTestCase {
private String projectName; private String projectName;
private String reviewerId; 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.notice.service.NoticeSendService;
import io.metersphere.service.SystemParameterService; import io.metersphere.service.SystemParameterService;
import io.metersphere.service.UserService; import io.metersphere.service.UserService;
import io.metersphere.track.dto.TestCaseDTO;
import io.metersphere.track.dto.TestCaseReviewDTO; import io.metersphere.track.dto.TestCaseReviewDTO;
import io.metersphere.track.dto.TestReviewCaseDTO; import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.dto.TestReviewDTOWithMetric; import io.metersphere.track.dto.TestReviewDTOWithMetric;
@ -360,7 +361,7 @@ public class TestCaseReviewService {
// 如果是关联全部指令则根据条件查询未关联的案例 // 如果是关联全部指令则根据条件查询未关联的案例
if (testCaseIds.get(0).equals("all")) { if (testCaseIds.get(0).equals("all")) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest()); List<TestCaseDTO> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
if (!testCases.isEmpty()) { if (!testCases.isEmpty()) {
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList()); testCaseIds = testCases.stream().map(testCase -> testCase.getId()).collect(Collectors.toList());
} }
@ -634,7 +635,7 @@ public class TestCaseReviewService {
List<String> testCaseIds = request.getTestCaseIds(); List<String> testCaseIds = request.getTestCaseIds();
List<String> names = new ArrayList<>(); List<String> names = new ArrayList<>();
if (testCaseIds.get(0).equals("all")) { if (testCaseIds.get(0).equals("all")) {
List<TestCase> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest()); List<TestCaseDTO> testCases = extTestCaseMapper.getTestCaseByNotInReview(request.getRequest());
if (!testCases.isEmpty()) { if (!testCases.isEmpty()) {
names = testCases.stream().map(TestCase::getName).collect(Collectors.toList()); names = testCases.stream().map(TestCase::getName).collect(Collectors.toList());
testCaseIds = testCases.stream().map(testCase -> testCase.getId()).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.user.SessionUser;
import io.metersphere.commons.utils.*; import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest; import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.ProjectVersionRequest;
import io.metersphere.controller.request.ResetOrderRequest; import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest; import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.dto.*; import io.metersphere.dto.*;
@ -152,6 +153,8 @@ public class TestCaseService {
private TestPlanService testPlanService; private TestPlanService testPlanService;
@Resource @Resource
private MinderExtraNodeService minderExtraNodeService; private MinderExtraNodeService minderExtraNodeService;
@Resource
private ProjectVersionService projectVersionService;
private void setNode(TestCaseWithBLOBs testCase) { private void setNode(TestCaseWithBLOBs testCase) {
if (StringUtils.isEmpty(testCase.getNodeId()) || "default-module".equals(testCase.getNodeId())) { if (StringUtils.isEmpty(testCase.getNodeId()) || "default-module".equals(testCase.getNodeId())) {
@ -183,6 +186,23 @@ public class TestCaseService {
request.setCreateUser(SessionUtils.getUserId()); request.setCreateUser(SessionUtils.getUserId());
this.setNode(request); this.setNode(request);
request.setOrder(ServiceUtils.getNextOrder(request.getProjectId(), extTestCaseMapper::getLastOrder)); 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); testCaseMapper.insert(request);
saveFollows(request.getId(), request.getFollows()); saveFollows(request.getId(), request.getFollows());
return request; return request;
@ -245,6 +265,22 @@ public class TestCaseService {
public int editTestCase(TestCaseWithBLOBs testCase) { public int editTestCase(TestCaseWithBLOBs testCase) {
checkTestCustomNum(testCase); checkTestCustomNum(testCase);
testCase.setUpdateTime(System.currentTimeMillis()); 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); return testCaseMapper.updateByPrimaryKeySelective(testCase);
} }
@ -375,12 +411,6 @@ public class TestCaseService {
return extTestCaseMapper.deleteToGc(testCase); 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) { public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) {
this.initRequest(request, true); this.initRequest(request, true);
setDefaultOrder(request); setDefaultOrder(request);
@ -403,6 +433,7 @@ public class TestCaseService {
return returnList; return returnList;
} }
public void setDefaultOrder(QueryTestCaseRequest request) { public void setDefaultOrder(QueryTestCaseRequest request) {
List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders()); List<OrderRequest> orders = ServiceUtils.getDefaultSortOrder(request.getOrders());
OrderRequest order = new OrderRequest(); OrderRequest order = new OrderRequest();
@ -417,9 +448,9 @@ public class TestCaseService {
TestCaseExcelData excelData = new TestCaseExcelDataFactory().getTestCaseExcelDataLocal(); TestCaseExcelData excelData = new TestCaseExcelDataFactory().getTestCaseExcelDataLocal();
for (TestCaseDTO data : returnList) { for (TestCaseDTO data : returnList) {
String lastStatus = extTestCaseMapper.getLastExecStatusById(data.getId()); String lastStatus = extTestCaseMapper.getLastExecStatusById(data.getId());
if(StringUtils.isNotEmpty(lastStatus)){ if (StringUtils.isNotEmpty(lastStatus)) {
data.setLastExecuteResult(lastStatus); data.setLastExecuteResult(lastStatus);
}else { } else {
data.setLastExecuteResult(null); data.setLastExecuteResult(null);
} }
String dataStatus = excelData.parseStatus(data.getStatus()); String dataStatus = excelData.parseStatus(data.getStatus());
@ -486,7 +517,7 @@ public class TestCaseService {
* @param request * @param request
* @return * @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); setDefaultOrder(request);
request.getOrders().forEach(order -> { request.getOrders().forEach(order -> {
order.setPrefix("test_case"); order.setPrefix("test_case");
@ -498,7 +529,7 @@ public class TestCaseService {
return PageUtils.setPageInfo(page, getTestCaseByNotInPlan(request)); return PageUtils.setPageInfo(page, getTestCaseByNotInPlan(request));
} }
public List<TestCase> getTestCaseByNotInPlan(QueryTestCaseRequest request) { public List<TestCaseDTO> getTestCaseByNotInPlan(QueryTestCaseRequest request) {
return extTestCaseMapper.getTestCaseByNotInPlan(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); setDefaultOrder(request);
request.getOrders().forEach(order -> { request.getOrders().forEach(order -> {
order.setPrefix("test_case"); order.setPrefix("test_case");
@ -732,15 +763,15 @@ public class TestCaseService {
try { try {
JSONArray newArr = new JSONArray(); JSONArray newArr = new JSONArray();
JSONArray customArr = JSONArray.parseArray(customFields); 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); JSONObject obj = customArr.getJSONObject(i);
if(obj.containsKey("name") && StringUtils.equalsIgnoreCase(obj.getString("name"),"用例等级")){ if (obj.containsKey("name") && StringUtils.equalsIgnoreCase(obj.getString("name"), "用例等级")) {
obj.put("value",priority); obj.put("value", priority);
} }
newArr.add(obj); newArr.add(obj);
} }
customFields = newArr.toJSONString(); customFields = newArr.toJSONString();
}catch (Exception e){ } catch (Exception e) {
} }
return customFields; return customFields;
@ -755,6 +786,8 @@ public class TestCaseService {
*/ */
public void updateImportDataCarryId(List<TestCaseWithBLOBs> testCases, String projectId) { public void updateImportDataCarryId(List<TestCaseWithBLOBs> testCases, String projectId) {
Map<String, String> nodePathMap = testCaseNodeService.createNodeByTestCases(testCases, projectId); Map<String, String> nodePathMap = testCaseNodeService.createNodeByTestCases(testCases, projectId);
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
/* /*
获取用例的网页上所显示id数据库ID映射 获取用例的网页上所显示id数据库ID映射
@ -769,9 +802,7 @@ public class TestCaseService {
Map<Integer, String> numIdMap = testCasesList.stream() Map<Integer, String> numIdMap = testCasesList.stream()
.collect(Collectors.toMap(TestCase::getNum, TestCase::getId)); .collect(Collectors.toMap(TestCase::getNum, TestCase::getId));
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
try {
if (!testCases.isEmpty()) { if (!testCases.isEmpty()) {
AtomicInteger sort = new AtomicInteger(); AtomicInteger sort = new AtomicInteger();
testCases.forEach(testcase -> { testCases.forEach(testcase -> {
@ -783,7 +814,7 @@ public class TestCaseService {
}); });
} }
sqlSession.flushStatements(); sqlSession.flushStatements();
} finally { if (sqlSession != null && sqlSessionFactory != null) {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
} }
} }
@ -853,9 +884,9 @@ public class TestCaseService {
List<List<String>> headList = testCaseExcelData.getHead(importFileNeedNum, customFields); List<List<String>> headList = testCaseExcelData.getHead(importFileNeedNum, customFields);
EasyExcelExporter easyExcelExporter = new EasyExcelExporter(testCaseExcelData.getClass()); EasyExcelExporter easyExcelExporter = new EasyExcelExporter(testCaseExcelData.getClass());
Map<String,List<String>> caseLevelAndStatusValueMap = testCaseTemplateService.getCaseLevelAndStatusMapByProjectId(projectId); Map<String, List<String>> caseLevelAndStatusValueMap = testCaseTemplateService.getCaseLevelAndStatusMapByProjectId(projectId);
FunctionCaseTemplateWriteHandler handler = new FunctionCaseTemplateWriteHandler(importFileNeedNum,headList,caseLevelAndStatusValueMap); FunctionCaseTemplateWriteHandler handler = new FunctionCaseTemplateWriteHandler(importFileNeedNum, headList, caseLevelAndStatusValueMap);
easyExcelExporter.exportByCustomWriteHandler(response,headList, generateExportDatas(importFileNeedNum), easyExcelExporter.exportByCustomWriteHandler(response, headList, generateExportDatas(importFileNeedNum),
Translator.get("test_case_import_template_name"), Translator.get("test_case_import_template_sheet"), handler); Translator.get("test_case_import_template_name"), Translator.get("test_case_import_template_sheet"), handler);
} catch (Exception e) { } catch (Exception e) {
@ -975,9 +1006,9 @@ public class TestCaseService {
} }
List<List<String>> headList = testCaseExcelData.getHead(importFileNeedNum, customFields); 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 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")); 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) { public void testCaseXmindExport(HttpServletResponse response, TestCaseBatchRequest request) {
try { try {
request.getCondition().setStatusIsNot("Trash"); request.getCondition().setStatusIsNot("Trash");
List<TestCaseDTO> testCaseDTOList= this.findByBatchRequest(request); List<TestCaseDTO> testCaseDTOList = this.findByBatchRequest(request);
TestCaseXmindData rootXmindData = this.generateTestCaseXmind(testCaseDTOList); TestCaseXmindData rootXmindData = this.generateTestCaseXmind(testCaseDTOList);
boolean isUseCustomId = projectService.useCustomNum(request.getProjectId()); boolean isUseCustomId = projectService.useCustomNum(request.getProjectId());
XmindExportUtil xmindExportUtil = new XmindExportUtil(isUseCustomId); XmindExportUtil xmindExportUtil = new XmindExportUtil(isUseCustomId);
xmindExportUtil.exportXmind(response,rootXmindData); xmindExportUtil.exportXmind(response, rootXmindData);
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(e.getMessage(), e); LogUtil.error(e.getMessage(), e);
MSException.throwException(e); MSException.throwException(e);
@ -1004,83 +1035,84 @@ public class TestCaseService {
} }
private TestCaseXmindData generateTestCaseXmind(List<TestCaseDTO> testCaseDTOList) { private TestCaseXmindData generateTestCaseXmind(List<TestCaseDTO> testCaseDTOList) {
Map<String,List<TestCaseDTO>> moduleTestCaseMap = new HashMap<>(); Map<String, List<TestCaseDTO>> moduleTestCaseMap = new HashMap<>();
for (TestCaseDTO dto : testCaseDTOList) { for (TestCaseDTO dto : testCaseDTOList) {
String moduleId = dto.getNodeId(); String moduleId = dto.getNodeId();
if(StringUtils.isEmpty(moduleId)){ if (StringUtils.isEmpty(moduleId)) {
moduleId = "default"; moduleId = "default";
} }
if(moduleTestCaseMap.containsKey(moduleId)){ if (moduleTestCaseMap.containsKey(moduleId)) {
moduleTestCaseMap.get(moduleId).add(dto); moduleTestCaseMap.get(moduleId).add(dto);
}else { } else {
List<TestCaseDTO> list = new ArrayList<>(); List<TestCaseDTO> list = new ArrayList<>();
list.add(dto); list.add(dto);
moduleTestCaseMap.put(moduleId,list); 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(); String moduleId = entry.getKey();
List<TestCaseDTO> dataList = entry.getValue(); List<TestCaseDTO> dataList = entry.getValue();
if(StringUtils.equals(moduleId,"ROOT")){ if (StringUtils.equals(moduleId, "ROOT")) {
rootMind.setTestCaseList(dataList); rootMind.setTestCaseList(dataList);
}else { } else {
LinkedList<TestCaseNode> modulePathDataList = testCaseNodeService.getPathNodeById(moduleId); LinkedList<TestCaseNode> modulePathDataList = testCaseNodeService.getPathNodeById(moduleId);
rootMind.setItem(modulePathDataList,dataList); rootMind.setItem(modulePathDataList, dataList);
} }
} }
return rootMind; 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<>(); List<List<Object>> returnDatas = new ArrayList<>();
//转化excel头 //转化excel头
List<String> headList = new ArrayList<>(); List<String> headList = new ArrayList<>();
for (List<String> list:headListParams){ for (List<String> list : headListParams) {
for (String head : list){ for (String head : list) {
headList.add(head); headList.add(head);
} }
} }
for(TestCaseExcelData model : datas){ for (TestCaseExcelData model : datas) {
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
Map<String,String> customDataMaps = model.getCustomDatas(); Map<String, String> customDataMaps = model.getCustomDatas();
if(customDataMaps == null){ if (customDataMaps == null) {
customDataMaps = new HashMap<>(); customDataMaps = new HashMap<>();
} }
for(String head : headList){ for (String head : headList) {
if(StringUtils.equalsAnyIgnoreCase(head,"ID")){ if (StringUtils.equalsAnyIgnoreCase(head, "ID")) {
list.add(model.getCustomNum()); list.add(model.getCustomNum());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Name","用例名稱","用例名称")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Name", "用例名稱", "用例名称")) {
list.add(model.getName()); list.add(model.getName());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Module","所屬模塊","所属模块")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Module", "所屬模塊", "所属模块")) {
list.add(model.getNodePath()); list.add(model.getNodePath());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Tag","標簽","标签")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Tag", "標簽", "标签")) {
String tags = ""; String tags = "";
try { try {
if(model.getTags()!=null){ if (model.getTags() != null) {
JSONArray arr = JSONArray.parseArray(model.getTags()); 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) + ","; tags += arr.getString(i) + ",";
} }
} }
}catch (Exception e){} } catch (Exception e) {
}
list.add(tags); list.add(tags);
}else if(StringUtils.equalsAnyIgnoreCase(head,"Prerequisite","前置條件","前置条件")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Prerequisite", "前置條件", "前置条件")) {
list.add(model.getPrerequisite()); list.add(model.getPrerequisite());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Remark","備註","备注")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Remark", "備註", "备注")) {
list.add(model.getRemark()); list.add(model.getRemark());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Step description","步驟描述","步骤描述")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Step description", "步驟描述", "步骤描述")) {
list.add(model.getStepDesc()); list.add(model.getStepDesc());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Step result","預期結果","预期结果")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Step result", "預期結果", "预期结果")) {
list.add(model.getStepResult()); list.add(model.getStepResult());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Edit Model","編輯模式","编辑模式")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Edit Model", "編輯模式", "编辑模式")) {
list.add(model.getStepModel()); list.add(model.getStepModel());
}else if(StringUtils.equalsAnyIgnoreCase(head,"Priority","用例等級","用例等级")){ } else if (StringUtils.equalsAnyIgnoreCase(head, "Priority", "用例等級", "用例等级")) {
list.add(model.getPriority()); list.add(model.getPriority());
// }else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){ // }else if(StringUtils.equalsAnyIgnoreCase(head,"Case status","用例状态","用例狀態")){
// list.add(model.getStatus()); // list.add(model.getStatus());
@ -1102,7 +1134,7 @@ public class TestCaseService {
return returnDatas; return returnDatas;
} }
public List<TestCaseDTO> findByBatchRequest(TestCaseBatchRequest request){ public List<TestCaseDTO> findByBatchRequest(TestCaseBatchRequest request) {
ServiceUtils.getSelectAllIds(request, request.getCondition(), ServiceUtils.getSelectAllIds(request, request.getCondition(),
(query) -> extTestCaseMapper.selectIds(query)); (query) -> extTestCaseMapper.selectIds(query));
QueryTestCaseRequest condition = request.getCondition(); QueryTestCaseRequest condition = request.getCondition();
@ -1127,7 +1159,7 @@ public class TestCaseService {
StringBuilder step = new StringBuilder(""); StringBuilder step = new StringBuilder("");
StringBuilder result = 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); TestCaseTemplateService testCaseTemplateService = CommonBeanFactory.getBean(TestCaseTemplateService.class);
TestCaseTemplateDao testCaseTemplate = testCaseTemplateService.getTemplate(request.getProjectId()); TestCaseTemplateDao testCaseTemplate = testCaseTemplateService.getTemplate(request.getProjectId());
@ -1137,31 +1169,32 @@ public class TestCaseService {
} else { } else {
customFieldList = testCaseTemplate.getCustomFields(); customFieldList = testCaseTemplate.getCustomFields();
} }
for (CustomFieldDao dto :customFieldList) { for (CustomFieldDao dto : customFieldList) {
Map<String,String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
if(StringUtils.equals("select",dto.getType())){ if (StringUtils.equals("select", dto.getType())) {
try { try {
JSONArray optionsArr = JSONArray.parseArray(dto.getOptions()); 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); 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 value = obj.getString("value");
String text = obj.getString("text"); 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"); 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"); 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"); text = Translator.get("test_case_status_running");
} }
if(StringUtils.isNotEmpty(value)){ if (StringUtils.isNotEmpty(value)) {
map.put(value,text); 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.setMaintainer(t.getMaintainer());
data.setStatus(t.getStatus()); data.setStatus(t.getStatus());
String customFields = t.getCustomFields(); String customFields = t.getCustomFields();
try{ try {
JSONArray customFieldsArr = JSONArray.parseArray(customFields); JSONArray customFieldsArr = JSONArray.parseArray(customFields);
Map<String,String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
for(int index = 0; index < customFieldsArr.size(); index ++){ for (int index = 0; index < customFieldsArr.size(); index++) {
JSONObject obj = customFieldsArr.getJSONObject(index); JSONObject obj = customFieldsArr.getJSONObject(index);
if(obj.containsKey("name") && obj.containsKey("value")){ if (obj.containsKey("name") && obj.containsKey("value")) {
//进行key value对换 //进行key value对换
String name = obj.getString("name"); String name = obj.getString("name");
String value = obj.getString("value"); String value = obj.getString("value");
if(customSelectValueMap.containsKey(name)){ if (customSelectValueMap.containsKey(name)) {
if(customSelectValueMap.get(name).containsKey(value)){ if (customSelectValueMap.get(name).containsKey(value)) {
value = customSelectValueMap.get(name).get(value); value = customSelectValueMap.get(name).get(value);
} }
} }
map.put(name,value); map.put(name, value);
} }
} }
data.setCustomDatas(map); data.setCustomDatas(map);
}catch (Exception e){} } catch (Exception e) {
}
list.add(data); list.add(data);
}); });
return list; return list;
@ -1267,6 +1301,7 @@ public class TestCaseService {
/** /**
* 更新自定义字段 * 更新自定义字段
*
* @param request * @param request
*/ */
public void editTestCaseBath(TestCaseBatchRequest request) { public void editTestCaseBath(TestCaseBatchRequest request) {
@ -1580,7 +1615,7 @@ public class TestCaseService {
testCaseMap = testCaseWithBLOBs.stream().collect(Collectors.toMap(TestCaseWithBLOBs::getId, t -> t)); 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")) { if (StringUtils.isBlank(item.getNodeId()) || item.getNodeId().equals("root")) {
item.setNodeId(""); item.setNodeId("");
} }
@ -2094,6 +2129,7 @@ public class TestCaseService {
/** /**
* 用例自定义排序 * 用例自定义排序
*
* @param request * @param request
*/ */
public void updateOrder(ResetOrderRequest request) { public void updateOrder(ResetOrderRequest request) {
@ -2114,7 +2150,7 @@ public class TestCaseService {
public List<RelationshipEdgeDTO> getRelationshipCase(String id, String relationshipType) { 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); List<String> ids = relationshipEdgeService.getRelationIdsByType(relationshipType, relationshipEdges);
if (CollectionUtils.isNotEmpty(ids)) { if (CollectionUtils.isNotEmpty(ids)) {
@ -2215,4 +2251,40 @@ public class TestCaseService {
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory); 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 alter table project
add clean_load_report_expr varchar(50) null; 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 error_report_library=Error report
issue_jira_info_error=Check the service integration information or Jira project ID issue_jira_info_error=Check the service integration information or Jira project ID
error_code_is_unique=Error code is not unique 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=误报库 error_report_library=误报库
issue_jira_info_error=请检查服务集成信息或Jira项目ID issue_jira_info_error=请检查服务集成信息或Jira项目ID
error_code_is_unique=错误代码不可重复 error_code_is_unique=错误代码不可重复
no_version_exists=不存在版本!请先创建项目的版本

View File

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

View File

@ -70,6 +70,9 @@
:right-tip="$t('test_track.case.minder')" :right-tip="$t('test_track.case.minder')"
:right-content="$t('test_track.case.minder')" :right-content="$t('test_track.case.minder')"
:middle-button-enable="false"> :middle-button-enable="false">
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
<test-case-list <test-case-list
v-if="activeDom === 'left'" v-if="activeDom === 'left'"
:checkRedirectID="checkRedirectID" :checkRedirectID="checkRedirectID"
@ -77,6 +80,7 @@
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:trash-enable="false" :trash-enable="false"
:public-enable="false" :public-enable="false"
:current-version="currentVersion"
@refreshTable="refresh" @refreshTable="refresh"
@testCaseEdit="editTestCase" @testCaseEdit="editTestCase"
@testCaseCopy="copyTestCase" @testCaseCopy="copyTestCase"
@ -110,6 +114,7 @@
@refresh="refreshTable" @refresh="refreshTable"
@caseEdit="handleCaseCreateOrEdit($event,'edit')" @caseEdit="handleCaseCreateOrEdit($event,'edit')"
@caseCreate="handleCaseCreateOrEdit($event,'add')" @caseCreate="handleCaseCreateOrEdit($event,'add')"
@checkout="checkout($event, item)"
:read-only="testCaseReadOnly" :read-only="testCaseReadOnly"
:tree-nodes="treeNodes" :tree-nodes="treeNodes"
:select-node="selectNode" :select-node="selectNode"
@ -136,6 +141,9 @@
ref="testCaseEditShow"> ref="testCaseEditShow">
</test-case-edit-show> </test-case-edit-show>
</div> </div>
<template v-slot:version>
<version-select v-xpack :project-id="projectId" @changeVersion="changeVersion"/>
</template>
</el-tab-pane> </el-tab-pane>
<el-tab-pane name="add" v-if="hasPermission('PROJECT_TRACK_CASE:READ+CREATE')"> <el-tab-pane name="add" v-if="hasPermission('PROJECT_TRACK_CASE:READ+CREATE')">
<template v-slot:label> <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 {openMinderConfirm, saveMinderConfirm} from "@/business/components/track/common/minder/minderUtils";
import TestCaseEditShow from "@/business/components/track/case/components/TestCaseEditShow"; 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 { export default {
name: "TestCase", name: "TestCase",
components: { components: {
@ -192,7 +203,8 @@ export default {
MsTabButton, MsTabButton,
TestCaseNodeTree, TestCaseNodeTree,
MsMainContainer, MsMainContainer,
MsAsideContainer, MsContainer, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, TestCaseEditShow MsAsideContainer, MsContainer, TestCaseList, NodeTree, TestCaseEdit, SelectMenu, TestCaseEditShow,
'VersionSelect': VersionSelect.default,
}, },
comments: {}, comments: {},
data() { data() {
@ -215,7 +227,8 @@ export default {
tmpActiveDom: null, tmpActiveDom: null,
total: 0, total: 0,
publicTotal: 0, publicTotal: 0,
tmpPath: null tmpPath: null,
currentVersion: null,
}; };
}, },
mounted() { mounted() {
@ -617,6 +630,22 @@ export default {
this.activeName = "trash" 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%; padding-right: 100%;
} }
.version-select {
padding-left: 10px;
}
</style> </style>

View File

@ -18,6 +18,12 @@
<el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="form.id"> <el-link type="primary" style="margin-right: 20px" @click="openHis" v-if="form.id">
{{ $t('operating_log.change_history') }} {{ $t('operating_log.change_history') }}
</el-link> </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" <el-dropdown split-button type="primary" class="ms-api-buttion" @click="handleCommand"
@command="handleCommand" size="small" style="float: right;margin-right: 20px"> @command="handleCommand" size="small" style="float: right;margin-right: 20px">
{{ $t('commons.save') }} {{ $t('commons.save') }}
@ -179,6 +185,9 @@ import MsChangeHistory from "../../../history/ChangeHistory";
import {getTestTemplate} from "@/network/custom-field-template"; import {getTestTemplate} from "@/network/custom-field-template";
import CustomFiledFormItem from "@/business/components/common/components/form/CustomFiledFormItem"; 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 { export default {
name: "TestCaseEdit", name: "TestCaseEdit",
components: { components: {
@ -194,7 +203,8 @@ export default {
ReviewCommentItem, ReviewCommentItem,
TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment, TestCaseComment, MsPreviousNextButton, MsInputTag, CaseComment, MsDialogFooter, TestCaseAttachment,
MsTestCaseStepRichText, MsTestCaseStepRichText,
MsChangeHistory MsChangeHistory,
'MsVersionHistory': versionHistory.default,
}, },
data() { data() {
return { return {
@ -282,7 +292,8 @@ export default {
id: 'id', id: 'id',
label: 'name', label: 'name',
}, },
tabId: getUUID() tabId: getUUID(),
versionData: [],
}; };
}, },
props: { props: {
@ -422,6 +433,9 @@ export default {
} else { } else {
this.isXpack = false; this.isXpack = false;
} }
if (hasLicense()) {
this.getVersionHistory();
}
}, },
methods: { methods: {
alert:alert, alert:alert,
@ -545,7 +559,7 @@ export default {
initFuc(testCase); initFuc(testCase);
}); });
}, },
initEdit(testCase) { initEdit(testCase, callback) {
if (window.history && window.history.pushState) { if (window.history && window.history.pushState) {
history.pushState(null, null, document.URL); history.pushState(null, null, document.URL);
window.addEventListener('popstate', this.close); window.addEventListener('popstate', this.close);
@ -586,6 +600,9 @@ export default {
this.customFieldForm = parseCustomField(this.form, this.testCaseTemplate, this.customFieldRules); this.customFieldForm = parseCustomField(this.form, this.testCaseTemplate, this.customFieldRules);
this.reload(); this.reload();
} }
if (callback) {
callback();
}
}, },
handlePre() { handlePre() {
this.index--; this.index--;
@ -726,10 +743,14 @@ export default {
this.close(); this.close();
} }
this.form.id = response.data.id; this.form.id = response.data.id;
this.currentTestCaseInfo.id = response.data.id;
if (callback) { if (callback) {
callback(this); 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"> min-width="150px">
</ms-table-column> </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 <ms-table-column
prop="nodePath" prop="nodePath"
:field="item" :field="item"
@ -149,8 +161,6 @@
min-width="150px"> min-width="150px">
</ms-table-column> </ms-table-column>
<ms-table-column <ms-table-column
prop="updateTime" prop="updateTime"
sortable sortable
@ -248,7 +258,7 @@ import {
} from "@/common/js/tableUtils"; } from "@/common/js/tableUtils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate"; import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
import PlanStatusTableItem from "@/business/components/track/common/tableItems/plan/PlanStatusTableItem"; 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 {getTestTemplate} from "@/network/custom-field-template";
import {getProjectMember} from "@/network/user"; import {getProjectMember} from "@/network/user";
import MsTable from "@/business/components/common/components/table/MsTable"; import MsTable from "@/business/components/common/components/table/MsTable";
@ -305,6 +315,7 @@ export default {
components: TEST_CASE_CONFIGS, components: TEST_CASE_CONFIGS,
filters: {} filters: {}
}, },
versionFilters: [],
graphData: {}, graphData: {},
priorityFilters: [ priorityFilters: [
{text: 'P0', value: 'P0'}, {text: 'P0', value: 'P0'},
@ -468,6 +479,7 @@ export default {
type: Boolean, type: Boolean,
default: false, default: false,
}, },
currentVersion: String,
}, },
computed: { computed: {
projectId() { projectId() {
@ -495,6 +507,8 @@ export default {
this.initTableData(); this.initTableData();
let redirectParam = this.$route.query.dataSelectRange; let redirectParam = this.$route.query.dataSelectRange;
this.checkRedirectEditPage(redirectParam); this.checkRedirectEditPage(redirectParam);
// tab
this.condition.versionId = this.currentVersion;
if (this.trashEnable) { if (this.trashEnable) {
this.operators = this.trashOperators; this.operators = this.trashOperators;
this.batchButtons = this.trashButtons; this.batchButtons = this.trashButtons;
@ -526,6 +540,7 @@ export default {
} }
this.initTableData(); this.initTableData();
this.condition.ids = null; this.condition.ids = null;
this.getVersionOptions();
}, },
watch: { watch: {
selectNodeIds() { selectNodeIds() {
@ -570,7 +585,11 @@ export default {
this.batchButtons = this.simpleButtons; this.batchButtons = this.simpleButtons;
this.condition.filters.status = []; this.condition.filters.status = [];
} }
} },
currentVersion() {
this.condition.versionId = this.currentVersion;
this.initTableData();
},
}, },
methods: { methods: {
getTemplateField() { getTemplateField() {
@ -1093,7 +1112,16 @@ export default {
this.$refs.testBatchMove.close(); this.$refs.testBatchMove.close();
this.refresh(); 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> </script>

View File

@ -19,6 +19,7 @@
</el-menu> </el-menu>
</template> </template>
</ms-test-plan-header-bar> </ms-test-plan-header-bar>
<test-plan-functional v-if="activeIndex === 'functional'" :redirectCharType="redirectCharType" <test-plan-functional v-if="activeIndex === 'functional'" :redirectCharType="redirectCharType"
:clickType="clickType" :plan-id="planId" ref="testPlanFunctional"/> :clickType="clickType" :plan-id="planId" ref="testPlanFunctional"/>
<test-plan-api v-if="activeIndex === 'api'" :redirectCharType="redirectCharType" :clickType="clickType" <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="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 <ms-table-column
prop="priority" prop="priority"
:filters="priorityFilters" :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 MsTable from "@/business/components/common/components/table/MsTable";
import MsTablePagination from "@/business/components/common/pagination/TablePagination"; import MsTablePagination from "@/business/components/common/pagination/TablePagination";
import MsTag from "@/business/components/common/components/MsTag"; import MsTag from "@/business/components/common/components/MsTag";
import {hasLicense, getCurrentProjectID} from "@/common/js/utils";
export default { export default {
name: "FunctionalRelevance", name: "FunctionalRelevance",
@ -117,6 +129,9 @@ export default {
MsTableAdvSearchBar, MsTableAdvSearchBar,
MsTableHeader, MsTableHeader,
}, },
mounted(){
this.getVersionOptions();
},
data() { data() {
return { return {
openType: 'relevance', openType: 'relevance',
@ -134,7 +149,8 @@ export default {
{text: 'P1', value: 'P1'}, {text: 'P1', value: 'P1'},
{text: 'P2', value: 'P2'}, {text: 'P2', value: 'P2'},
{text: 'P3', value: 'P3'} {text: 'P3', value: 'P3'}
] ],
versionFilters: []
}; };
}, },
props: { props: {
@ -229,7 +245,17 @@ export default {
this.projectId = projectId; this.projectId = projectId;
} }
this.getNodeTree(this); 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> </script>

View File

@ -57,6 +57,18 @@
:label="$t('commons.name')" :label="$t('commons.name')"
min-width="120px"/> 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 <ms-table-column
prop="priority" prop="priority"
:field="item" :field="item"
@ -258,7 +270,7 @@ import {
TEST_PLAN_FUNCTION_TEST_CASE, TEST_PLAN_FUNCTION_TEST_CASE,
TokenKey, TokenKey,
} from "@/common/js/constants"; } 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 PriorityTableItem from "../../../../common/tableItems/planview/PriorityTableItem";
import StatusTableItem from "../../../../common/tableItems/planview/StatusTableItem"; import StatusTableItem from "../../../../common/tableItems/planview/StatusTableItem";
import TypeTableItem from "../../../../common/tableItems/planview/TypeTableItem"; import TypeTableItem from "../../../../common/tableItems/planview/TypeTableItem";
@ -385,7 +397,7 @@ export default {
}, },
selectDataRange: "all", selectDataRange: "all",
testCaseTemplate: {}, testCaseTemplate: {},
versionFilters: []
}; };
}, },
props: { props: {
@ -396,6 +408,7 @@ export default {
selectNodeIds: { selectNodeIds: {
type: Array type: Array
}, },
currentVersion: null
}, },
computed: { computed: {
editTestPlanTestCaseOrder() { editTestPlanTestCaseOrder() {
@ -422,6 +435,10 @@ export default {
condition() { condition() {
this.$emit('setCondition', this.condition); this.$emit('setCondition', this.condition);
}, },
currentVersion(){
this.condition.versionId = this.currentVersion;
this.initTableData();
}
}, },
created() { created() {
this.condition.orders = getLastTableSortField(this.tableHeaderKey); this.condition.orders = getLastTableSortField(this.tableHeaderKey);
@ -437,6 +454,7 @@ export default {
this.hasEditPermission = hasPermission('PROJECT_TRACK_PLAN:READ+EDIT'); this.hasEditPermission = hasPermission('PROJECT_TRACK_PLAN:READ+EDIT');
this.getMaintainerOptions(); this.getMaintainerOptions();
this.getTemplateField(); this.getTemplateField();
this.getVersionOptions();
}, },
beforeDestroy() { beforeDestroy() {
hub.$off("openFailureTestCase"); 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> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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