对模板导入的测试用例进行排序

This commit is contained in:
shiziyuan9527 2020-06-30 15:27:12 +08:00
parent 56d25dfcd8
commit 1c16353180
6 changed files with 169 additions and 76 deletions

View File

@ -31,5 +31,7 @@ public class TestCase implements Serializable {
private String testId; private String testId;
private Integer sort;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -385,142 +385,142 @@ public class TestCaseExample {
} }
public Criteria andNameIsNull() { public Criteria andNameIsNull() {
addCriterion("name is null"); addCriterion("`name` is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameIsNotNull() { public Criteria andNameIsNotNull() {
addCriterion("name is not null"); addCriterion("`name` is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameEqualTo(String value) { public Criteria andNameEqualTo(String value) {
addCriterion("name =", value, "name"); addCriterion("`name` =", value, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameNotEqualTo(String value) { public Criteria andNameNotEqualTo(String value) {
addCriterion("name <>", value, "name"); addCriterion("`name` <>", value, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameGreaterThan(String value) { public Criteria andNameGreaterThan(String value) {
addCriterion("name >", value, "name"); addCriterion("`name` >", value, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameGreaterThanOrEqualTo(String value) { public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("name >=", value, "name"); addCriterion("`name` >=", value, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameLessThan(String value) { public Criteria andNameLessThan(String value) {
addCriterion("name <", value, "name"); addCriterion("`name` <", value, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameLessThanOrEqualTo(String value) { public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("name <=", value, "name"); addCriterion("`name` <=", value, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameLike(String value) { public Criteria andNameLike(String value) {
addCriterion("name like", value, "name"); addCriterion("`name` like", value, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameNotLike(String value) { public Criteria andNameNotLike(String value) {
addCriterion("name not like", value, "name"); addCriterion("`name` not like", value, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameIn(List<String> values) { public Criteria andNameIn(List<String> values) {
addCriterion("name in", values, "name"); addCriterion("`name` in", values, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameNotIn(List<String> values) { public Criteria andNameNotIn(List<String> values) {
addCriterion("name not in", values, "name"); addCriterion("`name` not in", values, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameBetween(String value1, String value2) { public Criteria andNameBetween(String value1, String value2) {
addCriterion("name between", value1, value2, "name"); addCriterion("`name` between", value1, value2, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andNameNotBetween(String value1, String value2) { public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("name not between", value1, value2, "name"); addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNull() { public Criteria andTypeIsNull() {
addCriterion("type is null"); addCriterion("`type` is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIsNotNull() { public Criteria andTypeIsNotNull() {
addCriterion("type is not null"); addCriterion("`type` is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeEqualTo(String value) { public Criteria andTypeEqualTo(String value) {
addCriterion("type =", value, "type"); addCriterion("`type` =", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeNotEqualTo(String value) { public Criteria andTypeNotEqualTo(String value) {
addCriterion("type <>", value, "type"); addCriterion("`type` <>", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeGreaterThan(String value) { public Criteria andTypeGreaterThan(String value) {
addCriterion("type >", value, "type"); addCriterion("`type` >", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeGreaterThanOrEqualTo(String value) { public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("type >=", value, "type"); addCriterion("`type` >=", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeLessThan(String value) { public Criteria andTypeLessThan(String value) {
addCriterion("type <", value, "type"); addCriterion("`type` <", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeLessThanOrEqualTo(String value) { public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("type <=", value, "type"); addCriterion("`type` <=", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeLike(String value) { public Criteria andTypeLike(String value) {
addCriterion("type like", value, "type"); addCriterion("`type` like", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeNotLike(String value) { public Criteria andTypeNotLike(String value) {
addCriterion("type not like", value, "type"); addCriterion("`type` not like", value, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeIn(List<String> values) { public Criteria andTypeIn(List<String> values) {
addCriterion("type in", values, "type"); addCriterion("`type` in", values, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeNotIn(List<String> values) { public Criteria andTypeNotIn(List<String> values) {
addCriterion("type not in", values, "type"); addCriterion("`type` not in", values, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeBetween(String value1, String value2) { public Criteria andTypeBetween(String value1, String value2) {
addCriterion("type between", value1, value2, "type"); addCriterion("`type` between", value1, value2, "type");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTypeNotBetween(String value1, String value2) { public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("type not between", value1, value2, "type"); addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this; return (Criteria) this;
} }
@ -665,72 +665,72 @@ public class TestCaseExample {
} }
public Criteria andMethodIsNull() { public Criteria andMethodIsNull() {
addCriterion("method is null"); addCriterion("`method` is null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodIsNotNull() { public Criteria andMethodIsNotNull() {
addCriterion("method is not null"); addCriterion("`method` is not null");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodEqualTo(String value) { public Criteria andMethodEqualTo(String value) {
addCriterion("method =", value, "method"); addCriterion("`method` =", value, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodNotEqualTo(String value) { public Criteria andMethodNotEqualTo(String value) {
addCriterion("method <>", value, "method"); addCriterion("`method` <>", value, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodGreaterThan(String value) { public Criteria andMethodGreaterThan(String value) {
addCriterion("method >", value, "method"); addCriterion("`method` >", value, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodGreaterThanOrEqualTo(String value) { public Criteria andMethodGreaterThanOrEqualTo(String value) {
addCriterion("method >=", value, "method"); addCriterion("`method` >=", value, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodLessThan(String value) { public Criteria andMethodLessThan(String value) {
addCriterion("method <", value, "method"); addCriterion("`method` <", value, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodLessThanOrEqualTo(String value) { public Criteria andMethodLessThanOrEqualTo(String value) {
addCriterion("method <=", value, "method"); addCriterion("`method` <=", value, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodLike(String value) { public Criteria andMethodLike(String value) {
addCriterion("method like", value, "method"); addCriterion("`method` like", value, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodNotLike(String value) { public Criteria andMethodNotLike(String value) {
addCriterion("method not like", value, "method"); addCriterion("`method` not like", value, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodIn(List<String> values) { public Criteria andMethodIn(List<String> values) {
addCriterion("method in", values, "method"); addCriterion("`method` in", values, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodNotIn(List<String> values) { public Criteria andMethodNotIn(List<String> values) {
addCriterion("method not in", values, "method"); addCriterion("`method` not in", values, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodBetween(String value1, String value2) { public Criteria andMethodBetween(String value1, String value2) {
addCriterion("method between", value1, value2, "method"); addCriterion("`method` between", value1, value2, "method");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andMethodNotBetween(String value1, String value2) { public Criteria andMethodNotBetween(String value1, String value2) {
addCriterion("method not between", value1, value2, "method"); addCriterion("`method` not between", value1, value2, "method");
return (Criteria) this; return (Criteria) this;
} }
@ -993,6 +993,66 @@ public class TestCaseExample {
addCriterion("test_id not between", value1, value2, "testId"); addCriterion("test_id not between", value1, value2, "testId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andSortIsNull() {
addCriterion("sort is null");
return (Criteria) this;
}
public Criteria andSortIsNotNull() {
addCriterion("sort is not null");
return (Criteria) this;
}
public Criteria andSortEqualTo(Integer value) {
addCriterion("sort =", value, "sort");
return (Criteria) this;
}
public Criteria andSortNotEqualTo(Integer value) {
addCriterion("sort <>", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThan(Integer value) {
addCriterion("sort >", value, "sort");
return (Criteria) this;
}
public Criteria andSortGreaterThanOrEqualTo(Integer value) {
addCriterion("sort >=", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThan(Integer value) {
addCriterion("sort <", value, "sort");
return (Criteria) this;
}
public Criteria andSortLessThanOrEqualTo(Integer value) {
addCriterion("sort <=", value, "sort");
return (Criteria) this;
}
public Criteria andSortIn(List<Integer> values) {
addCriterion("sort in", values, "sort");
return (Criteria) this;
}
public Criteria andSortNotIn(List<Integer> values) {
addCriterion("sort not in", values, "sort");
return (Criteria) this;
}
public Criteria andSortBetween(Integer value1, Integer value2) {
addCriterion("sort between", value1, value2, "sort");
return (Criteria) this;
}
public Criteria andSortNotBetween(Integer value1, Integer value2) {
addCriterion("sort not between", value1, value2, "sort");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -15,6 +15,7 @@
<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="test_id" jdbcType="VARCHAR" property="testId" />
<result column="sort" jdbcType="INTEGER" property="sort" />
</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="remark" jdbcType="LONGVARCHAR" property="remark" /> <result column="remark" jdbcType="LONGVARCHAR" property="remark" />
@ -79,8 +80,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, node_id, node_path, project_id, name, type, maintainer, priority, method, prerequisite, id, node_id, node_path, project_id, `name`, `type`, maintainer, priority, `method`,
create_time, update_time, test_id prerequisite, create_time, update_time, test_id, sort
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
remark, steps remark, steps
@ -135,17 +136,17 @@
</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, node_path,
project_id, name, type, project_id, `name`, `type`,
maintainer, priority, method, maintainer, priority, `method`,
prerequisite, create_time, update_time, prerequisite, create_time, update_time,
test_id, remark, steps test_id, sort, remark,
) steps)
values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{nodeId,jdbcType=VARCHAR}, #{nodePath,jdbcType=VARCHAR},
#{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR},
#{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR}, #{maintainer,jdbcType=VARCHAR}, #{priority,jdbcType=VARCHAR}, #{method,jdbcType=VARCHAR},
#{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{prerequisite,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{testId,jdbcType=VARCHAR}, #{remark,jdbcType=LONGVARCHAR}, #{steps,jdbcType=LONGVARCHAR} #{testId,jdbcType=VARCHAR}, #{sort,jdbcType=INTEGER}, #{remark,jdbcType=LONGVARCHAR},
) #{steps,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseWithBLOBs">
insert into test_case insert into test_case
@ -163,10 +164,10 @@
project_id, project_id,
</if> </if>
<if test="name != null"> <if test="name != null">
name, `name`,
</if> </if>
<if test="type != null"> <if test="type != null">
type, `type`,
</if> </if>
<if test="maintainer != null"> <if test="maintainer != null">
maintainer, maintainer,
@ -175,7 +176,7 @@
priority, priority,
</if> </if>
<if test="method != null"> <if test="method != null">
method, `method`,
</if> </if>
<if test="prerequisite != null"> <if test="prerequisite != null">
prerequisite, prerequisite,
@ -189,6 +190,9 @@
<if test="testId != null"> <if test="testId != null">
test_id, test_id,
</if> </if>
<if test="sort != null">
sort,
</if>
<if test="remark != null"> <if test="remark != null">
remark, remark,
</if> </if>
@ -236,6 +240,9 @@
<if test="testId != null"> <if test="testId != null">
#{testId,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR},
</if> </if>
<if test="sort != null">
#{sort,jdbcType=INTEGER},
</if>
<if test="remark != null"> <if test="remark != null">
#{remark,jdbcType=LONGVARCHAR}, #{remark,jdbcType=LONGVARCHAR},
</if> </if>
@ -266,10 +273,10 @@
project_id = #{record.projectId,jdbcType=VARCHAR}, project_id = #{record.projectId,jdbcType=VARCHAR},
</if> </if>
<if test="record.name != null"> <if test="record.name != null">
name = #{record.name,jdbcType=VARCHAR}, `name` = #{record.name,jdbcType=VARCHAR},
</if> </if>
<if test="record.type != null"> <if test="record.type != null">
type = #{record.type,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR},
</if> </if>
<if test="record.maintainer != null"> <if test="record.maintainer != null">
maintainer = #{record.maintainer,jdbcType=VARCHAR}, maintainer = #{record.maintainer,jdbcType=VARCHAR},
@ -278,7 +285,7 @@
priority = #{record.priority,jdbcType=VARCHAR}, priority = #{record.priority,jdbcType=VARCHAR},
</if> </if>
<if test="record.method != null"> <if test="record.method != null">
method = #{record.method,jdbcType=VARCHAR}, `method` = #{record.method,jdbcType=VARCHAR},
</if> </if>
<if test="record.prerequisite != null"> <if test="record.prerequisite != null">
prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, prerequisite = #{record.prerequisite,jdbcType=VARCHAR},
@ -292,6 +299,9 @@
<if test="record.testId != null"> <if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR}, test_id = #{record.testId,jdbcType=VARCHAR},
</if> </if>
<if test="record.sort != null">
sort = #{record.sort,jdbcType=INTEGER},
</if>
<if test="record.remark != null"> <if test="record.remark != null">
remark = #{record.remark,jdbcType=LONGVARCHAR}, remark = #{record.remark,jdbcType=LONGVARCHAR},
</if> </if>
@ -309,15 +319,16 @@
node_id = #{record.nodeId,jdbcType=VARCHAR}, node_id = #{record.nodeId,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},
type = #{record.type,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR},
maintainer = #{record.maintainer,jdbcType=VARCHAR}, maintainer = #{record.maintainer,jdbcType=VARCHAR},
priority = #{record.priority,jdbcType=VARCHAR}, priority = #{record.priority,jdbcType=VARCHAR},
method = #{record.method,jdbcType=VARCHAR}, `method` = #{record.method,jdbcType=VARCHAR},
prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, prerequisite = #{record.prerequisite,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}, test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER},
remark = #{record.remark,jdbcType=LONGVARCHAR}, remark = #{record.remark,jdbcType=LONGVARCHAR},
steps = #{record.steps,jdbcType=LONGVARCHAR} steps = #{record.steps,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
@ -330,15 +341,16 @@
node_id = #{record.nodeId,jdbcType=VARCHAR}, node_id = #{record.nodeId,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},
type = #{record.type,jdbcType=VARCHAR}, `type` = #{record.type,jdbcType=VARCHAR},
maintainer = #{record.maintainer,jdbcType=VARCHAR}, maintainer = #{record.maintainer,jdbcType=VARCHAR},
priority = #{record.priority,jdbcType=VARCHAR}, priority = #{record.priority,jdbcType=VARCHAR},
method = #{record.method,jdbcType=VARCHAR}, `method` = #{record.method,jdbcType=VARCHAR},
prerequisite = #{record.prerequisite,jdbcType=VARCHAR}, prerequisite = #{record.prerequisite,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} test_id = #{record.testId,jdbcType=VARCHAR},
sort = #{record.sort,jdbcType=INTEGER}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -356,10 +368,10 @@
project_id = #{projectId,jdbcType=VARCHAR}, project_id = #{projectId,jdbcType=VARCHAR},
</if> </if>
<if test="name != null"> <if test="name != null">
name = #{name,jdbcType=VARCHAR}, `name` = #{name,jdbcType=VARCHAR},
</if> </if>
<if test="type != null"> <if test="type != null">
type = #{type,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR},
</if> </if>
<if test="maintainer != null"> <if test="maintainer != null">
maintainer = #{maintainer,jdbcType=VARCHAR}, maintainer = #{maintainer,jdbcType=VARCHAR},
@ -368,7 +380,7 @@
priority = #{priority,jdbcType=VARCHAR}, priority = #{priority,jdbcType=VARCHAR},
</if> </if>
<if test="method != null"> <if test="method != null">
method = #{method,jdbcType=VARCHAR}, `method` = #{method,jdbcType=VARCHAR},
</if> </if>
<if test="prerequisite != null"> <if test="prerequisite != null">
prerequisite = #{prerequisite,jdbcType=VARCHAR}, prerequisite = #{prerequisite,jdbcType=VARCHAR},
@ -382,6 +394,9 @@
<if test="testId != null"> <if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR}, test_id = #{testId,jdbcType=VARCHAR},
</if> </if>
<if test="sort != null">
sort = #{sort,jdbcType=INTEGER},
</if>
<if test="remark != null"> <if test="remark != null">
remark = #{remark,jdbcType=LONGVARCHAR}, remark = #{remark,jdbcType=LONGVARCHAR},
</if> </if>
@ -396,15 +411,16 @@
set node_id = #{nodeId,jdbcType=VARCHAR}, set node_id = #{nodeId,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},
type = #{type,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR},
maintainer = #{maintainer,jdbcType=VARCHAR}, maintainer = #{maintainer,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR}, priority = #{priority,jdbcType=VARCHAR},
method = #{method,jdbcType=VARCHAR}, `method` = #{method,jdbcType=VARCHAR},
prerequisite = #{prerequisite,jdbcType=VARCHAR}, prerequisite = #{prerequisite,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}, test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER},
remark = #{remark,jdbcType=LONGVARCHAR}, remark = #{remark,jdbcType=LONGVARCHAR},
steps = #{steps,jdbcType=LONGVARCHAR} steps = #{steps,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
@ -414,15 +430,16 @@
set node_id = #{nodeId,jdbcType=VARCHAR}, set node_id = #{nodeId,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},
type = #{type,jdbcType=VARCHAR}, `type` = #{type,jdbcType=VARCHAR},
maintainer = #{maintainer,jdbcType=VARCHAR}, maintainer = #{maintainer,jdbcType=VARCHAR},
priority = #{priority,jdbcType=VARCHAR}, priority = #{priority,jdbcType=VARCHAR},
method = #{method,jdbcType=VARCHAR}, `method` = #{method,jdbcType=VARCHAR},
prerequisite = #{prerequisite,jdbcType=VARCHAR}, prerequisite = #{prerequisite,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} test_id = #{testId,jdbcType=VARCHAR},
sort = #{sort,jdbcType=INTEGER}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -10,6 +10,7 @@ import io.metersphere.i18n.Translator;
import io.metersphere.track.service.TestCaseService; import io.metersphere.track.service.TestCaseService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -72,6 +73,8 @@ public class TestCaseDataListener extends EasyExcelListener<TestCaseExcelData> {
return; return;
} }
Collections.reverse(list);
List<TestCaseWithBLOBs> result = list.stream() List<TestCaseWithBLOBs> result = list.stream()
.map(item -> this.convert2TestCase(item)) .map(item -> this.convert2TestCase(item))
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@ -35,6 +35,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
@ -121,7 +122,13 @@ public class TestCaseService {
} }
public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) { public List<TestCaseDTO> listTestCase(QueryTestCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultOrder(request.getOrders())); List<OrderRequest> orderList = ServiceUtils.getDefaultOrder(request.getOrders());
OrderRequest order = new OrderRequest();
// 对模板导入的测试用例排序
order.setName("sort");
order.setType("desc");
orderList.add(order);
request.setOrders(orderList);
return extTestCaseMapper.list(request); return extTestCaseMapper.list(request);
} }
@ -176,7 +183,7 @@ public class TestCaseService {
TestCaseExample testCaseExample = new TestCaseExample(); TestCaseExample testCaseExample = new TestCaseExample();
testCaseExample.createCriteria().andProjectIdIn(projectIds); testCaseExample.createCriteria().andProjectIdIn(projectIds);
testCaseExample.setOrderByClause("update_time desc"); testCaseExample.setOrderByClause("update_time desc, sort desc");
return testCaseMapper.selectByExample(testCaseExample); return testCaseMapper.selectByExample(testCaseExample);
} }
@ -235,8 +242,10 @@ public class TestCaseService {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH); SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class); TestCaseMapper mapper = sqlSession.getMapper(TestCaseMapper.class);
if (!testCases.isEmpty()) { if (!testCases.isEmpty()) {
AtomicInteger sort = new AtomicInteger();
testCases.forEach(testcase -> { testCases.forEach(testcase -> {
testcase.setNodeId(nodePathMap.get(testcase.getNodePath())); testcase.setNodeId(nodePathMap.get(testcase.getNodePath()));
testcase.setSort(sort.getAndIncrement());
mapper.insert(testcase); mapper.insert(testcase);
}); });
} }

View File

@ -171,3 +171,5 @@ ALTER TABLE `api_test_report` ADD `trigger_mode` varchar(64) NULL;
ALTER TABLE `load_test_report` ADD `trigger_mode` varchar(64) NULL; ALTER TABLE `load_test_report` ADD `trigger_mode` varchar(64) NULL;
UPDATE `api_test_report` SET `trigger_mode` = 'MANUAL' WHERE 1; UPDATE `api_test_report` SET `trigger_mode` = 'MANUAL' WHERE 1;
UPDATE `load_test_report` SET `trigger_mode` = 'MANUAL' WHERE 1; UPDATE `load_test_report` SET `trigger_mode` = 'MANUAL' WHERE 1;
alter table test_case add sort int null comment 'Import test case sort';