refactor(测试跟踪): 优化测试计划测试评审性能

--bug=1010014 --user=陈建星 【测试跟踪】github#9991,测试跟踪首页用例评审加载慢6S,优化性能 https://www.tapd.cn/55049933/s/1174639
This commit is contained in:
chenjianxing 2022-06-07 17:11:07 +08:00 committed by jianxing
parent 08e6ccecc3
commit e819578af9
20 changed files with 513 additions and 306 deletions

View File

@ -11,8 +11,6 @@ public class TestCaseReviewTestCase implements Serializable {
private String caseId; private String caseId;
private String status;
private String result; private String result;
private String reviewer; private String reviewer;
@ -25,5 +23,9 @@ public class TestCaseReviewTestCase implements Serializable {
private Long order; private Long order;
private String status;
private Boolean isDel;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -314,76 +314,6 @@ public class TestCaseReviewTestCaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("`status` like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("`status` not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andResultIsNull() { public Criteria andResultIsNull() {
addCriterion("`result` is null"); addCriterion("`result` is null");
return (Criteria) this; return (Criteria) this;
@ -773,6 +703,136 @@ public class TestCaseReviewTestCaseExample {
addCriterion("`order` not between", value1, value2, "order"); addCriterion("`order` not between", value1, value2, "order");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("`status` like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("`status` not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andIsDelIsNull() {
addCriterion("is_del is null");
return (Criteria) this;
}
public Criteria andIsDelIsNotNull() {
addCriterion("is_del is not null");
return (Criteria) this;
}
public Criteria andIsDelEqualTo(Boolean value) {
addCriterion("is_del =", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotEqualTo(Boolean value) {
addCriterion("is_del <>", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelGreaterThan(Boolean value) {
addCriterion("is_del >", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_del >=", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelLessThan(Boolean value) {
addCriterion("is_del <", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelLessThanOrEqualTo(Boolean value) {
addCriterion("is_del <=", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelIn(List<Boolean> values) {
addCriterion("is_del in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotIn(List<Boolean> values) {
addCriterion("is_del not in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelBetween(Boolean value1, Boolean value2) {
addCriterion("is_del between", value1, value2, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_del not between", value1, value2, "isDel");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -15,8 +15,6 @@ public class TestPlanTestCase implements Serializable {
private String executor; private String executor;
private String status;
private String remark; private String remark;
private Long createTime; private Long createTime;
@ -29,5 +27,9 @@ public class TestPlanTestCase implements Serializable {
private Long order; private Long order;
private String status;
private Boolean isDel;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@ -454,76 +454,6 @@ public class TestPlanTestCaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("`status` like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("`status` not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andRemarkIsNull() { public Criteria andRemarkIsNull() {
addCriterion("remark is null"); addCriterion("remark is null");
return (Criteria) this; return (Criteria) this;
@ -903,6 +833,136 @@ public class TestPlanTestCaseExample {
addCriterion("`order` not between", value1, value2, "order"); addCriterion("`order` not between", value1, value2, "order");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStatusIsNull() {
addCriterion("`status` is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("`status` is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(String value) {
addCriterion("`status` =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(String value) {
addCriterion("`status` <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(String value) {
addCriterion("`status` >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(String value) {
addCriterion("`status` >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(String value) {
addCriterion("`status` <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(String value) {
addCriterion("`status` <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLike(String value) {
addCriterion("`status` like", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotLike(String value) {
addCriterion("`status` not like", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<String> values) {
addCriterion("`status` in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<String> values) {
addCriterion("`status` not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(String value1, String value2) {
addCriterion("`status` between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(String value1, String value2) {
addCriterion("`status` not between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andIsDelIsNull() {
addCriterion("is_del is null");
return (Criteria) this;
}
public Criteria andIsDelIsNotNull() {
addCriterion("is_del is not null");
return (Criteria) this;
}
public Criteria andIsDelEqualTo(Boolean value) {
addCriterion("is_del =", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotEqualTo(Boolean value) {
addCriterion("is_del <>", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelGreaterThan(Boolean value) {
addCriterion("is_del >", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelGreaterThanOrEqualTo(Boolean value) {
addCriterion("is_del >=", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelLessThan(Boolean value) {
addCriterion("is_del <", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelLessThanOrEqualTo(Boolean value) {
addCriterion("is_del <=", value, "isDel");
return (Criteria) this;
}
public Criteria andIsDelIn(List<Boolean> values) {
addCriterion("is_del in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotIn(List<Boolean> values) {
addCriterion("is_del not in", values, "isDel");
return (Criteria) this;
}
public Criteria andIsDelBetween(Boolean value1, Boolean value2) {
addCriterion("is_del between", value1, value2, "isDel");
return (Criteria) this;
}
public Criteria andIsDelNotBetween(Boolean value1, Boolean value2) {
addCriterion("is_del not between", value1, value2, "isDel");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -5,13 +5,14 @@
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" jdbcType="VARCHAR" property="id" />
<result column="review_id" jdbcType="VARCHAR" property="reviewId" /> <result column="review_id" jdbcType="VARCHAR" property="reviewId" />
<result column="case_id" jdbcType="VARCHAR" property="caseId" /> <result column="case_id" jdbcType="VARCHAR" property="caseId" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="result" jdbcType="VARCHAR" property="result" /> <result column="result" jdbcType="VARCHAR" property="result" />
<result column="reviewer" jdbcType="VARCHAR" property="reviewer" /> <result column="reviewer" jdbcType="VARCHAR" property="reviewer" />
<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="create_user" jdbcType="VARCHAR" property="createUser" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="order" jdbcType="BIGINT" property="order" /> <result column="order" jdbcType="BIGINT" property="order" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="is_del" jdbcType="BIT" property="isDel" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -72,8 +73,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, review_id, case_id, `status`, `result`, reviewer, create_time, update_time, create_user, id, review_id, case_id, `result`, reviewer, create_time, update_time, create_user,
`order` `order`, `status`, is_del
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseReviewTestCaseExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.base.domain.TestCaseReviewTestCaseExample" resultMap="BaseResultMap">
select select
@ -107,13 +108,13 @@
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReviewTestCase"> <insert id="insert" parameterType="io.metersphere.base.domain.TestCaseReviewTestCase">
insert into test_case_review_test_case (id, review_id, case_id, insert into test_case_review_test_case (id, review_id, case_id,
`status`, `result`, reviewer, `result`, reviewer, create_time,
create_time, update_time, create_user, update_time, create_user, `order`,
`order`) `status`, is_del)
values (#{id,jdbcType=VARCHAR}, #{reviewId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{reviewId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
#{status,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{reviewer,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR}, #{reviewer,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT},
#{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR}, #{order,jdbcType=BIGINT},
#{order,jdbcType=BIGINT}) #{status,jdbcType=VARCHAR}, #{isDel,jdbcType=BIT})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReviewTestCase"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReviewTestCase">
insert into test_case_review_test_case insert into test_case_review_test_case
@ -127,9 +128,6 @@
<if test="caseId != null"> <if test="caseId != null">
case_id, case_id,
</if> </if>
<if test="status != null">
`status`,
</if>
<if test="result != null"> <if test="result != null">
`result`, `result`,
</if> </if>
@ -148,6 +146,12 @@
<if test="order != null"> <if test="order != null">
`order`, `order`,
</if> </if>
<if test="status != null">
`status`,
</if>
<if test="isDel != null">
is_del,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -159,9 +163,6 @@
<if test="caseId != null"> <if test="caseId != null">
#{caseId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
</if> </if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="result != null"> <if test="result != null">
#{result,jdbcType=VARCHAR}, #{result,jdbcType=VARCHAR},
</if> </if>
@ -180,6 +181,12 @@
<if test="order != null"> <if test="order != null">
#{order,jdbcType=BIGINT}, #{order,jdbcType=BIGINT},
</if> </if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="isDel != null">
#{isDel,jdbcType=BIT},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseReviewTestCaseExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.base.domain.TestCaseReviewTestCaseExample" resultType="java.lang.Long">
@ -200,9 +207,6 @@
<if test="record.caseId != null"> <if test="record.caseId != null">
case_id = #{record.caseId,jdbcType=VARCHAR}, case_id = #{record.caseId,jdbcType=VARCHAR},
</if> </if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.result != null"> <if test="record.result != null">
`result` = #{record.result,jdbcType=VARCHAR}, `result` = #{record.result,jdbcType=VARCHAR},
</if> </if>
@ -221,6 +225,12 @@
<if test="record.order != null"> <if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT}, `order` = #{record.order,jdbcType=BIGINT},
</if> </if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=BIT},
</if>
</set> </set>
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -231,13 +241,14 @@
set id = #{record.id,jdbcType=VARCHAR}, set id = #{record.id,jdbcType=VARCHAR},
review_id = #{record.reviewId,jdbcType=VARCHAR}, review_id = #{record.reviewId,jdbcType=VARCHAR},
case_id = #{record.caseId,jdbcType=VARCHAR}, case_id = #{record.caseId,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
`result` = #{record.result,jdbcType=VARCHAR}, `result` = #{record.result,jdbcType=VARCHAR},
reviewer = #{record.reviewer,jdbcType=VARCHAR}, reviewer = #{record.reviewer,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},
create_user = #{record.createUser,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR},
`order` = #{record.order,jdbcType=BIGINT} `order` = #{record.order,jdbcType=BIGINT},
`status` = #{record.status,jdbcType=VARCHAR},
is_del = #{record.isDel,jdbcType=BIT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -251,9 +262,6 @@
<if test="caseId != null"> <if test="caseId != null">
case_id = #{caseId,jdbcType=VARCHAR}, case_id = #{caseId,jdbcType=VARCHAR},
</if> </if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="result != null"> <if test="result != null">
`result` = #{result,jdbcType=VARCHAR}, `result` = #{result,jdbcType=VARCHAR},
</if> </if>
@ -272,6 +280,12 @@
<if test="order != null"> <if test="order != null">
`order` = #{order,jdbcType=BIGINT}, `order` = #{order,jdbcType=BIGINT},
</if> </if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=BIT},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -279,13 +293,14 @@
update test_case_review_test_case update test_case_review_test_case
set review_id = #{reviewId,jdbcType=VARCHAR}, set review_id = #{reviewId,jdbcType=VARCHAR},
case_id = #{caseId,jdbcType=VARCHAR}, case_id = #{caseId,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
`result` = #{result,jdbcType=VARCHAR}, `result` = #{result,jdbcType=VARCHAR},
reviewer = #{reviewer,jdbcType=VARCHAR}, reviewer = #{reviewer,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR},
`order` = #{order,jdbcType=BIGINT} `order` = #{order,jdbcType=BIGINT},
`status` = #{status,jdbcType=VARCHAR},
is_del = #{isDel,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -7,13 +7,14 @@
<result column="case_id" jdbcType="VARCHAR" property="caseId" /> <result column="case_id" jdbcType="VARCHAR" property="caseId" />
<result column="report_id" jdbcType="VARCHAR" property="reportId" /> <result column="report_id" jdbcType="VARCHAR" property="reportId" />
<result column="executor" jdbcType="VARCHAR" property="executor" /> <result column="executor" jdbcType="VARCHAR" property="executor" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="remark" jdbcType="VARCHAR" property="remark" /> <result column="remark" jdbcType="VARCHAR" property="remark" />
<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="create_user" jdbcType="VARCHAR" property="createUser" /> <result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="issues_count" jdbcType="INTEGER" property="issuesCount" /> <result column="issues_count" jdbcType="INTEGER" property="issuesCount" />
<result column="order" jdbcType="BIGINT" property="order" /> <result column="order" jdbcType="BIGINT" property="order" />
<result column="status" jdbcType="VARCHAR" property="status" />
<result column="is_del" jdbcType="BIT" property="isDel" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
<result column="results" jdbcType="LONGVARCHAR" property="results" /> <result column="results" jdbcType="LONGVARCHAR" property="results" />
@ -79,8 +80,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, plan_id, case_id, report_id, executor, `status`, remark, create_time, update_time, id, plan_id, case_id, report_id, executor, remark, create_time, update_time, create_user,
create_user, issues_count, `order` issues_count, `order`, `status`, is_del
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
results, issues, actual_result results, issues, actual_result
@ -135,17 +136,17 @@
</delete> </delete>
<insert id="insert" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs"> <insert id="insert" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
insert into test_plan_test_case (id, plan_id, case_id, insert into test_plan_test_case (id, plan_id, case_id,
report_id, executor, `status`, report_id, executor, remark,
remark, create_time, update_time, create_time, update_time, create_user,
create_user, issues_count, `order`, issues_count, `order`, `status`,
results, issues, actual_result is_del, results, issues,
) actual_result)
values (#{id,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{caseId,jdbcType=VARCHAR},
#{reportId,jdbcType=VARCHAR}, #{executor,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{reportId,jdbcType=VARCHAR}, #{executor,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
#{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, #{createUser,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{issuesCount,jdbcType=INTEGER}, #{order,jdbcType=BIGINT}, #{issuesCount,jdbcType=INTEGER}, #{order,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR},
#{results,jdbcType=LONGVARCHAR}, #{issues,jdbcType=LONGVARCHAR}, #{actualResult,jdbcType=LONGVARCHAR} #{isDel,jdbcType=BIT}, #{results,jdbcType=LONGVARCHAR}, #{issues,jdbcType=LONGVARCHAR},
) #{actualResult,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestPlanTestCaseWithBLOBs">
insert into test_plan_test_case insert into test_plan_test_case
@ -165,9 +166,6 @@
<if test="executor != null"> <if test="executor != null">
executor, executor,
</if> </if>
<if test="status != null">
`status`,
</if>
<if test="remark != null"> <if test="remark != null">
remark, remark,
</if> </if>
@ -186,6 +184,12 @@
<if test="order != null"> <if test="order != null">
`order`, `order`,
</if> </if>
<if test="status != null">
`status`,
</if>
<if test="isDel != null">
is_del,
</if>
<if test="results != null"> <if test="results != null">
results, results,
</if> </if>
@ -212,9 +216,6 @@
<if test="executor != null"> <if test="executor != null">
#{executor,jdbcType=VARCHAR}, #{executor,jdbcType=VARCHAR},
</if> </if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="remark != null"> <if test="remark != null">
#{remark,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR},
</if> </if>
@ -233,6 +234,12 @@
<if test="order != null"> <if test="order != null">
#{order,jdbcType=BIGINT}, #{order,jdbcType=BIGINT},
</if> </if>
<if test="status != null">
#{status,jdbcType=VARCHAR},
</if>
<if test="isDel != null">
#{isDel,jdbcType=BIT},
</if>
<if test="results != null"> <if test="results != null">
#{results,jdbcType=LONGVARCHAR}, #{results,jdbcType=LONGVARCHAR},
</if> </if>
@ -268,9 +275,6 @@
<if test="record.executor != null"> <if test="record.executor != null">
executor = #{record.executor,jdbcType=VARCHAR}, executor = #{record.executor,jdbcType=VARCHAR},
</if> </if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.remark != null"> <if test="record.remark != null">
remark = #{record.remark,jdbcType=VARCHAR}, remark = #{record.remark,jdbcType=VARCHAR},
</if> </if>
@ -289,6 +293,12 @@
<if test="record.order != null"> <if test="record.order != null">
`order` = #{record.order,jdbcType=BIGINT}, `order` = #{record.order,jdbcType=BIGINT},
</if> </if>
<if test="record.status != null">
`status` = #{record.status,jdbcType=VARCHAR},
</if>
<if test="record.isDel != null">
is_del = #{record.isDel,jdbcType=BIT},
</if>
<if test="record.results != null"> <if test="record.results != null">
results = #{record.results,jdbcType=LONGVARCHAR}, results = #{record.results,jdbcType=LONGVARCHAR},
</if> </if>
@ -310,13 +320,14 @@
case_id = #{record.caseId,jdbcType=VARCHAR}, case_id = #{record.caseId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
executor = #{record.executor,jdbcType=VARCHAR}, executor = #{record.executor,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR}, remark = #{record.remark,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},
create_user = #{record.createUser,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR},
issues_count = #{record.issuesCount,jdbcType=INTEGER}, issues_count = #{record.issuesCount,jdbcType=INTEGER},
`order` = #{record.order,jdbcType=BIGINT}, `order` = #{record.order,jdbcType=BIGINT},
`status` = #{record.status,jdbcType=VARCHAR},
is_del = #{record.isDel,jdbcType=BIT},
results = #{record.results,jdbcType=LONGVARCHAR}, results = #{record.results,jdbcType=LONGVARCHAR},
issues = #{record.issues,jdbcType=LONGVARCHAR}, issues = #{record.issues,jdbcType=LONGVARCHAR},
actual_result = #{record.actualResult,jdbcType=LONGVARCHAR} actual_result = #{record.actualResult,jdbcType=LONGVARCHAR}
@ -331,13 +342,14 @@
case_id = #{record.caseId,jdbcType=VARCHAR}, case_id = #{record.caseId,jdbcType=VARCHAR},
report_id = #{record.reportId,jdbcType=VARCHAR}, report_id = #{record.reportId,jdbcType=VARCHAR},
executor = #{record.executor,jdbcType=VARCHAR}, executor = #{record.executor,jdbcType=VARCHAR},
`status` = #{record.status,jdbcType=VARCHAR},
remark = #{record.remark,jdbcType=VARCHAR}, remark = #{record.remark,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},
create_user = #{record.createUser,jdbcType=VARCHAR}, create_user = #{record.createUser,jdbcType=VARCHAR},
issues_count = #{record.issuesCount,jdbcType=INTEGER}, issues_count = #{record.issuesCount,jdbcType=INTEGER},
`order` = #{record.order,jdbcType=BIGINT} `order` = #{record.order,jdbcType=BIGINT},
`status` = #{record.status,jdbcType=VARCHAR},
is_del = #{record.isDel,jdbcType=BIT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -357,9 +369,6 @@
<if test="executor != null"> <if test="executor != null">
executor = #{executor,jdbcType=VARCHAR}, executor = #{executor,jdbcType=VARCHAR},
</if> </if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="remark != null"> <if test="remark != null">
remark = #{remark,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR},
</if> </if>
@ -378,6 +387,12 @@
<if test="order != null"> <if test="order != null">
`order` = #{order,jdbcType=BIGINT}, `order` = #{order,jdbcType=BIGINT},
</if> </if>
<if test="status != null">
`status` = #{status,jdbcType=VARCHAR},
</if>
<if test="isDel != null">
is_del = #{isDel,jdbcType=BIT},
</if>
<if test="results != null"> <if test="results != null">
results = #{results,jdbcType=LONGVARCHAR}, results = #{results,jdbcType=LONGVARCHAR},
</if> </if>
@ -396,13 +411,14 @@
case_id = #{caseId,jdbcType=VARCHAR}, case_id = #{caseId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR}, report_id = #{reportId,jdbcType=VARCHAR},
executor = #{executor,jdbcType=VARCHAR}, executor = #{executor,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR},
issues_count = #{issuesCount,jdbcType=INTEGER}, issues_count = #{issuesCount,jdbcType=INTEGER},
`order` = #{order,jdbcType=BIGINT}, `order` = #{order,jdbcType=BIGINT},
`status` = #{status,jdbcType=VARCHAR},
is_del = #{isDel,jdbcType=BIT},
results = #{results,jdbcType=LONGVARCHAR}, results = #{results,jdbcType=LONGVARCHAR},
issues = #{issues,jdbcType=LONGVARCHAR}, issues = #{issues,jdbcType=LONGVARCHAR},
actual_result = #{actualResult,jdbcType=LONGVARCHAR} actual_result = #{actualResult,jdbcType=LONGVARCHAR}
@ -414,13 +430,14 @@
case_id = #{caseId,jdbcType=VARCHAR}, case_id = #{caseId,jdbcType=VARCHAR},
report_id = #{reportId,jdbcType=VARCHAR}, report_id = #{reportId,jdbcType=VARCHAR},
executor = #{executor,jdbcType=VARCHAR}, executor = #{executor,jdbcType=VARCHAR},
`status` = #{status,jdbcType=VARCHAR},
remark = #{remark,jdbcType=VARCHAR}, remark = #{remark,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=BIGINT}, create_time = #{createTime,jdbcType=BIGINT},
update_time = #{updateTime,jdbcType=BIGINT}, update_time = #{updateTime,jdbcType=BIGINT},
create_user = #{createUser,jdbcType=VARCHAR}, create_user = #{createUser,jdbcType=VARCHAR},
issues_count = #{issuesCount,jdbcType=INTEGER}, issues_count = #{issuesCount,jdbcType=INTEGER},
`order` = #{order,jdbcType=BIGINT} `order` = #{order,jdbcType=BIGINT},
`status` = #{status,jdbcType=VARCHAR},
is_del = #{isDel,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
</mapper> </mapper>

View File

@ -334,9 +334,8 @@
</select> </select>
<select id="testPlanTestCaseCount" resultType="io.metersphere.api.dto.definition.ParamsDTO"> <select id="testPlanTestCaseCount" resultType="io.metersphere.api.dto.definition.ParamsDTO">
select t.plan_id as id, COUNT(*) as value from test_plan_test_case t select t.plan_id as id, COUNT(*) as value from test_plan_test_case t
inner join test_case on t.case_id = test_case.id
<where> <where>
(test_case.status != 'Trash' or test_case.status is null ) t.is_del = 0
<if test="planIds != null and planIds.size() > 0"> <if test="planIds != null and planIds.size() > 0">
and t.plan_id IN and t.plan_id IN
<foreach collection="planIds" item="id" separator="," open="(" close=")"> <foreach collection="planIds" item="id" separator="," open="(" close=")">

View File

@ -2,10 +2,7 @@ package io.metersphere.base.mapper.ext;
import io.metersphere.base.domain.TestCase; import io.metersphere.base.domain.TestCase;
import io.metersphere.controller.request.BaseQueryRequest; import io.metersphere.controller.request.BaseQueryRequest;
import io.metersphere.track.dto.PlanReportCaseDTO; import io.metersphere.track.dto.*;
import io.metersphere.track.dto.TestCaseReportStatusResultDTO;
import io.metersphere.track.dto.TestCaseTestDTO;
import io.metersphere.track.dto.TestPlanCaseDTO;
import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest; import io.metersphere.track.request.testplancase.QueryTestPlanCaseRequest;
import io.metersphere.track.request.testplancase.TestPlanFuncCaseConditions; import io.metersphere.track.request.testplancase.TestPlanFuncCaseConditions;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -72,4 +69,6 @@ public interface ExtTestPlanTestCaseMapper {
Long getLastOrder(@Param("planId") String planId, @Param("baseOrder") Long baseOrder); Long getLastOrder(@Param("planId") String planId, @Param("baseOrder") Long baseOrder);
List<TestCase> getTestCaseWithNodeInfo(@Param("planId") String planId); List<TestCase> getTestCaseWithNodeInfo(@Param("planId") String planId);
List<CountMapDTO> getExecResultMapByPlanId(@Param("planId") String planId);
} }

View File

@ -242,20 +242,17 @@
select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority, select test_plan_test_case.id as id, test_case.id as caseId, test_case.name, test_case.priority,
test_case.type, test_case.test_id as testId,test_case.node_id, test_case.tags, test_case.maintainer, test_case.type, test_case.test_id as testId,test_case.node_id, test_case.tags, test_case.maintainer,
test_case.custom_fields, test_case.custom_fields,
test_case.node_path, test_case.method, if(pa.type_value = 'false', cast(test_case.num as char), test_case.node_path, test_case.method,
test_case.custom_num) as customNum, test_plan_test_case.executor, test_plan_test_case.status, test_case.num, test_case.custom_num,
test_case.project_id,
test_plan_test_case.executor, test_plan_test_case.status,
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,
projectName, test_plan_test_case.issues_count as issuesCount, test_plan_test_case.issues_count as issuesCount,
test_plan_test_case.plan_id as planId,test_case.version_id as versionId, test_plan_test_case.plan_id as planId,
project_version.name as versionName test_case.version_id as versionId
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
inner join project on project.id = test_case.project_id
inner join project_application pa on pa.project_id = project.id and pa.type = 'CASE_CUSTOM_NUM'
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
@ -531,8 +528,6 @@
</if> </if>
</update> </update>
<delete id="deleteByTestCaseID" parameterType="java.lang.String"> <delete id="deleteByTestCaseID" parameterType="java.lang.String">
delete delete
from test_plan_api_case from test_plan_api_case
@ -572,6 +567,12 @@
join test_case tc on tptc.case_id = tc.id join test_case tc on tptc.case_id = tc.id
where tptc.plan_id = #{planId} where tptc.plan_id = #{planId}
</select> </select>
<select id="getExecResultMapByPlanId" resultType="io.metersphere.track.dto.CountMapDTO">
select status as `key`, count(*) as `value`
from test_plan_test_case
where plan_id = #{planId} and is_del = 0
group by status
</select>
<sql id="queryVersionCondition"> <sql id="queryVersionCondition">
<if test="request.versionId != null"> <if test="request.versionId != null">

View File

@ -1,5 +1,6 @@
package io.metersphere.base.mapper.ext; package io.metersphere.base.mapper.ext;
import io.metersphere.track.dto.CountMapDTO;
import io.metersphere.track.dto.TestReviewCaseDTO; import io.metersphere.track.dto.TestReviewCaseDTO;
import io.metersphere.track.request.testreview.QueryCaseReviewRequest; import io.metersphere.track.request.testreview.QueryCaseReviewRequest;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -15,14 +16,6 @@ public interface ExtTestReviewCaseMapper {
List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId); List<String> findRelateTestReviewId(@Param("userId") String userId, @Param("workspaceId") String workspaceId, @Param("projectId") String projectId);
/**
* 根据项目 ids 查询 TestReviewCaseDTO 列表
*
* @param ids project id list
* @return List<TestReviewCaseDTO>
*/
List<TestReviewCaseDTO> listTestCaseByProjectIds(@Param("ids") List<String> ids);
/** /**
* 获取 TestReviewTestCase 详细信息 * 获取 TestReviewTestCase 详细信息
* *
@ -45,4 +38,6 @@ public interface ExtTestReviewCaseMapper {
Long getPreOrder(@Param("reviewId")String reviewId, @Param("baseOrder") Long baseOrder); Long getPreOrder(@Param("reviewId")String reviewId, @Param("baseOrder") Long baseOrder);
Long getLastOrder(@Param("reviewId")String reviewId, @Param("baseOrder") Long baseOrder); Long getLastOrder(@Param("reviewId")String reviewId, @Param("baseOrder") Long baseOrder);
List<CountMapDTO> getStatusMapByReviewId(@Param("reviewId") String reviewId);
} }

View File

@ -95,7 +95,6 @@
</include> </include>
</if> </if>
</sql> </sql>
<select id="list" resultType="io.metersphere.track.dto.TestReviewCaseDTO"> <select id="list" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select test_case_review_test_case.id as id, test_case_review_test_case.reviewer, select test_case_review_test_case.id as id, test_case_review_test_case.reviewer,
test_case_review_test_case.update_time, test_case_review_test_case.review_id as reviewId, test_case_review_test_case.update_time, test_case_review_test_case.review_id as reviewId,
@ -172,6 +171,7 @@
<property name="versionTable" value="test_case"/> <property name="versionTable" value="test_case"/>
</include> </include>
<include refid="filter"/> <include refid="filter"/>
and test_case_review_test_case.is_del = 0
</where> </where>
</sql> </sql>
<sql id="filter"> <sql id="filter">
@ -417,14 +417,6 @@
and project.workspace_id = #{workspaceId} and project.workspace_id = #{workspaceId}
and test_case_review.project_id = #{projectId} and test_case_review.project_id = #{projectId}
</select> </select>
<select id="listTestCaseByProjectIds" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select distinct * from test_case_review_test_case, test_case
where test_case_review_test_case.case_id = test_case.id
and test_case.project_id in
<foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</select>
<select id="listForMinder" resultType="io.metersphere.track.dto.TestReviewCaseDTO"> <select id="listForMinder" resultType="io.metersphere.track.dto.TestReviewCaseDTO">
select tcrtc.id as id, select tcrtc.id as id,
tcrtc.review_id as reviewId, tcrtc.review_id as reviewId,
@ -466,6 +458,12 @@
</if> </if>
order by `order` desc limit 1; order by `order` desc limit 1;
</select> </select>
<select id="getStatusMapByReviewId" resultType="io.metersphere.track.dto.CountMapDTO">
select status as `key`, count(*) as `value`
from test_case_review_test_case
where review_id = #{reviewId} and is_del = 0
group by status
</select>
<sql id="queryVersionCondition"> <sql id="queryVersionCondition">
<if test="request.versionId != null"> <if test="request.versionId != null">

View File

@ -0,0 +1,5 @@
package io.metersphere.commons.constants;
public enum FunctionCaseStatus {
Trash, Prepare, Underway, Completed
}

View File

@ -0,0 +1,9 @@
package io.metersphere.track.dto;
import lombok.Data;
@Data
public class CountMapDTO {
private String key;
private Integer value;
}

View File

@ -26,9 +26,9 @@ 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.CountMapDTO;
import io.metersphere.track.dto.TestCaseDTO; 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.TestReviewDTOWithMetric; import io.metersphere.track.dto.TestReviewDTOWithMetric;
import io.metersphere.track.request.testreview.*; import io.metersphere.track.request.testreview.*;
import org.apache.commons.beanutils.BeanMap; import org.apache.commons.beanutils.BeanMap;
@ -446,25 +446,11 @@ public class TestCaseReviewService {
request.setProjectId(projectId); request.setProjectId(projectId);
request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), workspaceId, projectId)); request.setReviewIds(extTestReviewCaseMapper.findRelateTestReviewId(user.getId(), workspaceId, projectId));
List<String> projectIds = extProjectMapper.getProjectIdByWorkspaceId(workspaceId);
List<TestReviewDTOWithMetric> testReviews = extTestCaseReviewMapper.listRelate(request); List<TestReviewDTOWithMetric> testReviews = extTestCaseReviewMapper.listRelate(request);
Map<String, List<TestReviewCaseDTO>> testCaseMap = new HashMap<>();
listTestCaseByProjectIds(projectIds).forEach(testCase -> {
List<TestReviewCaseDTO> list = testCaseMap.get(testCase.getReviewId());
if (list == null) {
list = new ArrayList<>();
list.add(testCase);
testCaseMap.put(testCase.getReviewId(), list);
} else {
list.add(testCase);
}
});
if (!CollectionUtils.isEmpty(testReviews)) { if (!CollectionUtils.isEmpty(testReviews)) {
testReviews.forEach(testReview -> { testReviews.forEach(testReview -> {
List<TestReviewCaseDTO> testCases = testCaseMap.get(testReview.getId()); List<CountMapDTO> countMapDTOS = extTestReviewCaseMapper.getStatusMapByReviewId(testReview.getId());
TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample(); TestCaseReviewUsersExample testCaseReviewUsersExample = new TestCaseReviewUsersExample();
testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(testReview.getId()); testCaseReviewUsersExample.createCriteria().andReviewIdEqualTo(testReview.getId());
@ -481,18 +467,15 @@ public class TestCaseReviewService {
testReview.setReviewed(0); testReview.setReviewed(0);
testReview.setTotal(0); testReview.setTotal(0);
testReview.setPass(0); testReview.setPass(0);
if (testCases != null) { countMapDTOS.forEach(item -> {
testReview.setTotal(testCases.size()); testReview.setTotal(testReview.getTotal() + item.getValue());
testCases.forEach(testCase -> { if (!StringUtils.equals(item.getKey(), TestReviewCaseStatus.Prepare.name())) {
if (!StringUtils.equals(testCase.getReviewStatus(), TestReviewCaseStatus.Prepare.name())) {
testReview.setReviewed(testReview.getReviewed() + 1); testReview.setReviewed(testReview.getReviewed() + 1);
} }
if (StringUtils.equals(testCase.getReviewStatus(), TestReviewCaseStatus.Pass.name())) { if (StringUtils.equals(item.getKey(), TestReviewCaseStatus.Pass.name())) {
testReview.setPass(testReview.getPass() + 1); testReview.setPass(testReview.getPass() + 1);
} }
}); });
}
}); });
} }
return testReviews; return testReviews;
@ -519,13 +502,6 @@ public class TestCaseReviewService {
return name; return name;
} }
private List<TestReviewCaseDTO> listTestCaseByProjectIds(List<String> projectIds) {
if (CollectionUtils.isEmpty(projectIds)) {
return new ArrayList<>();
}
return extTestReviewCaseMapper.listTestCaseByProjectIds(projectIds);
}
/*编辑,新建,完成,删除通知内容*/ /*编辑,新建,完成,删除通知内容*/
private String getReviewContext(SaveTestCaseReviewRequest reviewRequest, String type) { private String getReviewContext(SaveTestCaseReviewRequest reviewRequest, String type) {

View File

@ -163,6 +163,12 @@ public class TestCaseService {
@Lazy @Lazy
@Resource @Resource
private ProjectApplicationService projectApplicationService; private ProjectApplicationService projectApplicationService;
@Lazy
@Resource
private TestPlanTestCaseService testPlanTestCaseService;
@Lazy
@Resource
private TestReviewTestCaseService testReviewTestCaseService;
private ThreadLocal<Integer> importCreateNum = new ThreadLocal<>(); private ThreadLocal<Integer> importCreateNum = new ThreadLocal<>();
private ThreadLocal<Integer> beforeImportCreateNum = new ThreadLocal<>(); private ThreadLocal<Integer> beforeImportCreateNum = new ThreadLocal<>();
@ -627,6 +633,8 @@ public class TestCaseService {
DeleteTestCaseRequest request = new DeleteTestCaseRequest(); DeleteTestCaseRequest request = new DeleteTestCaseRequest();
BeanUtils.copyBean(request, testCase); BeanUtils.copyBean(request, testCase);
testPlanTestCaseService.deleteToGc(Arrays.asList(testCaseId));
testReviewTestCaseService.deleteToGc(Arrays.asList(testCaseId));
return extTestCaseMapper.deleteToGc(request); return extTestCaseMapper.deleteToGc(request);
} }
@ -643,6 +651,8 @@ public class TestCaseService {
DeleteTestCaseRequest request = new DeleteTestCaseRequest(); DeleteTestCaseRequest request = new DeleteTestCaseRequest();
BeanUtils.copyBean(request, testCase); BeanUtils.copyBean(request, testCase);
request.setIds(ids); request.setIds(ids);
testPlanTestCaseService.deleteToGc(ids);
testReviewTestCaseService.deleteToGc(ids);
return extTestCaseMapper.deleteToGc(request); return extTestCaseMapper.deleteToGc(request);
} }
@ -2202,12 +2212,11 @@ public class TestCaseService {
} }
public void reduction(TestCaseBatchRequest request) { public void reduction(TestCaseBatchRequest request) {
TestCaseExample example = this.getBatchExample(request);
if (CollectionUtils.isNotEmpty(request.getIds())) { if (CollectionUtils.isNotEmpty(request.getIds())) {
extTestCaseMapper.checkOriginalStatusByIds(request.getIds()); extTestCaseMapper.checkOriginalStatusByIds(request.getIds());
//检查原来模块是否还在 //检查原来模块是否还在
example = new TestCaseExample(); TestCaseExample example = new TestCaseExample();
// 关联版本之后必须查询每一个数据的所有版本依次还原 // 关联版本之后必须查询每一个数据的所有版本依次还原
example.createCriteria().andIdIn(request.getIds()); example.createCriteria().andIdIn(request.getIds());
List<TestCase> reductionCaseList = testCaseMapper.selectByExample(example); List<TestCase> reductionCaseList = testCaseMapper.selectByExample(example);
@ -2236,6 +2245,8 @@ public class TestCaseService {
} }
} }
extTestCaseMapper.reduction(request.getIds()); extTestCaseMapper.reduction(request.getIds());
testPlanTestCaseService.reduction(request.getIds());
testReviewTestCaseService.reduction(request.getIds());
} }
} }

View File

@ -373,16 +373,19 @@ public class TestPlanService {
testPlan.setPassed(0); testPlan.setPassed(0);
testPlan.setTotal(0); testPlan.setTotal(0);
List<String> functionalExecResults = extTestPlanTestCaseMapper.getExecResultByPlanId(testPlan.getId()); List<CountMapDTO> statusCountMap = extTestPlanTestCaseMapper.getExecResultMapByPlanId(testPlan.getId());
functionalExecResults.forEach(item -> { Integer functionalExecTotal = 0;
if (!StringUtils.equals(item, TestPlanTestCaseStatus.Prepare.name())
&& !StringUtils.equals(item, TestPlanTestCaseStatus.Underway.name())) { for (CountMapDTO item : statusCountMap) {
testPlan.setTested(testPlan.getTested() + 1); functionalExecTotal++;
if (StringUtils.equals(item, TestPlanTestCaseStatus.Pass.name())) { if (!StringUtils.equals(item.getKey(), TestPlanTestCaseStatus.Prepare.name())
testPlan.setPassed(testPlan.getPassed() + 1); && !StringUtils.equals(item.getKey(), TestPlanTestCaseStatus.Underway.name())) {
testPlan.setTested(testPlan.getTested() + item.getValue());
if (StringUtils.equals(item.getKey(), TestPlanTestCaseStatus.Pass.name())) {
testPlan.setPassed(testPlan.getPassed() + item.getValue());
}
} }
} }
});
List<String> apiExecResults = testPlanApiCaseService.getExecResultByPlanId(testPlan.getId()); List<String> apiExecResults = testPlanApiCaseService.getExecResultByPlanId(testPlan.getId());
apiExecResults.forEach(item -> { apiExecResults.forEach(item -> {
@ -414,7 +417,7 @@ public class TestPlanService {
} }
}); });
testPlan.setTotal(apiExecResults.size() + scenarioExecResults.size() + functionalExecResults.size() + loadResults.size()); testPlan.setTotal(apiExecResults.size() + scenarioExecResults.size() + functionalExecTotal + loadResults.size());
testPlan.setPassRate(MathUtils.getPercentWithDecimal(testPlan.getTested() == 0 ? 0 : testPlan.getPassed() * 1.0 / testPlan.getTotal())); testPlan.setPassRate(MathUtils.getPercentWithDecimal(testPlan.getTested() == 0 ? 0 : testPlan.getPassed() * 1.0 / testPlan.getTotal()));
testPlan.setTestRate(MathUtils.getPercentWithDecimal(testPlan.getTotal() == 0 ? 0 : testPlan.getTested() * 1.0 / testPlan.getTotal())); testPlan.setTestRate(MathUtils.getPercentWithDecimal(testPlan.getTotal() == 0 ? 0 : testPlan.getTested() * 1.0 / testPlan.getTotal()));

View File

@ -17,6 +17,7 @@ import io.metersphere.dto.ProjectConfig;
import io.metersphere.log.vo.DetailColumn; import io.metersphere.log.vo.DetailColumn;
import io.metersphere.log.vo.OperatingLogDetails; import io.metersphere.log.vo.OperatingLogDetails;
import io.metersphere.service.ProjectApplicationService; import io.metersphere.service.ProjectApplicationService;
import io.metersphere.service.ProjectService;
import io.metersphere.service.UserService; import io.metersphere.service.UserService;
import io.metersphere.track.dto.*; import io.metersphere.track.dto.*;
import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest; import io.metersphere.track.request.testcase.TestPlanCaseBatchRequest;
@ -70,7 +71,7 @@ public class TestPlanTestCaseService {
@Resource @Resource
private TestCaseService testCaseService; private TestCaseService testCaseService;
@Resource @Resource
private TestCaseIssueService testCaseIssueService; private ProjectService projectService;
@Resource @Resource
private ProjectApplicationService projectApplicationService; private ProjectApplicationService projectApplicationService;
@ -87,6 +88,22 @@ public class TestPlanTestCaseService {
public List<TestPlanCaseDTO> list(QueryTestPlanCaseRequest request) { public List<TestPlanCaseDTO> list(QueryTestPlanCaseRequest request) {
request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders())); request.setOrders(ServiceUtils.getDefaultSortOrder(request.getOrders()));
List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.list(request); List<TestPlanCaseDTO> list = extTestPlanTestCaseMapper.list(request);
if (CollectionUtils.isEmpty(list)) {
return list;
}
Project project = projectService.getProjectById(list.get(0).getProjectId());
ProjectApplication projectApplication = projectApplicationService.getProjectApplication(project.getId(), "CASE_CUSTOM_NUM");
list.forEach(item -> {
// 设置项目名称
item.setProjectName(project.getName());
if (StringUtils.equals(projectApplication.getTypeValue(), "false")) {
// 如果配置是不启用自定义字段则设置为 num
item.setCustomNum(item.getNum().toString());
}
});
// 设置版本信息
ServiceUtils.buildVersionInfo(list);
QueryMemberRequest queryMemberRequest = new QueryMemberRequest(); QueryMemberRequest queryMemberRequest = new QueryMemberRequest();
queryMemberRequest.setProjectId(request.getProjectId()); queryMemberRequest.setProjectId(request.getProjectId());
Map<String, String> userMap = userService.getProjectMemberList(queryMemberRequest) Map<String, String> userMap = userService.getProjectMemberList(queryMemberRequest)
@ -127,6 +144,21 @@ public class TestPlanTestCaseService {
return testPlanTestCaseMapper.deleteByPrimaryKey(id); return testPlanTestCaseMapper.deleteByPrimaryKey(id);
} }
public int deleteToGc(List<String> caseIds) {
return updateIsDel(caseIds, true);
}
private int updateIsDel(List<String> caseIds, Boolean isDel) {
if (CollectionUtils.isNotEmpty(caseIds)) {
TestPlanTestCaseExample example = new TestPlanTestCaseExample();
example.createCriteria().andCaseIdIn(caseIds);
TestPlanTestCaseWithBLOBs record = new TestPlanTestCaseWithBLOBs();
record.setIsDel(isDel);
return testPlanTestCaseMapper.updateByExampleSelective(record, example);
}
return 0;
}
public void editTestCaseBath(TestPlanCaseBatchRequest request) { public void editTestCaseBath(TestPlanCaseBatchRequest request) {
TestPlanTestCaseExample testPlanTestCaseExample = getBatchExample(request); TestPlanTestCaseExample testPlanTestCaseExample = getBatchExample(request);
TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs(); TestPlanTestCaseWithBLOBs testPlanTestCase = new TestPlanTestCaseWithBLOBs();
@ -452,4 +484,7 @@ public class TestPlanTestCaseService {
testPlanTestCaseMapper::updateByPrimaryKeySelective); testPlanTestCaseMapper::updateByPrimaryKeySelective);
} }
public int reduction(List<String> caseIds) {
return updateIsDel(caseIds, false);
}
} }

View File

@ -107,6 +107,21 @@ public class TestReviewTestCaseService {
return testCaseReviewTestCaseMapper.deleteByPrimaryKey(request.getId()); return testCaseReviewTestCaseMapper.deleteByPrimaryKey(request.getId());
} }
public int deleteToGc(List<String> caseIds) {
return updateIsDel(caseIds, true);
}
private int updateIsDel(List<String> caseIds, Boolean isDel) {
if (CollectionUtils.isEmpty(caseIds)) {
return 0;
}
TestCaseReviewTestCaseExample example = new TestCaseReviewTestCaseExample();
example.createCriteria().andCaseIdIn(caseIds);
TestCaseReviewTestCase record = new TestCaseReviewTestCase();
record.setIsDel(isDel);
return testCaseReviewTestCaseMapper.updateByExampleSelective(record, example);
}
private void checkReviewer(String reviewId) { private void checkReviewer(String reviewId) {
List<String> userIds = testCaseReviewService.getTestCaseReviewerIds(reviewId); List<String> userIds = testCaseReviewService.getTestCaseReviewerIds(reviewId);
String currentId = SessionUtils.getUser().getId(); String currentId = SessionUtils.getUser().getId();
@ -368,4 +383,8 @@ public class TestReviewTestCaseService {
extTestReviewCaseMapper::getLastOrder, extTestReviewCaseMapper::getLastOrder,
testCaseReviewTestCaseMapper::updateByPrimaryKeySelective); testCaseReviewTestCaseMapper::updateByPrimaryKeySelective);
} }
public int reduction(List<String> ids) {
return updateIsDel(ids, false);
}
} }

View File

@ -10,6 +10,7 @@ import io.metersphere.commons.utils.DateUtils;
import io.metersphere.commons.utils.MathUtils; import io.metersphere.commons.utils.MathUtils;
import io.metersphere.performance.base.ChartsData; import io.metersphere.performance.base.ChartsData;
import io.metersphere.service.ProjectService; import io.metersphere.service.ProjectService;
import io.metersphere.track.dto.CountMapDTO;
import io.metersphere.track.dto.TestPlanDTOWithMetric; import io.metersphere.track.dto.TestPlanDTOWithMetric;
import io.metersphere.track.response.BugStatustics; import io.metersphere.track.response.BugStatustics;
import io.metersphere.track.response.TestPlanBugCount; import io.metersphere.track.response.TestPlanBugCount;
@ -168,16 +169,16 @@ public class TrackService {
testPlan.setPassed(0); testPlan.setPassed(0);
testPlan.setTotal(0); testPlan.setTotal(0);
List<String> functionalExecResults = extTestPlanTestCaseMapper.getExecResultByPlanId(planId); List<CountMapDTO> statusCountMap = extTestPlanTestCaseMapper.getExecResultMapByPlanId(testPlan.getId());
functionalExecResults.forEach(item -> { for (CountMapDTO item : statusCountMap) {
if (!StringUtils.equals(item, TestPlanTestCaseStatus.Prepare.name()) if (!StringUtils.equals(item.getKey(), TestPlanTestCaseStatus.Prepare.name())
&& !StringUtils.equals(item, TestPlanTestCaseStatus.Underway.name())) { && !StringUtils.equals(item.getKey(), TestPlanTestCaseStatus.Underway.name())) {
testPlan.setTested(testPlan.getTested() + 1); testPlan.setTested(testPlan.getTested() + item.getValue());
if (StringUtils.equals(item, TestPlanTestCaseStatus.Pass.name())) { if (StringUtils.equals(item.getKey(), TestPlanTestCaseStatus.Pass.name())) {
testPlan.setPassed(testPlan.getPassed() + 1); testPlan.setPassed(testPlan.getPassed() + item.getValue());
}
} }
} }
});
List<String> apiExecResults = testPlanApiCaseService.getExecResultByPlanId(planId); List<String> apiExecResults = testPlanApiCaseService.getExecResultByPlanId(planId);
apiExecResults.forEach(item -> { apiExecResults.forEach(item -> {