feat: 测试用例支持拖拽调整顺序

This commit is contained in:
chenjianxing 2021-09-09 10:29:56 +08:00 committed by jianxing
parent 2c321c3422
commit effcece5b1
15 changed files with 527 additions and 235 deletions

View File

@ -9,6 +9,8 @@ public class TestCase implements Serializable {
private String nodeId;
private String testId;
private String nodePath;
private String projectId;
@ -27,8 +29,6 @@ public class TestCase implements Serializable {
private Long updateTime;
private String testId;
private Integer sort;
private Integer num;
@ -47,10 +47,10 @@ public class TestCase implements Serializable {
private String status;
private String customNum;
private String stepModel;
private String customNum;
private String createUser;
private String originalStatus;
@ -59,5 +59,7 @@ public class TestCase implements Serializable {
private String deleteUserId;
private Long order;
private static final long serialVersionUID = 1L;
}

View File

@ -244,6 +244,76 @@ public class TestCaseExample {
return (Criteria) this;
}
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andNodePathIsNull() {
addCriterion("node_path is null");
return (Criteria) this;
@ -854,76 +924,6 @@ public class TestCaseExample {
return (Criteria) this;
}
public Criteria andTestIdIsNull() {
addCriterion("test_id is null");
return (Criteria) this;
}
public Criteria andTestIdIsNotNull() {
addCriterion("test_id is not null");
return (Criteria) this;
}
public Criteria andTestIdEqualTo(String value) {
addCriterion("test_id =", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotEqualTo(String value) {
addCriterion("test_id <>", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThan(String value) {
addCriterion("test_id >", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdGreaterThanOrEqualTo(String value) {
addCriterion("test_id >=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThan(String value) {
addCriterion("test_id <", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLessThanOrEqualTo(String value) {
addCriterion("test_id <=", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdLike(String value) {
addCriterion("test_id like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotLike(String value) {
addCriterion("test_id not like", value, "testId");
return (Criteria) this;
}
public Criteria andTestIdIn(List<String> values) {
addCriterion("test_id in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotIn(List<String> values) {
addCriterion("test_id not in", values, "testId");
return (Criteria) this;
}
public Criteria andTestIdBetween(String value1, String value2) {
addCriterion("test_id between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andTestIdNotBetween(String value1, String value2) {
addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this;
}
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
@ -1534,76 +1534,6 @@ public class TestCaseExample {
return (Criteria) this;
}
public Criteria andCustomNumIsNull() {
addCriterion("custom_num is null");
return (Criteria) this;
}
public Criteria andCustomNumIsNotNull() {
addCriterion("custom_num is not null");
return (Criteria) this;
}
public Criteria andCustomNumEqualTo(String value) {
addCriterion("custom_num =", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotEqualTo(String value) {
addCriterion("custom_num <>", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThan(String value) {
addCriterion("custom_num >", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThanOrEqualTo(String value) {
addCriterion("custom_num >=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThan(String value) {
addCriterion("custom_num <", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThanOrEqualTo(String value) {
addCriterion("custom_num <=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLike(String value) {
addCriterion("custom_num like", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotLike(String value) {
addCriterion("custom_num not like", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumIn(List<String> values) {
addCriterion("custom_num in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotIn(List<String> values) {
addCriterion("custom_num not in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumBetween(String value1, String value2) {
addCriterion("custom_num between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotBetween(String value1, String value2) {
addCriterion("custom_num not between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andStepModelIsNull() {
addCriterion("step_model is null");
return (Criteria) this;
@ -1674,6 +1604,76 @@ public class TestCaseExample {
return (Criteria) this;
}
public Criteria andCustomNumIsNull() {
addCriterion("custom_num is null");
return (Criteria) this;
}
public Criteria andCustomNumIsNotNull() {
addCriterion("custom_num is not null");
return (Criteria) this;
}
public Criteria andCustomNumEqualTo(String value) {
addCriterion("custom_num =", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotEqualTo(String value) {
addCriterion("custom_num <>", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThan(String value) {
addCriterion("custom_num >", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumGreaterThanOrEqualTo(String value) {
addCriterion("custom_num >=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThan(String value) {
addCriterion("custom_num <", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLessThanOrEqualTo(String value) {
addCriterion("custom_num <=", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumLike(String value) {
addCriterion("custom_num like", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotLike(String value) {
addCriterion("custom_num not like", value, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumIn(List<String> values) {
addCriterion("custom_num in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotIn(List<String> values) {
addCriterion("custom_num not in", values, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumBetween(String value1, String value2) {
addCriterion("custom_num between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andCustomNumNotBetween(String value1, String value2) {
addCriterion("custom_num not between", value1, value2, "customNum");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;
@ -1943,6 +1943,66 @@ public class TestCaseExample {
addCriterion("delete_user_id not between", value1, value2, "deleteUserId");
return (Criteria) this;
}
public Criteria andOrderIsNull() {
addCriterion("`order` is null");
return (Criteria) this;
}
public Criteria andOrderIsNotNull() {
addCriterion("`order` is not null");
return (Criteria) this;
}
public Criteria andOrderEqualTo(Long value) {
addCriterion("`order` =", value, "order");
return (Criteria) this;
}
public Criteria andOrderNotEqualTo(Long value) {
addCriterion("`order` <>", value, "order");
return (Criteria) this;
}
public Criteria andOrderGreaterThan(Long value) {
addCriterion("`order` >", value, "order");
return (Criteria) this;
}
public Criteria andOrderGreaterThanOrEqualTo(Long value) {
addCriterion("`order` >=", value, "order");
return (Criteria) this;
}
public Criteria andOrderLessThan(Long value) {
addCriterion("`order` <", value, "order");
return (Criteria) this;
}
public Criteria andOrderLessThanOrEqualTo(Long value) {
addCriterion("`order` <=", value, "order");
return (Criteria) this;
}
public Criteria andOrderIn(List<Long> values) {
addCriterion("`order` in", values, "order");
return (Criteria) this;
}
public Criteria andOrderNotIn(List<Long> values) {
addCriterion("`order` not in", values, "order");
return (Criteria) this;
}
public Criteria andOrderBetween(Long value1, Long value2) {
addCriterion("`order` between", value1, value2, "order");
return (Criteria) this;
}
public Criteria andOrderNotBetween(Long value1, Long value2) {
addCriterion("`order` not between", value1, value2, "order");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -4,6 +4,7 @@
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.TestCase">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="node_id" jdbcType="VARCHAR" property="nodeId" />
<result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="node_path" jdbcType="VARCHAR" property="nodePath" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
@ -13,7 +14,6 @@
<result column="method" jdbcType="VARCHAR" property="method" />
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
<result column="num" jdbcType="INTEGER" property="num" />
<result column="other_test_name" jdbcType="VARCHAR" property="otherTestName" />
@ -23,12 +23,13 @@
<result column="demand_name" jdbcType="VARCHAR" property="demandName" />
<result column="follow_people" jdbcType="VARCHAR" property="followPeople" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="custom_num" jdbcType="VARCHAR" property="customNum" />
<result column="step_model" jdbcType="VARCHAR" property="stepModel" />
<result column="custom_num" jdbcType="VARCHAR" property="customNum" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="original_status" jdbcType="VARCHAR" property="originalStatus" />
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
<result column="delete_user_id" jdbcType="VARCHAR" property="deleteUserId" />
<result column="order" jdbcType="BIGINT" property="order" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseWithBLOBs">
<result column="prerequisite" jdbcType="LONGVARCHAR" property="prerequisite" />
@ -97,10 +98,10 @@
</where>
</sql>
<sql id="Base_Column_List">
id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
create_time, update_time, test_id, sort, num, other_test_name, review_status, tags,
demand_id, demand_name, follow_people, `status`, custom_num, step_model, create_user,
original_status, delete_time, delete_user_id
id, node_id, test_id, node_path, project_id, `name`, `type`, maintainer, priority,
`method`, create_time, update_time, sort, num, other_test_name, review_status, tags,
demand_id, demand_name, follow_people, `status`, step_model, custom_num, create_user,
original_status, delete_time, delete_user_id, `order`
</sql>
<sql id="Blob_Column_List">
prerequisite, remark, steps, step_description, expected_result, custom_fields
@ -154,29 +155,29 @@
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
insert into test_case (id, node_id, node_path,
project_id, `name`, `type`,
maintainer, priority, `method`,
create_time, update_time, test_id,
insert into test_case (id, node_id, test_id,
node_path, project_id, `name`,
`type`, maintainer, priority,
`method`, create_time, update_time,
sort, num, other_test_name,
review_status, tags, demand_id,
demand_name, follow_people, `status`,
custom_num, step_model, create_user,
step_model, custom_num, create_user,
original_status, delete_time, delete_user_id,
prerequisite, remark, steps,
step_description, expected_result,
`order`, prerequisite, remark,
steps, step_description, expected_result,
custom_fields)
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{testId,jdbcType=VARCHAR},
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
#{nodePath,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{type,jdbcType=VARCHAR}, #{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR},
#{method,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{sort,jdbcType=INTEGER}, #{num,jdbcType=INTEGER}, #{otherTestName,jdbcType=VARCHAR},
#{reviewStatus,jdbcType=VARCHAR}, #{tags,jdbcType=VARCHAR}, #{demandId,jdbcType=VARCHAR},
#{demandName,jdbcType=VARCHAR}, #{followPeople,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
#{customNum,jdbcType=VARCHAR}, #{stepModel,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{stepModel,jdbcType=VARCHAR}, #{customNum,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR},
#{originalStatus,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleteUserId,jdbcType=VARCHAR},
#{prerequisite,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR},
#{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR},
#{order,jdbcType=BIGINT}, #{prerequisite,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR},
#{steps,jdbcType=LONGVARCHAR}, #{stepDescription,jdbcType=LONGVARCHAR}, #{expectedResult,jdbcType=LONGVARCHAR},
#{customFields,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
@ -188,6 +189,9 @@
<if test="nodeId != null">
node_id,
</if>
<if test="testId != null">
test_id,
</if>
<if test="nodePath != null">
node_path,
</if>
@ -215,9 +219,6 @@
<if test="updateTime != null">
update_time,
</if>
<if test="testId != null">
test_id,
</if>
<if test="sort != null">
sort,
</if>
@ -245,12 +246,12 @@
<if test="status != null">
`status`,
</if>
<if test="customNum != null">
custom_num,
</if>
<if test="stepModel != null">
step_model,
</if>
<if test="customNum != null">
custom_num,
</if>
<if test="createUser != null">
create_user,
</if>
@ -263,6 +264,9 @@
<if test="deleteUserId != null">
delete_user_id,
</if>
<if test="order != null">
`order`,
</if>
<if test="prerequisite != null">
prerequisite,
</if>
@ -289,6 +293,9 @@
<if test="nodeId != null">
#{nodeId,jdbcType=VARCHAR},
</if>
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="nodePath != null">
#{nodePath,jdbcType=VARCHAR},
</if>
@ -316,9 +323,6 @@
<if test="updateTime != null">
#{updateTime,jdbcType=BIGINT},
</if>
<if test="testId != null">
#{testId,jdbcType=VARCHAR},
</if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
@ -346,12 +350,12 @@
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
#{customNum,jdbcType=VARCHAR},
</if>
<if test="stepModel != null">
#{stepModel,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
#{customNum,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
@ -364,6 +368,9 @@
<if test="deleteUserId != null">
#{deleteUserId,jdbcType=VARCHAR},
</if>
<if test="order != null">
#{order,jdbcType=BIGINT},
</if>
<if test="prerequisite != null">
#{prerequisite,jdbcType=LONGVARCHAR},
</if>
@ -399,6 +406,9 @@
<if test="record.nodeId != null">
node_id = #{record.nodeId,jdbcType=VARCHAR},
</if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.nodePath != null">
node_path = #{record.nodePath,jdbcType=VARCHAR},
</if>
@ -426,9 +436,6 @@
<if test="record.updateTime != null">
update_time = #{record.updateTime,jdbcType=BIGINT},
</if>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
</if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
@ -456,12 +463,12 @@
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.customNum != null">
custom_num = #{record.customNum,jdbcType=VARCHAR},
</if>
<if test="record.stepModel != null">
step_model = #{record.stepModel,jdbcType=VARCHAR},
</if>
<if test="record.customNum != null">
custom_num = #{record.customNum,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
@ -474,6 +481,9 @@
<if test="record.deleteUserId != null">
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
</if>
<if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT},
</if>
<if test="record.prerequisite != null">
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
</if>
@ -501,6 +511,7 @@
update test_case
set id = #{record.id,jdbcType=VARCHAR},
node_id = #{record.nodeId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
node_path = #{record.nodePath,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
@ -510,7 +521,6 @@
`method` = #{record.method,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
num = #{record.num,jdbcType=INTEGER},
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
@ -520,12 +530,13 @@
demand_name = #{record.demandName,jdbcType=VARCHAR},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
step_model = #{record.stepModel,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
original_status = #{record.originalStatus,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT},
prerequisite = #{record.prerequisite,jdbcType=LONGVARCHAR},
remark = #{record.remark,jdbcType=LONGVARCHAR},
steps = #{record.steps,jdbcType=LONGVARCHAR},
@ -540,6 +551,7 @@
update test_case
set id = #{record.id,jdbcType=VARCHAR},
node_id = #{record.nodeId,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
node_path = #{record.nodePath,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
@ -549,7 +561,6 @@
`method` = #{record.method,jdbcType=VARCHAR},
create_time = #{record.createTime,jdbcType=BIGINT},
update_time = #{record.updateTime,jdbcType=BIGINT},
test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
num = #{record.num,jdbcType=INTEGER},
other_test_name = #{record.otherTestName,jdbcType=VARCHAR},
@ -559,12 +570,13 @@
demand_name = #{record.demandName,jdbcType=VARCHAR},
follow_people = #{record.followPeople,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
step_model = #{record.stepModel,jdbcType=VARCHAR},
custom_num = #{record.customNum,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
original_status = #{record.originalStatus,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR}
delete_user_id = #{record.deleteUserId,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -575,6 +587,9 @@
<if test="nodeId != null">
node_id = #{nodeId,jdbcType=VARCHAR},
</if>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
</if>
<if test="nodePath != null">
node_path = #{nodePath,jdbcType=VARCHAR},
</if>
@ -602,9 +617,6 @@
<if test="updateTime != null">
update_time = #{updateTime,jdbcType=BIGINT},
</if>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
</if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
@ -632,12 +644,12 @@
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
custom_num = #{customNum,jdbcType=VARCHAR},
</if>
<if test="stepModel != null">
step_model = #{stepModel,jdbcType=VARCHAR},
</if>
<if test="customNum != null">
custom_num = #{customNum,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
@ -650,6 +662,9 @@
<if test="deleteUserId != null">
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
</if>
<if test="order != null">
`order` = #{order,jdbcType=BIGINT},
</if>
<if test="prerequisite != null">
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
</if>
@ -674,6 +689,7 @@
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
update test_case
set node_id = #{nodeId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
node_path = #{nodePath,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
@ -683,7 +699,6 @@
`method` = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR},
@ -693,12 +708,13 @@
demand_name = #{demandName,jdbcType=VARCHAR},
follow_people = #{followPeople,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
original_status = #{originalStatus,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT},
prerequisite = #{prerequisite,jdbcType=LONGVARCHAR},
remark = #{remark,jdbcType=LONGVARCHAR},
steps = #{steps,jdbcType=LONGVARCHAR},
@ -710,6 +726,7 @@
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCase">
update test_case
set node_id = #{nodeId,jdbcType=VARCHAR},
test_id = #{testId,jdbcType=VARCHAR},
node_path = #{nodePath,jdbcType=VARCHAR},
project_id = #{projectId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
@ -719,7 +736,6 @@
`method` = #{method,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT},
test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
num = #{num,jdbcType=INTEGER},
other_test_name = #{otherTestName,jdbcType=VARCHAR},
@ -729,12 +745,13 @@
demand_name = #{demandName,jdbcType=VARCHAR},
follow_people = #{followPeople,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
step_model = #{stepModel,jdbcType=VARCHAR},
custom_num = #{customNum,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
original_status = #{originalStatus,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user_id = #{deleteUserId,jdbcType=VARCHAR}
delete_user_id = #{deleteUserId,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>

View File

@ -9,10 +9,10 @@
<foreach collection="request.orders" separator="," item="order">
<choose>
<when test="order.prefix != null and order.prefix != ''">
${order.prefix}.${order.name} ${order.type}
${order.prefix}.`${order.name}` ${order.type}
</when>
<otherwise>
${order.name} ${order.type}
`${order.name}` ${order.type}
</otherwise>
</choose>
</foreach>

View File

@ -110,4 +110,12 @@ public interface ExtTestCaseMapper {
List<String> selectIdsByNodeIds(@Param("ids")List<String> nodeIds);
TestCaseWithBLOBs getTestCaseStep(@Param("id") String id);
List<String> selectProjectIds();
List<String> getIdsOrderByCreateTime(@Param("projectId") String projectId);
Long getLastOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
Long getPreOrder(@Param("projectId")String projectId, @Param("baseOrder") Long baseOrder);
}

View File

@ -530,6 +530,28 @@
<select id="getTestCaseStep" resultType="io.metersphere.base.domain.TestCaseWithBLOBs">
select id, prerequisite, steps, step_description, expected_result, step_model from test_case where id = #{id}
</select>
<select id="selectProjectIds" resultType="java.lang.String">
select DISTINCT project_id from test_case;
</select>
<select id="getIdsOrderByCreateTime" resultType="java.lang.String">
select id from test_case where project_id = #{projectId} order by create_time DESC;
</select>
<select id="getLastOrder" resultType="java.lang.Long">
select `order` from test_case where project_id = #{projectId}
<if test="baseOrder != null">
and `order` &gt; #{baseOrder}
</if>
order by `order` desc limit 1;
</select>
<select id="getPreOrder" resultType="java.lang.Long">
select `order` from test_case where project_id = #{projectId}
<if test="baseOrder != null">
and `order` &lt; #{baseOrder}
</if>
order by `order` desc limit 1;
</select>
<update id="deleteToGc">
update test_case set original_status=status,

View File

@ -0,0 +1,15 @@
package io.metersphere.controller.request;
import lombok.Data;
@Data
public class ResetOrderRequest {
private String moveId;
private String targetId;
private String moveMode;
private String projectId;
public enum MoveMode {
BEFORE, AFTER
}
}

View File

@ -13,6 +13,7 @@ import io.metersphere.service.PluginService;
import io.metersphere.service.ScheduleService;
import io.metersphere.service.SystemParameterService;
import io.metersphere.track.service.IssuesService;
import io.metersphere.track.service.TestCaseService;
import org.apache.commons.lang3.StringUtils;
import org.python.core.Options;
import org.python.util.PythonInterpreter;
@ -45,6 +46,8 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
private PerformanceTestService performanceTestService;
@Resource
private PluginService pluginService;
@Resource
private TestCaseService testCaseService;
@Value("${jmeter.home}")
private String jmeterHome;
@ -74,6 +77,7 @@ public class AppStartListener implements ApplicationListener<ApplicationReadyEve
initOperate(issuesService::syncThirdPartyIssues, "init.issue");
initOperate(issuesService::issuesCount, "init.issueCount");
initOperate(performanceTestService::initScenarioLoadTest, "init.scenario.load.test");
initOperate(testCaseService::initOrderField, "init.sort.test.case");
pluginService.loadPlugins();
try {
Thread.sleep(1 * 60 * 1000);

View File

@ -17,6 +17,7 @@ import io.metersphere.commons.constants.PermissionConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.commons.utils.SessionUtils;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.dto.TestCaseTestDao;
import io.metersphere.excel.domain.ExcelResponse;
@ -186,6 +187,12 @@ public class TestCaseController {
return testCaseService.save(request, files);
}
@PostMapping("/edit/order")
public void orderCase(@RequestBody ResetOrderRequest request) {
checkPermissionService.checkTestCaseOwner(request.getMoveId());
testCaseService.orderCase(request);
}
@PostMapping(value = "/edit", consumes = {"multipart/form-data"})
@MsAuditLog(module = "track_test_case", type = OperLogConstants.UPDATE, beforeEvent = "#msClass.getLogDetails(#request.id)", title = "#request.name", content = "#msClass.getLogDetails(#request.id)", msClass = TestCaseService.class)
@SendNotice(taskType = NoticeConstants.TaskType.TRACK_TEST_CASE_TASK, target = "#targetClass.getTestCase(#request.id)", targetClass = TestCaseService.class,

View File

@ -22,11 +22,9 @@ import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.user.SessionUser;
import io.metersphere.commons.utils.*;
import io.metersphere.controller.request.OrderRequest;
import io.metersphere.controller.request.ResetOrderRequest;
import io.metersphere.controller.request.member.QueryMemberRequest;
import io.metersphere.dto.CustomFieldDao;
import io.metersphere.dto.LoadTestDTO;
import io.metersphere.dto.TestCaseTemplateDao;
import io.metersphere.dto.TestCaseTestDao;
import io.metersphere.dto.*;
import io.metersphere.excel.domain.*;
import io.metersphere.excel.handler.FunctionCaseTemplateWriteHandler;
import io.metersphere.excel.listener.TestCaseNoModelDataListener;
@ -168,10 +166,16 @@ public class TestCaseService {
testCase.setDemandName(testCase.getDemandName());
testCase.setCreateUser(SessionUtils.getUserId());
this.setNode(testCase);
setNextOrder(testCase);
testCaseMapper.insert(testCase);
return testCase;
}
public synchronized void setNextOrder(TestCaseWithBLOBs testCase) {
Long lastOrder = extTestCaseMapper.getLastOrder(testCase.getProjectId(), null);
testCase.setOrder((lastOrder == null ? 0 : lastOrder) + 5000);
}
private void checkTestCustomNum(TestCaseWithBLOBs testCase) {
if (StringUtils.isNotBlank(testCase.getCustomNum())) {
String projectId = testCase.getProjectId();
@ -339,14 +343,7 @@ public class TestCaseService {
public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) {
this.initRequest(request, true);
List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
OrderRequest order = new OrderRequest();
// 对模板导入的测试用例排序
order.setName("sort");
order.setType("desc");
orderList.add(order);
request.setOrders(orderList);
setDefaultOrder(request);
if (request.getFilters() != null && !request.getFilters().containsKey("status")) {
request.getFilters().put("status", new ArrayList<>(0));
}
@ -354,6 +351,22 @@ public class TestCaseService {
returnList = this.parseStatus(returnList);
return returnList;
}
public void setDefaultOrder(QueryTestCaseRequest request) {
List<OrderRequest> orders = request.getOrders();
if (CollectionUtils.isEmpty(orders)) {
OrderRequest order = new OrderRequest();
order.setName("order");
order.setType("desc");
orders = new ArrayList<>();
orders.add(order);
}
OrderRequest order = new OrderRequest();
// 对模板导入的测试用例排序
order.setName("sort");
order.setType("desc");
orders.add(order);
request.setOrders(orders);
}
private List<TestCaseDTO> parseStatus(List<TestCaseDTO> returnList) {
TestCaseExcelData excelData = new TestCaseExcelDataFactory().getTestCaseExcelDataLocal();
@ -423,12 +436,7 @@ public class TestCaseService {
* @return
*/
public List<TestCase> getTestCaseRelateList(QueryTestCaseRequest request) {
List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
OrderRequest order = new OrderRequest();
order.setName("sort");
order.setType("desc");
orderList.add(order);
request.setOrders(orderList);
setDefaultOrder(request);
return getTestCaseByNotInPlan(request);
}
@ -1909,4 +1917,48 @@ public class TestCaseService {
public TestCaseWithBLOBs getTestCaseStep(String testCaseId) {
return extTestCaseMapper.getTestCaseStep(testCaseId);
}
public void initOrderField() {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
List<String> projectIds = extTestCaseMapper.selectProjectIds();
projectIds.forEach((projectId) -> {
Long order = 0L;
List<String> ids = extTestCaseMapper.getIdsOrderByCreateTime(projectId);
for (String id : ids) {
TestCaseWithBLOBs testCase = new TestCaseWithBLOBs();
testCase.setId(id);
testCase.setOrder(order);
order += 5000;
mapper.updateByPrimaryKeySelective(testCase);
}
sqlSession.flushStatements();
});
}
/**
* 用例自定义排序
* @param request
*/
public void orderCase(ResetOrderRequest request) {
Long order = null;
Long lastOrPreOrder = null;
TestCaseWithBLOBs target = testCaseMapper.selectByPrimaryKey(request.getTargetId());
if (request.getMoveMode().equals(ResetOrderRequest.MoveMode.AFTER.name())) {
order = target.getOrder() - 5000;
lastOrPreOrder = extTestCaseMapper.getPreOrder(request.getProjectId(), target.getOrder());
} else {
order = target.getOrder() + 5000;
// 追加到前面因为是降序排则查找比目标 order 更大的一个order
lastOrPreOrder = extTestCaseMapper.getLastOrder(request.getProjectId(), target.getOrder());
}
if (lastOrPreOrder != null) {
// 如果不是第一个或最后一个则取中间值
order = (target.getOrder() + lastOrPreOrder) / 2;
}
TestCaseWithBLOBs testCaseWithBLOBs = new TestCaseWithBLOBs();
testCaseWithBLOBs.setId(request.getMoveId());
testCaseWithBLOBs.setOrder(order);
testCaseMapper.updateByPrimaryKeySelective(testCaseWithBLOBs);
}
}

View File

@ -34,3 +34,4 @@ update api_scenario_module set name = '未规划场景' where name = '默认模
update api_scenario set module_path = replace (`module_path`,'/默认模块','/未规划场景') where module_path like '/默认模块%';
ALTER TABLE test_case ADD `order` bigint(20) NOT NULL COMMENT '自定义排序间隔5000';

View File

@ -14,6 +14,8 @@
:class="{'ms-select-all-fixed': showSelectAll}"
:height="screenHeight"
v-loading="tableIsLoading"
:row-key="rowKey"
:cell-class-name="addPaddingColClass"
:highlight-current-row="highlightCurrentRow"
ref="table" @row-click="handleRowClick">
@ -27,8 +29,9 @@
@selectPageAll="isSelectDataAll(false)"
@selectAll="isSelectDataAll(true)"/>
<el-table-column v-if="enableSelection && batchOperators && batchOperators.length > 0" width="30"
<el-table-column v-if="enableSelection && batchOperators && batchOperators.length > 0" width="15"
fixed="left"
column-key="batchBtnCol"
:resizable="false" align="center">
<template v-slot:default="scope">
<!-- 选中记录后浮现的按钮提供对记录的批量操作 -->
@ -42,6 +45,17 @@
<span class="table-column-mark">&nbsp;</span>
</template>
</el-table-column>
<el-table-column v-if="enableOrderDrag" width="20" column-key="tableRowDropCol">
<template v-slot:default="scope">
<!-- <span class="table-row-drop-bar">-->
<div class="table-row-drop-bar">
<i class="el-icon-more ms-icon-more"/>
<i class="el-icon-more ms-icon-more"/>
</div>
</template>
</el-table-column>
<slot></slot>
<el-table-column
@ -201,7 +215,9 @@ export default {
customFields: Array,
highlightCurrentRow: Boolean,
//
rememberOrder: Boolean
rememberOrder: Boolean,
enableOrderDrag: Boolean,
rowKey: [String, Function],
},
mounted() {
this.setDefaultOrders();
@ -245,6 +261,7 @@ export default {
let columnTop = column.getBoundingClientRect().top;
return columnTop - tableTop > 30;
},
// 访
setDefaultOrders() {
let orders = this.condition.orders;
if (orders) {
@ -384,6 +401,13 @@ export default {
this.$nextTick(() => {
this.tableActive = true;
});
},
addPaddingColClass({column}) {
if (column.columnKey === 'tableRowDropCol'
|| column.columnKey === 'selectionCol'
|| column.columnKey ==='batchBtnCol') {
return 'padding-col';
}
}
}
};
@ -394,4 +418,33 @@ export default {
top: 300px;
color: #1FDD02;
}
.el-table >>> .padding-col .cell {
padding: 0px !important;
}
.table-row-drop-bar {
/*visibility: hidden;*/
text-align: center;
height: 28px;
}
.table-row-drop-bar:hover {
/*visibility: visible;*/
/*font-size: 15px;*/
}
/*.el-table >>> .hover-row .table-row-drop-bar {*/
/* visibility: initial !important;*/
/*}*/
.ms-icon-more {
transform: rotate(90deg);
width: 9px;
color: #cccccc;
}
.ms-icon-more:first-child {
margin-right: -5px;
}
</style>

View File

@ -15,6 +15,8 @@
:screen-height="screenHeight"
:batch-operators="batchButtons"
:remember-order="true"
:enable-order-drag="enableOrderDrag"
row-key="id"
@handlePageChange="initTableData"
@handleRowClick="handleEdit"
:fields.sync="fields"
@ -206,7 +208,7 @@ import {
getCustomFieldValue,
getCustomTableWidth, getLastTableSortField,
getPageInfo,
getTableHeaderWithCustomFields,
getTableHeaderWithCustomFields, handleRowDrop,
initCondition,
} from "@/common/js/tableUtils";
import HeaderLabelOperate from "@/business/components/common/head/HeaderLabelOperate";
@ -219,6 +221,7 @@ import MsTableColumn from "@/business/components/common/components/table/MsTable
import BatchMove from "@/business/components/track/case/components/BatchMove";
import {SYSTEM_FIELD_NAME_MAP} from "@/common/js/table-constants";
import TestCasePreview from "@/business/components/track/case/components/TestCasePreview";
import {editTestCaseOrder} from "@/network/testCase";
export default {
name: "TestCaseList",
@ -256,6 +259,7 @@ export default {
screenHeight: 'calc(100vh - 258px)',
tableLabel: [],
deletePath: "/test/case/delete",
enableOrderDrag: true,
condition: {
components: TEST_CASE_CONFIGS
},
@ -390,8 +394,6 @@ export default {
}else {
this.condition.filters = {reviewStatus: ["Prepare", "Pass", "UnPass"]};
}
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
this.initTableData();
let redirectParam = this.$route.query.dataSelectRange;
this.checkRedirectEditPage(redirectParam);
@ -515,6 +517,11 @@ export default {
this.condition.nodeIds = [];
//initCondition(this.condition);
initCondition(this.condition, this.condition.selectAll);
this.condition.orders = getLastTableSortField(this.tableHeaderKey);
this.enableOrderDrag = true;
if (this.condition.orders.length > 0) {
this.enableOrderDrag = false;
}
if (this.planId) {
// param.planId = this.planId;
this.condition.planId = this.planId;
@ -579,9 +586,20 @@ export default {
item.tags = JSON.parse(item.tags);
});
checkTableRowIsSelected(this, this.$refs.table);
this.handleRowDrop();
});
}
},
handleRowDrop() {
this.$nextTick(() => {
handleRowDrop(this.page.data, (param) => {
param.projectId = this.projectId;
editTestCaseOrder(param);
});
});
},
search() {
this.initTableData();
},

View File

@ -2,6 +2,7 @@ import {getCurrentProjectID, getCurrentUser, humpToLine} from "@/common/js/utils
import {CUSTOM_TABLE_HEADER} from "@/common/js/default-table-header";
import {updateCustomFieldTemplate} from "@/network/custom-field-template";
import i18n from "@/i18n/i18n";
import Sortable from 'sortablejs'
export function _handleSelectAll(component, selection, tableData, selectRows, condition) {
if (selection.length > 0) {
@ -524,3 +525,30 @@ export function getCustomFieldBatchEditOption(customFields, typeArr, valueArr, m
}
});
}
export function handleRowDrop(data, callback) {
setTimeout(() => {
const tbody = document.querySelector('.el-table__body-wrapper tbody');
Sortable.create(tbody, {
handle: ".table-row-drop-bar",
animation: 100,
onEnd({ newIndex, oldIndex }) {
let param = {};
param.moveId = data[oldIndex].id;
if (newIndex === 0) {
param.moveMode = 'BEFORE';
param.targetId = data[0].id;
} else {
// 默认从后面添加
param.moveMode = 'AFTER';
param.targetId = data[newIndex].id;
}
const currRow = data.splice(oldIndex, 1)[0];
data.splice(newIndex, 0, currRow);
if (callback) {
callback(param);
}
}
});
}, 100);
}

View File

@ -1,6 +1,7 @@
import {post, get} from "@/common/js/ajax";
import {success} from "@/common/js/message";
import i18n from "@/i18n/i18n";
import {basePost} from "@/network/base-network";
export function getTestCasesForMinder(request, callback) {
return post('/test/case/list/minder', request, (response) => {
@ -48,3 +49,7 @@ export function deleteRelateTest(caseId, testId, callback) {
});
}
}
export function editTestCaseOrder(request, callback) {
return basePost('/test/case/edit/order', request, callback);
}