feat(测试计划): 补充计划报告用例明细缺陷数

This commit is contained in:
song-cc-rock 2024-09-03 11:44:23 +08:00 committed by Craftsman
parent d3580a2146
commit c35d1cd8b3
16 changed files with 250 additions and 47 deletions

View File

@ -73,6 +73,10 @@ public class TestPlanReportApiCase implements Serializable {
@Schema(description = "测试计划名称") @Schema(description = "测试计划名称")
private String testPlanName; private String testPlanName;
@Schema(description = "接口用例关联缺陷数", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_plan_report_api_case.api_case_bug_count.not_blank}", groups = {Created.class})
private Long apiCaseBugCount;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
@ -90,7 +94,8 @@ public class TestPlanReportApiCase implements Serializable {
apiCaseExecuteResult("api_case_execute_result", "apiCaseExecuteResult", "VARCHAR", false), apiCaseExecuteResult("api_case_execute_result", "apiCaseExecuteResult", "VARCHAR", false),
apiCaseExecuteReportId("api_case_execute_report_id", "apiCaseExecuteReportId", "VARCHAR", false), apiCaseExecuteReportId("api_case_execute_report_id", "apiCaseExecuteReportId", "VARCHAR", false),
pos("pos", "pos", "BIGINT", false), pos("pos", "pos", "BIGINT", false),
testPlanName("test_plan_name", "testPlanName", "VARCHAR", false); testPlanName("test_plan_name", "testPlanName", "VARCHAR", false),
apiCaseBugCount("api_case_bug_count", "apiCaseBugCount", "BIGINT", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -1133,6 +1133,66 @@ public class TestPlanReportApiCaseExample {
addCriterion("test_plan_name not between", value1, value2, "testPlanName"); addCriterion("test_plan_name not between", value1, value2, "testPlanName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andApiCaseBugCountIsNull() {
addCriterion("api_case_bug_count is null");
return (Criteria) this;
}
public Criteria andApiCaseBugCountIsNotNull() {
addCriterion("api_case_bug_count is not null");
return (Criteria) this;
}
public Criteria andApiCaseBugCountEqualTo(Long value) {
addCriterion("api_case_bug_count =", value, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountNotEqualTo(Long value) {
addCriterion("api_case_bug_count <>", value, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountGreaterThan(Long value) {
addCriterion("api_case_bug_count >", value, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountGreaterThanOrEqualTo(Long value) {
addCriterion("api_case_bug_count >=", value, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountLessThan(Long value) {
addCriterion("api_case_bug_count <", value, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountLessThanOrEqualTo(Long value) {
addCriterion("api_case_bug_count <=", value, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountIn(List<Long> values) {
addCriterion("api_case_bug_count in", values, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountNotIn(List<Long> values) {
addCriterion("api_case_bug_count not in", values, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountBetween(Long value1, Long value2) {
addCriterion("api_case_bug_count between", value1, value2, "apiCaseBugCount");
return (Criteria) this;
}
public Criteria andApiCaseBugCountNotBetween(Long value1, Long value2) {
addCriterion("api_case_bug_count not between", value1, value2, "apiCaseBugCount");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -76,6 +76,10 @@ public class TestPlanReportApiScenario implements Serializable {
@Schema(description = "测试计划名称") @Schema(description = "测试计划名称")
private String testPlanName; private String testPlanName;
@Schema(description = "场景用例关联缺陷数", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_plan_report_api_scenario.api_scenario_bug_count.not_blank}", groups = {Created.class})
private Long apiScenarioBugCount;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
@ -94,7 +98,8 @@ public class TestPlanReportApiScenario implements Serializable {
apiScenarioExecuteResult("api_scenario_execute_result", "apiScenarioExecuteResult", "VARCHAR", false), apiScenarioExecuteResult("api_scenario_execute_result", "apiScenarioExecuteResult", "VARCHAR", false),
apiScenarioExecuteReportId("api_scenario_execute_report_id", "apiScenarioExecuteReportId", "VARCHAR", false), apiScenarioExecuteReportId("api_scenario_execute_report_id", "apiScenarioExecuteReportId", "VARCHAR", false),
pos("pos", "pos", "BIGINT", false), pos("pos", "pos", "BIGINT", false),
testPlanName("test_plan_name", "testPlanName", "VARCHAR", false); testPlanName("test_plan_name", "testPlanName", "VARCHAR", false),
apiScenarioBugCount("api_scenario_bug_count", "apiScenarioBugCount", "BIGINT", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -1193,6 +1193,66 @@ public class TestPlanReportApiScenarioExample {
addCriterion("test_plan_name not between", value1, value2, "testPlanName"); addCriterion("test_plan_name not between", value1, value2, "testPlanName");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andApiScenarioBugCountIsNull() {
addCriterion("api_scenario_bug_count is null");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountIsNotNull() {
addCriterion("api_scenario_bug_count is not null");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountEqualTo(Long value) {
addCriterion("api_scenario_bug_count =", value, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountNotEqualTo(Long value) {
addCriterion("api_scenario_bug_count <>", value, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountGreaterThan(Long value) {
addCriterion("api_scenario_bug_count >", value, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountGreaterThanOrEqualTo(Long value) {
addCriterion("api_scenario_bug_count >=", value, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountLessThan(Long value) {
addCriterion("api_scenario_bug_count <", value, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountLessThanOrEqualTo(Long value) {
addCriterion("api_scenario_bug_count <=", value, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountIn(List<Long> values) {
addCriterion("api_scenario_bug_count in", values, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountNotIn(List<Long> values) {
addCriterion("api_scenario_bug_count not in", values, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountBetween(Long value1, Long value2) {
addCriterion("api_scenario_bug_count between", value1, value2, "apiScenarioBugCount");
return (Criteria) this;
}
public Criteria andApiScenarioBugCountNotBetween(Long value1, Long value2) {
addCriterion("api_scenario_bug_count not between", value1, value2, "apiScenarioBugCount");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -17,6 +17,7 @@
<result column="api_case_execute_report_id" jdbcType="VARCHAR" property="apiCaseExecuteReportId" /> <result column="api_case_execute_report_id" jdbcType="VARCHAR" property="apiCaseExecuteReportId" />
<result column="pos" jdbcType="BIGINT" property="pos" /> <result column="pos" jdbcType="BIGINT" property="pos" />
<result column="test_plan_name" jdbcType="VARCHAR" property="testPlanName" /> <result column="test_plan_name" jdbcType="VARCHAR" property="testPlanName" />
<result column="api_case_bug_count" jdbcType="BIGINT" property="apiCaseBugCount" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -79,7 +80,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, test_plan_report_id, test_plan_collection_id, environment_id, test_plan_api_case_id, id, test_plan_report_id, test_plan_collection_id, environment_id, test_plan_api_case_id,
api_case_id, api_case_num, api_case_name, api_case_module, api_case_priority, api_case_execute_user, api_case_id, api_case_num, api_case_name, api_case_module, api_case_priority, api_case_execute_user,
api_case_execute_result, api_case_execute_report_id, pos, test_plan_name api_case_execute_result, api_case_execute_report_id, pos, test_plan_name, api_case_bug_count
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiCaseExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiCaseExample" resultMap="BaseResultMap">
select select
@ -116,14 +117,14 @@
environment_id, test_plan_api_case_id, api_case_id, environment_id, test_plan_api_case_id, api_case_id,
api_case_num, api_case_name, api_case_module, api_case_num, api_case_name, api_case_module,
api_case_priority, api_case_execute_user, api_case_execute_result, api_case_priority, api_case_execute_user, api_case_execute_result,
api_case_execute_report_id, pos, test_plan_name api_case_execute_report_id, pos, test_plan_name,
) api_case_bug_count)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR},
#{environmentId,jdbcType=VARCHAR}, #{testPlanApiCaseId,jdbcType=VARCHAR}, #{apiCaseId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{testPlanApiCaseId,jdbcType=VARCHAR}, #{apiCaseId,jdbcType=VARCHAR},
#{apiCaseNum,jdbcType=BIGINT}, #{apiCaseName,jdbcType=VARCHAR}, #{apiCaseModule,jdbcType=VARCHAR}, #{apiCaseNum,jdbcType=BIGINT}, #{apiCaseName,jdbcType=VARCHAR}, #{apiCaseModule,jdbcType=VARCHAR},
#{apiCasePriority,jdbcType=VARCHAR}, #{apiCaseExecuteUser,jdbcType=VARCHAR}, #{apiCaseExecuteResult,jdbcType=VARCHAR}, #{apiCasePriority,jdbcType=VARCHAR}, #{apiCaseExecuteUser,jdbcType=VARCHAR}, #{apiCaseExecuteResult,jdbcType=VARCHAR},
#{apiCaseExecuteReportId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{testPlanName,jdbcType=VARCHAR} #{apiCaseExecuteReportId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{testPlanName,jdbcType=VARCHAR},
) #{apiCaseBugCount,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportApiCase"> <insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportApiCase">
insert into test_plan_report_api_case insert into test_plan_report_api_case
@ -173,6 +174,9 @@
<if test="testPlanName != null"> <if test="testPlanName != null">
test_plan_name, test_plan_name,
</if> </if>
<if test="apiCaseBugCount != null">
api_case_bug_count,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -220,6 +224,9 @@
<if test="testPlanName != null"> <if test="testPlanName != null">
#{testPlanName,jdbcType=VARCHAR}, #{testPlanName,jdbcType=VARCHAR},
</if> </if>
<if test="apiCaseBugCount != null">
#{apiCaseBugCount,jdbcType=BIGINT},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiCaseExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiCaseExample" resultType="java.lang.Long">
@ -276,6 +283,9 @@
<if test="record.testPlanName != null"> <if test="record.testPlanName != null">
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR}, test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
</if> </if>
<if test="record.apiCaseBugCount != null">
api_case_bug_count = #{record.apiCaseBugCount,jdbcType=BIGINT},
</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" />
@ -297,7 +307,8 @@
api_case_execute_result = #{record.apiCaseExecuteResult,jdbcType=VARCHAR}, api_case_execute_result = #{record.apiCaseExecuteResult,jdbcType=VARCHAR},
api_case_execute_report_id = #{record.apiCaseExecuteReportId,jdbcType=VARCHAR}, api_case_execute_report_id = #{record.apiCaseExecuteReportId,jdbcType=VARCHAR},
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=BIGINT},
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR} test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
api_case_bug_count = #{record.apiCaseBugCount,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -347,6 +358,9 @@
<if test="testPlanName != null"> <if test="testPlanName != null">
test_plan_name = #{testPlanName,jdbcType=VARCHAR}, test_plan_name = #{testPlanName,jdbcType=VARCHAR},
</if> </if>
<if test="apiCaseBugCount != null">
api_case_bug_count = #{apiCaseBugCount,jdbcType=BIGINT},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -365,14 +379,16 @@
api_case_execute_result = #{apiCaseExecuteResult,jdbcType=VARCHAR}, api_case_execute_result = #{apiCaseExecuteResult,jdbcType=VARCHAR},
api_case_execute_report_id = #{apiCaseExecuteReportId,jdbcType=VARCHAR}, api_case_execute_report_id = #{apiCaseExecuteReportId,jdbcType=VARCHAR},
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=BIGINT},
test_plan_name = #{testPlanName,jdbcType=VARCHAR} test_plan_name = #{testPlanName,jdbcType=VARCHAR},
api_case_bug_count = #{apiCaseBugCount,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
insert into test_plan_report_api_case insert into test_plan_report_api_case
(id, test_plan_report_id, test_plan_collection_id, environment_id, test_plan_api_case_id, (id, test_plan_report_id, test_plan_collection_id, environment_id, test_plan_api_case_id,
api_case_id, api_case_num, api_case_name, api_case_module, api_case_priority, api_case_execute_user, api_case_id, api_case_num, api_case_name, api_case_module, api_case_priority, api_case_execute_user,
api_case_execute_result, api_case_execute_report_id, pos, test_plan_name) api_case_execute_result, api_case_execute_report_id, pos, test_plan_name, api_case_bug_count
)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanCollectionId,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanCollectionId,jdbcType=VARCHAR},
@ -380,8 +396,8 @@
#{item.apiCaseId,jdbcType=VARCHAR}, #{item.apiCaseNum,jdbcType=BIGINT}, #{item.apiCaseName,jdbcType=VARCHAR}, #{item.apiCaseId,jdbcType=VARCHAR}, #{item.apiCaseNum,jdbcType=BIGINT}, #{item.apiCaseName,jdbcType=VARCHAR},
#{item.apiCaseModule,jdbcType=VARCHAR}, #{item.apiCasePriority,jdbcType=VARCHAR}, #{item.apiCaseModule,jdbcType=VARCHAR}, #{item.apiCasePriority,jdbcType=VARCHAR},
#{item.apiCaseExecuteUser,jdbcType=VARCHAR}, #{item.apiCaseExecuteResult,jdbcType=VARCHAR}, #{item.apiCaseExecuteUser,jdbcType=VARCHAR}, #{item.apiCaseExecuteResult,jdbcType=VARCHAR},
#{item.apiCaseExecuteReportId,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.testPlanName,jdbcType=VARCHAR} #{item.apiCaseExecuteReportId,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.testPlanName,jdbcType=VARCHAR},
) #{item.apiCaseBugCount,jdbcType=BIGINT})
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -439,6 +455,9 @@
<if test="'test_plan_name'.toString() == column.value"> <if test="'test_plan_name'.toString() == column.value">
#{item.testPlanName,jdbcType=VARCHAR} #{item.testPlanName,jdbcType=VARCHAR}
</if> </if>
<if test="'api_case_bug_count'.toString() == column.value">
#{item.apiCaseBugCount,jdbcType=BIGINT}
</if>
</foreach> </foreach>
) )
</foreach> </foreach>

View File

@ -18,6 +18,7 @@
<result column="api_scenario_execute_report_id" jdbcType="VARCHAR" property="apiScenarioExecuteReportId" /> <result column="api_scenario_execute_report_id" jdbcType="VARCHAR" property="apiScenarioExecuteReportId" />
<result column="pos" jdbcType="BIGINT" property="pos" /> <result column="pos" jdbcType="BIGINT" property="pos" />
<result column="test_plan_name" jdbcType="VARCHAR" property="testPlanName" /> <result column="test_plan_name" jdbcType="VARCHAR" property="testPlanName" />
<result column="api_scenario_bug_count" jdbcType="BIGINT" property="apiScenarioBugCount" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -81,7 +82,7 @@
id, test_plan_report_id, test_plan_collection_id, grouped, environment_id, test_plan_api_scenario_id, id, test_plan_report_id, test_plan_collection_id, grouped, environment_id, test_plan_api_scenario_id,
api_scenario_id, api_scenario_num, api_scenario_name, api_scenario_module, api_scenario_priority, api_scenario_id, api_scenario_num, api_scenario_name, api_scenario_module, api_scenario_priority,
api_scenario_execute_user, api_scenario_execute_result, api_scenario_execute_report_id, api_scenario_execute_user, api_scenario_execute_result, api_scenario_execute_report_id,
pos, test_plan_name pos, test_plan_name, api_scenario_bug_count
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenarioExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenarioExample" resultMap="BaseResultMap">
select select
@ -119,15 +120,15 @@
api_scenario_id, api_scenario_num, api_scenario_name, api_scenario_id, api_scenario_num, api_scenario_name,
api_scenario_module, api_scenario_priority, api_scenario_module, api_scenario_priority,
api_scenario_execute_user, api_scenario_execute_result, api_scenario_execute_user, api_scenario_execute_result,
api_scenario_execute_report_id, pos, test_plan_name api_scenario_execute_report_id, pos, test_plan_name,
) api_scenario_bug_count)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR},
#{grouped,jdbcType=BIT}, #{environmentId,jdbcType=VARCHAR}, #{testPlanApiScenarioId,jdbcType=VARCHAR}, #{grouped,jdbcType=BIT}, #{environmentId,jdbcType=VARCHAR}, #{testPlanApiScenarioId,jdbcType=VARCHAR},
#{apiScenarioId,jdbcType=VARCHAR}, #{apiScenarioNum,jdbcType=BIGINT}, #{apiScenarioName,jdbcType=VARCHAR}, #{apiScenarioId,jdbcType=VARCHAR}, #{apiScenarioNum,jdbcType=BIGINT}, #{apiScenarioName,jdbcType=VARCHAR},
#{apiScenarioModule,jdbcType=VARCHAR}, #{apiScenarioPriority,jdbcType=VARCHAR}, #{apiScenarioModule,jdbcType=VARCHAR}, #{apiScenarioPriority,jdbcType=VARCHAR},
#{apiScenarioExecuteUser,jdbcType=VARCHAR}, #{apiScenarioExecuteResult,jdbcType=VARCHAR}, #{apiScenarioExecuteUser,jdbcType=VARCHAR}, #{apiScenarioExecuteResult,jdbcType=VARCHAR},
#{apiScenarioExecuteReportId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{testPlanName,jdbcType=VARCHAR} #{apiScenarioExecuteReportId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{testPlanName,jdbcType=VARCHAR},
) #{apiScenarioBugCount,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenario"> <insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenario">
insert into test_plan_report_api_scenario insert into test_plan_report_api_scenario
@ -180,6 +181,9 @@
<if test="testPlanName != null"> <if test="testPlanName != null">
test_plan_name, test_plan_name,
</if> </if>
<if test="apiScenarioBugCount != null">
api_scenario_bug_count,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -230,6 +234,9 @@
<if test="testPlanName != null"> <if test="testPlanName != null">
#{testPlanName,jdbcType=VARCHAR}, #{testPlanName,jdbcType=VARCHAR},
</if> </if>
<if test="apiScenarioBugCount != null">
#{apiScenarioBugCount,jdbcType=BIGINT},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenarioExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportApiScenarioExample" resultType="java.lang.Long">
@ -289,6 +296,9 @@
<if test="record.testPlanName != null"> <if test="record.testPlanName != null">
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR}, test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
</if> </if>
<if test="record.apiScenarioBugCount != null">
api_scenario_bug_count = #{record.apiScenarioBugCount,jdbcType=BIGINT},
</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" />
@ -311,7 +321,8 @@
api_scenario_execute_result = #{record.apiScenarioExecuteResult,jdbcType=VARCHAR}, api_scenario_execute_result = #{record.apiScenarioExecuteResult,jdbcType=VARCHAR},
api_scenario_execute_report_id = #{record.apiScenarioExecuteReportId,jdbcType=VARCHAR}, api_scenario_execute_report_id = #{record.apiScenarioExecuteReportId,jdbcType=VARCHAR},
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=BIGINT},
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR} test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
api_scenario_bug_count = #{record.apiScenarioBugCount,jdbcType=BIGINT}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -364,6 +375,9 @@
<if test="testPlanName != null"> <if test="testPlanName != null">
test_plan_name = #{testPlanName,jdbcType=VARCHAR}, test_plan_name = #{testPlanName,jdbcType=VARCHAR},
</if> </if>
<if test="apiScenarioBugCount != null">
api_scenario_bug_count = #{apiScenarioBugCount,jdbcType=BIGINT},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -383,7 +397,8 @@
api_scenario_execute_result = #{apiScenarioExecuteResult,jdbcType=VARCHAR}, api_scenario_execute_result = #{apiScenarioExecuteResult,jdbcType=VARCHAR},
api_scenario_execute_report_id = #{apiScenarioExecuteReportId,jdbcType=VARCHAR}, api_scenario_execute_report_id = #{apiScenarioExecuteReportId,jdbcType=VARCHAR},
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=BIGINT},
test_plan_name = #{testPlanName,jdbcType=VARCHAR} test_plan_name = #{testPlanName,jdbcType=VARCHAR},
api_scenario_bug_count = #{apiScenarioBugCount,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
@ -391,7 +406,7 @@
(id, test_plan_report_id, test_plan_collection_id, grouped, environment_id, test_plan_api_scenario_id, (id, test_plan_report_id, test_plan_collection_id, grouped, environment_id, test_plan_api_scenario_id,
api_scenario_id, api_scenario_num, api_scenario_name, api_scenario_module, api_scenario_priority, api_scenario_id, api_scenario_num, api_scenario_name, api_scenario_module, api_scenario_priority,
api_scenario_execute_user, api_scenario_execute_result, api_scenario_execute_report_id, api_scenario_execute_user, api_scenario_execute_result, api_scenario_execute_report_id,
pos, test_plan_name) pos, test_plan_name, api_scenario_bug_count)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanCollectionId,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanCollectionId,jdbcType=VARCHAR},
@ -400,7 +415,8 @@
#{item.apiScenarioName,jdbcType=VARCHAR}, #{item.apiScenarioModule,jdbcType=VARCHAR}, #{item.apiScenarioName,jdbcType=VARCHAR}, #{item.apiScenarioModule,jdbcType=VARCHAR},
#{item.apiScenarioPriority,jdbcType=VARCHAR}, #{item.apiScenarioExecuteUser,jdbcType=VARCHAR}, #{item.apiScenarioPriority,jdbcType=VARCHAR}, #{item.apiScenarioExecuteUser,jdbcType=VARCHAR},
#{item.apiScenarioExecuteResult,jdbcType=VARCHAR}, #{item.apiScenarioExecuteReportId,jdbcType=VARCHAR}, #{item.apiScenarioExecuteResult,jdbcType=VARCHAR}, #{item.apiScenarioExecuteReportId,jdbcType=VARCHAR},
#{item.pos,jdbcType=BIGINT}, #{item.testPlanName,jdbcType=VARCHAR}) #{item.pos,jdbcType=BIGINT}, #{item.testPlanName,jdbcType=VARCHAR}, #{item.apiScenarioBugCount,jdbcType=BIGINT}
)
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -461,6 +477,9 @@
<if test="'test_plan_name'.toString() == column.value"> <if test="'test_plan_name'.toString() == column.value">
#{item.testPlanName,jdbcType=VARCHAR} #{item.testPlanName,jdbcType=VARCHAR}
</if> </if>
<if test="'api_scenario_bug_count'.toString() == column.value">
#{item.apiScenarioBugCount,jdbcType=BIGINT}
</if>
</foreach> </foreach>
) )
</foreach> </foreach>

View File

@ -0,0 +1 @@
select database();

View File

@ -0,0 +1,9 @@
-- set innodb lock wait timeout
SET SESSION innodb_lock_wait_timeout = 7200;
-- 修改测试计划接口报告详情&&场景报告详情表 (缺陷统计字段)
ALTER TABLE test_plan_report_api_case ADD COLUMN api_case_bug_count bigint default 0 not null comment '接口用例关联缺陷数';
ALTER TABLE test_plan_report_api_scenario ADD COLUMN api_scenario_bug_count bigint default 0 not null comment '场景用例关联缺陷数';
-- set innodb lock wait timeout to default
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -0,0 +1,13 @@
package io.metersphere.plan.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class ReportBugSumDTO {
@Schema(description = "用例类型")
private String caseType;
@Schema(description = "缺陷数量")
private Long bugCount;
}

View File

@ -9,12 +9,13 @@
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiCase"> <select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiCase">
select tpac.id as testPlanApiCaseId, atc.id as apiCaseId, atc.num as apiCaseNum, atc.name as apiCaseName, atc.priority as apiCasePriority, select tpac.id as testPlanApiCaseId, atc.id as apiCaseId, atc.num as apiCaseNum, atc.name as apiCaseName, atc.priority as apiCasePriority,
tpac.test_plan_collection_id testPlanCollectionId, tpac.environment_id as environmentId, tpac.test_plan_collection_id testPlanCollectionId, tpac.environment_id as environmentId, count(brc.id) as apiCaseBugCount,
if(ad.module_id = 'root','未规划用例', ad.module_id) as apiCaseModule, tpac.execute_user as apiCaseExecuteUser, if(ad.module_id = 'root','未规划用例', ad.module_id) as apiCaseModule, tpac.execute_user as apiCaseExecuteUser,
ifnull(tpac.last_exec_result, 'PENDING') as apiCaseExecuteResult, tpac.last_exec_report_id apiCaseExecuteReportId, tpac.pos pos ifnull(tpac.last_exec_result, 'PENDING') as apiCaseExecuteResult, tpac.last_exec_report_id apiCaseExecuteReportId, tpac.pos as pos
from test_plan_api_case tpac join api_test_case atc on atc.id = tpac.api_case_id from test_plan_api_case tpac join api_test_case atc on atc.id = tpac.api_case_id
left join api_definition ad on atc.api_definition_id = ad.id left join api_definition ad on atc.api_definition_id = ad.id
left join api_definition_module adm on ad.module_id = adm.id left join api_definition_module adm on ad.module_id = adm.id
left join bug_relation_case brc on brc.test_plan_case_id = tpac.id
where tpac.test_plan_id = #{id} and atc.deleted = false where tpac.test_plan_id = #{id} and atc.deleted = false
group by tpac.id group by tpac.id
</select> </select>
@ -28,10 +29,10 @@
</select> </select>
<select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO"> <select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO">
<!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、 接口报告ID --> <!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、接口报告ID -->
select tprac.api_case_id as id, tprac.api_case_num as num, tprac.api_case_name as name, tprac.test_plan_name as planName, select tprac.api_case_id as id, tprac.api_case_num as num, tprac.api_case_name as name, tprac.test_plan_name as planName,
tprac.api_case_module as moduleName, tprac.api_case_priority as priority, tprac.api_case_execute_report_id reportId, tprac.api_case_module as moduleName, tprac.api_case_priority as priority, tprac.api_case_execute_report_id reportId, ifnull(tprac.api_case_bug_count, 0) as bugCount,
ifnull(tprac.api_case_execute_result, 'PENDING') as executeResult, tprac.api_case_execute_user as executeUser, 0 as bugCount, atc.project_id projectId ifnull(tprac.api_case_execute_result, 'PENDING') as executeResult, tprac.api_case_execute_user as executeUser, atc.project_id projectId
from test_plan_report_api_case tprac left join api_test_case atc on tprac.api_case_id = atc.id from test_plan_report_api_case tprac left join api_test_case atc on tprac.api_case_id = atc.id
where tprac.test_plan_report_id = #{request.reportId} where tprac.test_plan_report_id = #{request.reportId}
<include refid="filter"/> <include refid="filter"/>

View File

@ -9,11 +9,12 @@
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiScenario"> <select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportApiScenario">
select tpas.id as testPlanApiScenarioId, aso.id as apiScenarioId, aso.num as apiScenarioNum, aso.name as apiScenarioName, aso.priority as apiScenarioPriority, select tpas.id as testPlanApiScenarioId, aso.id as apiScenarioId, aso.num as apiScenarioNum, aso.name as apiScenarioName, aso.priority as apiScenarioPriority,
tpas.test_plan_collection_id testPlanCollectionId, tpas.grouped as grouped, tpas.environment_id environmentId, tpas.test_plan_collection_id testPlanCollectionId, tpas.grouped as grouped, tpas.environment_id environmentId, count(brc.id) as apiScenarioBugCount,
if(aso.module_id = 'root','未规划用例', aso.module_id) as apiScenarioModule, tpas.execute_user as apiScenarioExecuteUser, if(aso.module_id = 'root','未规划用例', aso.module_id) as apiScenarioModule, tpas.execute_user as apiScenarioExecuteUser,
ifnull(tpas.last_exec_result, 'PENDING') as apiScenarioExecuteResult, tpas.last_exec_report_id apiScenarioExecuteReportId, tpas.pos as pos ifnull(tpas.last_exec_result, 'PENDING') as apiScenarioExecuteResult, tpas.last_exec_report_id apiScenarioExecuteReportId, tpas.pos as pos
from test_plan_api_scenario tpas join api_scenario aso on aso.id = tpas.api_scenario_id from test_plan_api_scenario tpas join api_scenario aso on aso.id = tpas.api_scenario_id
left join api_scenario_module asm on aso.module_id = asm.id left join api_scenario_module asm on aso.module_id = asm.id
left join bug_relation_case brc on brc.test_plan_case_id = tpas.id
where tpas.test_plan_id = #{id} and aso.deleted = false where tpas.test_plan_id = #{id} and aso.deleted = false
group by tpas.id group by tpas.id
</select> </select>
@ -29,8 +30,8 @@
<select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO"> <select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO">
<!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、报告ID --> <!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、报告ID -->
select distinct tpras.api_scenario_id as id, tpras.api_scenario_num as num, tpras.api_scenario_name as name, tpras.test_plan_name as planName, select distinct tpras.api_scenario_id as id, tpras.api_scenario_num as num, tpras.api_scenario_name as name, tpras.test_plan_name as planName,
tpras.api_scenario_module as moduleName, tpras.api_scenario_priority as priority, tpras.api_scenario_execute_report_id reportId, tpras.api_scenario_module as moduleName, tpras.api_scenario_priority as priority, tpras.api_scenario_execute_report_id reportId, ifnull(tpras.api_scenario_bug_count, 0) as bugCount,
ifnull(tpras.api_scenario_execute_result, 'PENDING') as executeResult, tpras.api_scenario_execute_user as executeUser, 0 as bugCount, aso.project_id projectId ifnull(tpras.api_scenario_execute_result, 'PENDING') as executeResult, tpras.api_scenario_execute_user as executeUser, aso.project_id projectId
from test_plan_report_api_scenario tpras left join api_scenario aso on tpras.api_scenario_id = aso.id from test_plan_report_api_scenario tpras left join api_scenario aso on tpras.api_scenario_id = aso.id
where tpras.test_plan_report_id = #{request.reportId} where tpras.test_plan_report_id = #{request.reportId}
<include refid="filter"/> <include refid="filter"/>

View File

@ -2,6 +2,7 @@ package io.metersphere.plan.mapper;
import io.metersphere.bug.dto.response.BugDTO; import io.metersphere.bug.dto.response.BugDTO;
import io.metersphere.plan.domain.TestPlanReportBug; import io.metersphere.plan.domain.TestPlanReportBug;
import io.metersphere.plan.dto.ReportBugSumDTO;
import io.metersphere.plan.dto.request.TestPlanReportDetailPageRequest; import io.metersphere.plan.dto.request.TestPlanReportDetailPageRequest;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -22,4 +23,11 @@ public interface ExtTestPlanReportBugMapper {
* @return 关联的缺陷集合 * @return 关联的缺陷集合
*/ */
List<BugDTO> list(@Param("request") TestPlanReportDetailPageRequest request); List<BugDTO> list(@Param("request") TestPlanReportDetailPageRequest request);
/**
* 统计用例明细的关联缺陷数
* @param reportId 报告ID
* @return 缺陷数量
*/
List<ReportBugSumDTO> countBug(@Param("id") String reportId);
} }

View File

@ -17,4 +17,14 @@
where tprb.test_plan_report_id = #{request.reportId} where tprb.test_plan_report_id = #{request.reportId}
</select> </select>
<select id="countBug" resultType="io.metersphere.plan.dto.ReportBugSumDTO">
select 'FUNCTIONAL' as caseType, ifnull(sum(tprfc.function_case_bug_count), 0) as bugCount from test_plan_report_function_case tprfc
where tprfc.test_plan_report_id = #{id}
union
select 'API' as caseType, ifnull(sum(tprac.api_case_bug_count), 0) as bugCount from test_plan_report_api_case tprac
where tprac.test_plan_report_id = #{id}
union
select 'SCENARIO' as caseType, ifnull(sum(tpras.api_scenario_bug_count), 0) as bugCount from test_plan_report_api_scenario tpras
where tpras.test_plan_report_id = #{id}
</select>
</mapper> </mapper>

View File

@ -53,11 +53,4 @@ public interface ExtTestPlanReportFunctionalCaseMapper {
* @return 关联的用例集合 * @return 关联的用例集合
*/ */
List<ReportDetailCasePageDTO> list(@Param("request") TestPlanReportDetailPageRequest request); List<ReportDetailCasePageDTO> list(@Param("request") TestPlanReportDetailPageRequest request);
/**
* 统计用例明细的关联缺陷数
* @param reportId 报告ID
* @return 缺陷数量
*/
Long countBug(@Param("id") String reportId);
} }

View File

@ -58,11 +58,6 @@
<include refid="filter"/> <include refid="filter"/>
</select> </select>
<select id="countBug" resultType="java.lang.Long">
select sum(function_case_bug_count) from test_plan_report_function_case tprfc
where tprfc.test_plan_report_id = #{id}
</select>
<sql id="filter"> <sql id="filter">
<if test="request.filter != null and request.filter.size() > 0"> <if test="request.filter != null and request.filter.size() > 0">
<foreach collection="request.filter.entrySet()" index="key" item="values"> <foreach collection="request.filter.entrySet()" index="key" item="values">

View File

@ -628,9 +628,13 @@ public class TestPlanReportService {
planReportDetail.setApiCaseTotal(reportSummary.getApiCaseCount().intValue()); planReportDetail.setApiCaseTotal(reportSummary.getApiCaseCount().intValue());
planReportDetail.setApiScenarioTotal(reportSummary.getApiScenarioCount().intValue()); planReportDetail.setApiScenarioTotal(reportSummary.getApiScenarioCount().intValue());
planReportDetail.setBugCount(reportSummary.getBugCount().intValue()); planReportDetail.setBugCount(reportSummary.getBugCount().intValue());
// 暂时只有功能用例能关联缺陷 //用例关联缺陷数
Long functionalBugCount = extTestPlanReportFunctionalCaseMapper.countBug(reportId); List<ReportBugSumDTO> bugSumList = extTestPlanReportBugMapper.countBug(reportId);
planReportDetail.setFunctionalBugCount(functionalBugCount == null ? 0 : functionalBugCount.intValue()); Map<String, Long> bugSumMap = bugSumList.stream().collect(Collectors.toMap(ReportBugSumDTO::getCaseType, ReportBugSumDTO::getBugCount));
planReportDetail.setFunctionalBugCount(bugSumMap.get(CaseType.FUNCTIONAL_CASE.getKey()).intValue());
planReportDetail.setApiBugCount(bugSumMap.get(CaseType.API_CASE.getKey()).intValue());
planReportDetail.setScenarioBugCount(bugSumMap.get(CaseType.SCENARIO_CASE.getKey()).intValue());
if (planReport.getIntegrated()) { if (planReport.getIntegrated()) {
// 计划组报告, 需要统计计划的执行数据 // 计划组报告, 需要统计计划的执行数据
planReportDetail.setPlanCount(reportSummary.getPlanCount().intValue()); planReportDetail.setPlanCount(reportSummary.getPlanCount().intValue());