refactor(报告): 优化计划组报告生成逻辑

This commit is contained in:
song-cc-rock 2024-07-10 11:07:59 +08:00 committed by 刘瑞斌
parent 54992fa738
commit 420a826697
17 changed files with 340 additions and 43 deletions

View File

@ -70,6 +70,9 @@ public class TestPlanReportApiCase implements Serializable {
@NotNull(message = "{test_plan_report_api_case.pos.not_blank}", groups = {Created.class}) @NotNull(message = "{test_plan_report_api_case.pos.not_blank}", groups = {Created.class})
private Long pos; private Long pos;
@Schema(description = "测试计划名称")
private String testPlanName;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
@ -86,7 +89,8 @@ public class TestPlanReportApiCase implements Serializable {
apiCaseExecuteUser("api_case_execute_user", "apiCaseExecuteUser", "VARCHAR", false), apiCaseExecuteUser("api_case_execute_user", "apiCaseExecuteUser", "VARCHAR", false),
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);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -1063,6 +1063,76 @@ public class TestPlanReportApiCaseExample {
addCriterion("pos not between", value1, value2, "pos"); addCriterion("pos not between", value1, value2, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTestPlanNameIsNull() {
addCriterion("test_plan_name is null");
return (Criteria) this;
}
public Criteria andTestPlanNameIsNotNull() {
addCriterion("test_plan_name is not null");
return (Criteria) this;
}
public Criteria andTestPlanNameEqualTo(String value) {
addCriterion("test_plan_name =", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotEqualTo(String value) {
addCriterion("test_plan_name <>", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameGreaterThan(String value) {
addCriterion("test_plan_name >", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_name >=", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLessThan(String value) {
addCriterion("test_plan_name <", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLessThanOrEqualTo(String value) {
addCriterion("test_plan_name <=", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLike(String value) {
addCriterion("test_plan_name like", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotLike(String value) {
addCriterion("test_plan_name not like", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameIn(List<String> values) {
addCriterion("test_plan_name in", values, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotIn(List<String> values) {
addCriterion("test_plan_name not in", values, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameBetween(String value1, String value2) {
addCriterion("test_plan_name between", value1, value2, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotBetween(String value1, String value2) {
addCriterion("test_plan_name not between", value1, value2, "testPlanName");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -73,6 +73,9 @@ public class TestPlanReportApiScenario implements Serializable {
@NotNull(message = "{test_plan_report_api_scenario.pos.not_blank}", groups = {Created.class}) @NotNull(message = "{test_plan_report_api_scenario.pos.not_blank}", groups = {Created.class})
private Long pos; private Long pos;
@Schema(description = "测试计划名称")
private String testPlanName;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
@ -90,7 +93,8 @@ public class TestPlanReportApiScenario implements Serializable {
apiScenarioExecuteUser("api_scenario_execute_user", "apiScenarioExecuteUser", "VARCHAR", false), apiScenarioExecuteUser("api_scenario_execute_user", "apiScenarioExecuteUser", "VARCHAR", false),
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);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -1123,6 +1123,76 @@ public class TestPlanReportApiScenarioExample {
addCriterion("pos not between", value1, value2, "pos"); addCriterion("pos not between", value1, value2, "pos");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTestPlanNameIsNull() {
addCriterion("test_plan_name is null");
return (Criteria) this;
}
public Criteria andTestPlanNameIsNotNull() {
addCriterion("test_plan_name is not null");
return (Criteria) this;
}
public Criteria andTestPlanNameEqualTo(String value) {
addCriterion("test_plan_name =", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotEqualTo(String value) {
addCriterion("test_plan_name <>", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameGreaterThan(String value) {
addCriterion("test_plan_name >", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_name >=", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLessThan(String value) {
addCriterion("test_plan_name <", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLessThanOrEqualTo(String value) {
addCriterion("test_plan_name <=", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLike(String value) {
addCriterion("test_plan_name like", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotLike(String value) {
addCriterion("test_plan_name not like", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameIn(List<String> values) {
addCriterion("test_plan_name in", values, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotIn(List<String> values) {
addCriterion("test_plan_name not in", values, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameBetween(String value1, String value2) {
addCriterion("test_plan_name between", value1, value2, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotBetween(String value1, String value2) {
addCriterion("test_plan_name not between", value1, value2, "testPlanName");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -72,6 +72,9 @@ public class TestPlanReportFunctionCase implements Serializable {
@Schema(description = "执行报告ID") @Schema(description = "执行报告ID")
private String functionCaseExecuteReportId; private String functionCaseExecuteReportId;
@Schema(description = "测试计划名称")
private String testPlanName;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
@ -88,7 +91,8 @@ public class TestPlanReportFunctionCase implements Serializable {
functionCaseExecuteResult("function_case_execute_result", "functionCaseExecuteResult", "VARCHAR", false), functionCaseExecuteResult("function_case_execute_result", "functionCaseExecuteResult", "VARCHAR", false),
testPlanCollectionId("test_plan_collection_id", "testPlanCollectionId", "VARCHAR", false), testPlanCollectionId("test_plan_collection_id", "testPlanCollectionId", "VARCHAR", false),
pos("pos", "pos", "BIGINT", false), pos("pos", "pos", "BIGINT", false),
functionCaseExecuteReportId("function_case_execute_report_id", "functionCaseExecuteReportId", "VARCHAR", false); functionCaseExecuteReportId("function_case_execute_report_id", "functionCaseExecuteReportId", "VARCHAR", false),
testPlanName("test_plan_name", "testPlanName", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -1053,6 +1053,76 @@ public class TestPlanReportFunctionCaseExample {
addCriterion("function_case_execute_report_id not between", value1, value2, "functionCaseExecuteReportId"); addCriterion("function_case_execute_report_id not between", value1, value2, "functionCaseExecuteReportId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andTestPlanNameIsNull() {
addCriterion("test_plan_name is null");
return (Criteria) this;
}
public Criteria andTestPlanNameIsNotNull() {
addCriterion("test_plan_name is not null");
return (Criteria) this;
}
public Criteria andTestPlanNameEqualTo(String value) {
addCriterion("test_plan_name =", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotEqualTo(String value) {
addCriterion("test_plan_name <>", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameGreaterThan(String value) {
addCriterion("test_plan_name >", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_name >=", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLessThan(String value) {
addCriterion("test_plan_name <", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLessThanOrEqualTo(String value) {
addCriterion("test_plan_name <=", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameLike(String value) {
addCriterion("test_plan_name like", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotLike(String value) {
addCriterion("test_plan_name not like", value, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameIn(List<String> values) {
addCriterion("test_plan_name in", values, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotIn(List<String> values) {
addCriterion("test_plan_name not in", values, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameBetween(String value1, String value2) {
addCriterion("test_plan_name between", value1, value2, "testPlanName");
return (Criteria) this;
}
public Criteria andTestPlanNameNotBetween(String value1, String value2) {
addCriterion("test_plan_name not between", value1, value2, "testPlanName");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -16,6 +16,7 @@
<result column="api_case_execute_result" jdbcType="VARCHAR" property="apiCaseExecuteResult" /> <result column="api_case_execute_result" jdbcType="VARCHAR" property="apiCaseExecuteResult" />
<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" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -78,7 +79,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 api_case_execute_result, api_case_execute_report_id, pos, test_plan_name
</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
@ -115,12 +116,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) api_case_execute_report_id, pos, test_plan_name
)
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}) #{apiCaseExecuteReportId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{testPlanName,jdbcType=VARCHAR}
)
</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
@ -167,6 +170,9 @@
<if test="pos != null"> <if test="pos != null">
pos, pos,
</if> </if>
<if test="testPlanName != null">
test_plan_name,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -211,6 +217,9 @@
<if test="pos != null"> <if test="pos != null">
#{pos,jdbcType=BIGINT}, #{pos,jdbcType=BIGINT},
</if> </if>
<if test="testPlanName != null">
#{testPlanName,jdbcType=VARCHAR},
</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">
@ -264,6 +273,9 @@
<if test="record.pos != null"> <if test="record.pos != null">
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=BIGINT},
</if> </if>
<if test="record.testPlanName != null">
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
</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" />
@ -284,7 +296,8 @@
api_case_execute_user = #{record.apiCaseExecuteUser,jdbcType=VARCHAR}, api_case_execute_user = #{record.apiCaseExecuteUser,jdbcType=VARCHAR},
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}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -331,6 +344,9 @@
<if test="pos != null"> <if test="pos != null">
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=BIGINT},
</if> </if>
<if test="testPlanName != null">
test_plan_name = #{testPlanName,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -348,14 +364,15 @@
api_case_execute_user = #{apiCaseExecuteUser,jdbcType=VARCHAR}, api_case_execute_user = #{apiCaseExecuteUser,jdbcType=VARCHAR},
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}
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) api_case_execute_result, api_case_execute_report_id, pos, test_plan_name)
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},
@ -363,7 +380,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.apiCaseExecuteReportId,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.testPlanName,jdbcType=VARCHAR}
)
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -418,6 +436,9 @@
<if test="'pos'.toString() == column.value"> <if test="'pos'.toString() == column.value">
#{item.pos,jdbcType=BIGINT} #{item.pos,jdbcType=BIGINT}
</if> </if>
<if test="'test_plan_name'.toString() == column.value">
#{item.testPlanName,jdbcType=VARCHAR}
</if>
</foreach> </foreach>
) )
</foreach> </foreach>

View File

@ -17,6 +17,7 @@
<result column="api_scenario_execute_result" jdbcType="VARCHAR" property="apiScenarioExecuteResult" /> <result column="api_scenario_execute_result" jdbcType="VARCHAR" property="apiScenarioExecuteResult" />
<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" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -80,7 +81,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 pos, test_plan_name
</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
@ -118,13 +119,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) api_scenario_execute_report_id, pos, test_plan_name
)
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}) #{apiScenarioExecuteReportId,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{testPlanName,jdbcType=VARCHAR}
)
</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
@ -174,6 +177,9 @@
<if test="pos != null"> <if test="pos != null">
pos, pos,
</if> </if>
<if test="testPlanName != null">
test_plan_name,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -221,6 +227,9 @@
<if test="pos != null"> <if test="pos != null">
#{pos,jdbcType=BIGINT}, #{pos,jdbcType=BIGINT},
</if> </if>
<if test="testPlanName != null">
#{testPlanName,jdbcType=VARCHAR},
</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">
@ -277,6 +286,9 @@
<if test="record.pos != null"> <if test="record.pos != null">
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=BIGINT},
</if> </if>
<if test="record.testPlanName != null">
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
</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" />
@ -298,7 +310,8 @@
api_scenario_execute_user = #{record.apiScenarioExecuteUser,jdbcType=VARCHAR}, api_scenario_execute_user = #{record.apiScenarioExecuteUser,jdbcType=VARCHAR},
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}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -348,6 +361,9 @@
<if test="pos != null"> <if test="pos != null">
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=BIGINT},
</if> </if>
<if test="testPlanName != null">
test_plan_name = #{testPlanName,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -366,7 +382,8 @@
api_scenario_execute_user = #{apiScenarioExecuteUser,jdbcType=VARCHAR}, api_scenario_execute_user = #{apiScenarioExecuteUser,jdbcType=VARCHAR},
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}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
@ -374,7 +391,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) pos, test_plan_name)
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},
@ -383,7 +400,7 @@
#{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.pos,jdbcType=BIGINT}, #{item.testPlanName,jdbcType=VARCHAR})
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -441,6 +458,9 @@
<if test="'pos'.toString() == column.value"> <if test="'pos'.toString() == column.value">
#{item.pos,jdbcType=BIGINT} #{item.pos,jdbcType=BIGINT}
</if> </if>
<if test="'test_plan_name'.toString() == column.value">
#{item.testPlanName,jdbcType=VARCHAR}
</if>
</foreach> </foreach>
) )
</foreach> </foreach>

View File

@ -16,6 +16,7 @@
<result column="test_plan_collection_id" jdbcType="VARCHAR" property="testPlanCollectionId" /> <result column="test_plan_collection_id" jdbcType="VARCHAR" property="testPlanCollectionId" />
<result column="pos" jdbcType="BIGINT" property="pos" /> <result column="pos" jdbcType="BIGINT" property="pos" />
<result column="function_case_execute_report_id" jdbcType="VARCHAR" property="functionCaseExecuteReportId" /> <result column="function_case_execute_report_id" jdbcType="VARCHAR" property="functionCaseExecuteReportId" />
<result column="test_plan_name" jdbcType="VARCHAR" property="testPlanName" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -79,7 +80,7 @@
id, test_plan_report_id, test_plan_function_case_id, function_case_id, function_case_num, id, test_plan_report_id, test_plan_function_case_id, function_case_id, function_case_num,
function_case_name, function_case_module, function_case_priority, function_case_execute_user, function_case_name, function_case_module, function_case_priority, function_case_execute_user,
function_case_bug_count, function_case_execute_result, test_plan_collection_id, pos, function_case_bug_count, function_case_execute_result, test_plan_collection_id, pos,
function_case_execute_report_id function_case_execute_report_id, test_plan_name
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCaseExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCaseExample" resultMap="BaseResultMap">
select select
@ -117,13 +118,15 @@
function_case_module, function_case_priority, function_case_module, function_case_priority,
function_case_execute_user, function_case_bug_count, function_case_execute_user, function_case_bug_count,
function_case_execute_result, test_plan_collection_id, function_case_execute_result, test_plan_collection_id,
pos, function_case_execute_report_id) pos, function_case_execute_report_id, test_plan_name
)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanFunctionCaseId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{testPlanFunctionCaseId,jdbcType=VARCHAR},
#{functionCaseId,jdbcType=VARCHAR}, #{functionCaseNum,jdbcType=BIGINT}, #{functionCaseName,jdbcType=VARCHAR}, #{functionCaseId,jdbcType=VARCHAR}, #{functionCaseNum,jdbcType=BIGINT}, #{functionCaseName,jdbcType=VARCHAR},
#{functionCaseModule,jdbcType=VARCHAR}, #{functionCasePriority,jdbcType=VARCHAR}, #{functionCaseModule,jdbcType=VARCHAR}, #{functionCasePriority,jdbcType=VARCHAR},
#{functionCaseExecuteUser,jdbcType=VARCHAR}, #{functionCaseBugCount,jdbcType=BIGINT}, #{functionCaseExecuteUser,jdbcType=VARCHAR}, #{functionCaseBugCount,jdbcType=BIGINT},
#{functionCaseExecuteResult,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR}, #{functionCaseExecuteResult,jdbcType=VARCHAR}, #{testPlanCollectionId,jdbcType=VARCHAR},
#{pos,jdbcType=BIGINT}, #{functionCaseExecuteReportId,jdbcType=VARCHAR}) #{pos,jdbcType=BIGINT}, #{functionCaseExecuteReportId,jdbcType=VARCHAR}, #{testPlanName,jdbcType=VARCHAR}
)
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCase"> <insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCase">
insert into test_plan_report_function_case insert into test_plan_report_function_case
@ -170,6 +173,9 @@
<if test="functionCaseExecuteReportId != null"> <if test="functionCaseExecuteReportId != null">
function_case_execute_report_id, function_case_execute_report_id,
</if> </if>
<if test="testPlanName != null">
test_plan_name,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -214,6 +220,9 @@
<if test="functionCaseExecuteReportId != null"> <if test="functionCaseExecuteReportId != null">
#{functionCaseExecuteReportId,jdbcType=VARCHAR}, #{functionCaseExecuteReportId,jdbcType=VARCHAR},
</if> </if>
<if test="testPlanName != null">
#{testPlanName,jdbcType=VARCHAR},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCaseExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCaseExample" resultType="java.lang.Long">
@ -267,6 +276,9 @@
<if test="record.functionCaseExecuteReportId != null"> <if test="record.functionCaseExecuteReportId != null">
function_case_execute_report_id = #{record.functionCaseExecuteReportId,jdbcType=VARCHAR}, function_case_execute_report_id = #{record.functionCaseExecuteReportId,jdbcType=VARCHAR},
</if> </if>
<if test="record.testPlanName != null">
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
</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" />
@ -287,7 +299,8 @@
function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR}, function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR},
test_plan_collection_id = #{record.testPlanCollectionId,jdbcType=VARCHAR}, test_plan_collection_id = #{record.testPlanCollectionId,jdbcType=VARCHAR},
pos = #{record.pos,jdbcType=BIGINT}, pos = #{record.pos,jdbcType=BIGINT},
function_case_execute_report_id = #{record.functionCaseExecuteReportId,jdbcType=VARCHAR} function_case_execute_report_id = #{record.functionCaseExecuteReportId,jdbcType=VARCHAR},
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
</if> </if>
@ -334,6 +347,9 @@
<if test="functionCaseExecuteReportId != null"> <if test="functionCaseExecuteReportId != null">
function_case_execute_report_id = #{functionCaseExecuteReportId,jdbcType=VARCHAR}, function_case_execute_report_id = #{functionCaseExecuteReportId,jdbcType=VARCHAR},
</if> </if>
<if test="testPlanName != null">
test_plan_name = #{testPlanName,jdbcType=VARCHAR},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -351,7 +367,8 @@
function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR}, function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR},
test_plan_collection_id = #{testPlanCollectionId,jdbcType=VARCHAR}, test_plan_collection_id = #{testPlanCollectionId,jdbcType=VARCHAR},
pos = #{pos,jdbcType=BIGINT}, pos = #{pos,jdbcType=BIGINT},
function_case_execute_report_id = #{functionCaseExecuteReportId,jdbcType=VARCHAR} function_case_execute_report_id = #{functionCaseExecuteReportId,jdbcType=VARCHAR},
test_plan_name = #{testPlanName,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
<insert id="batchInsert" parameterType="map"> <insert id="batchInsert" parameterType="map">
@ -359,7 +376,7 @@
(id, test_plan_report_id, test_plan_function_case_id, function_case_id, function_case_num, (id, test_plan_report_id, test_plan_function_case_id, function_case_id, function_case_num,
function_case_name, function_case_module, function_case_priority, function_case_execute_user, function_case_name, function_case_module, function_case_priority, function_case_execute_user,
function_case_bug_count, function_case_execute_result, test_plan_collection_id, function_case_bug_count, function_case_execute_result, test_plan_collection_id,
pos, function_case_execute_report_id) pos, function_case_execute_report_id, test_plan_name)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanFunctionCaseId,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.testPlanFunctionCaseId,jdbcType=VARCHAR},
@ -367,8 +384,8 @@
#{item.functionCaseName,jdbcType=VARCHAR}, #{item.functionCaseModule,jdbcType=VARCHAR}, #{item.functionCaseName,jdbcType=VARCHAR}, #{item.functionCaseModule,jdbcType=VARCHAR},
#{item.functionCasePriority,jdbcType=VARCHAR}, #{item.functionCaseExecuteUser,jdbcType=VARCHAR}, #{item.functionCasePriority,jdbcType=VARCHAR}, #{item.functionCaseExecuteUser,jdbcType=VARCHAR},
#{item.functionCaseBugCount,jdbcType=BIGINT}, #{item.functionCaseExecuteResult,jdbcType=VARCHAR}, #{item.functionCaseBugCount,jdbcType=BIGINT}, #{item.functionCaseExecuteResult,jdbcType=VARCHAR},
#{item.testPlanCollectionId,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.functionCaseExecuteReportId,jdbcType=VARCHAR} #{item.testPlanCollectionId,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT}, #{item.functionCaseExecuteReportId,jdbcType=VARCHAR},
) #{item.testPlanName,jdbcType=VARCHAR})
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -423,6 +440,9 @@
<if test="'function_case_execute_report_id'.toString() == column.value"> <if test="'function_case_execute_report_id'.toString() == column.value">
#{item.functionCaseExecuteReportId,jdbcType=VARCHAR} #{item.functionCaseExecuteReportId,jdbcType=VARCHAR}
</if> </if>
<if test="'test_plan_name'.toString() == column.value">
#{item.testPlanName,jdbcType=VARCHAR}
</if>
</foreach> </foreach>
) )
</foreach> </foreach>

View File

@ -21,6 +21,10 @@ CREATE TABLE IF NOT EXISTS test_plan_report_component(
PRIMARY KEY (id) PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '测试计划报告逐组件表'; ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '测试计划报告逐组件表';
ALTER TABLE test_plan_report_function_case ADD `test_plan_name` VARCHAR(255) COMMENT '测试计划名称';
ALTER TABLE test_plan_report_api_case ADD `test_plan_name` VARCHAR(255) COMMENT '测试计划名称';
ALTER TABLE test_plan_report_api_scenario ADD `test_plan_name` VARCHAR(255) COMMENT '测试计划名称';
-- set innodb lock wait timeout to default -- set innodb lock wait timeout to default
SET SESSION innodb_lock_wait_timeout = DEFAULT; SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -16,6 +16,8 @@ public class ReportDetailCasePageDTO {
private Long num; private Long num;
@Schema(description = "用例名称") @Schema(description = "用例名称")
private String name; private String name;
@Schema(description = "所属计划名称")
private String planName;
@Schema(description = "所属模块") @Schema(description = "所属模块")
private String moduleName; private String moduleName;
@Schema(description = "用例等级") @Schema(description = "用例等级")

View File

@ -26,7 +26,7 @@
<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, 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_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, 0 as bugCount, 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

View File

@ -25,7 +25,7 @@
<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, 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_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, 0 as bugCount, 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

View File

@ -5,7 +5,7 @@
<select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportFunctionCase"> <select id="getPlanExecuteCases" resultType="io.metersphere.plan.domain.TestPlanReportFunctionCase">
select tpfc.id as testPlanFunctionCaseId, fc.id as functionCaseId, fc.num as functionCaseNum, fc.name as functionCaseName, tpfc.test_plan_collection_id testPlanCollectionId, select tpfc.id as testPlanFunctionCaseId, fc.id as functionCaseId, fc.num as functionCaseNum, fc.name as functionCaseName, tpfc.test_plan_collection_id testPlanCollectionId,
if(fc.module_id = 'root','未规划用例', fc.module_id) as functionCaseModule, tpfc.execute_user as functionCaseExecuteUser, if(fc.module_id = 'root','未规划用例', fc.module_id) as functionCaseModule, tpfc.execute_user as functionCaseExecuteUser,
count(brc.id) as functionCaseBugCount, ifnull(tpfc.last_exec_result, 'PENDING') as functionCaseExecuteResult, tpfc.pos pos count(brc.id) as functionCaseBugCount, ifnull(tpfc.last_exec_result, 'PENDING') as functionCaseExecuteResult, tpfc.pos as pos
from test_plan_functional_case tpfc join functional_case fc on tpfc.functional_case_id = fc.id from test_plan_functional_case tpfc join functional_case fc on tpfc.functional_case_id = fc.id
left join functional_case_module fcm on fcm.id = fc.module_id left join functional_case_module fcm on fcm.id = fc.module_id
left join bug_relation_case brc on brc.test_plan_case_id = tpfc.id left join bug_relation_case brc on brc.test_plan_case_id = tpfc.id
@ -46,7 +46,7 @@
<select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO"> <select id="list" resultType="io.metersphere.plan.dto.ReportDetailCasePageDTO">
<!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、报告ID --> <!-- ID、用例名称、所属模块、用例等级、执行人、执行结果、缺陷数、报告ID -->
select tprfc.function_case_id as id, tprfc.function_case_num as num, tprfc.function_case_name as name, select tprfc.function_case_id as id, tprfc.function_case_num as num, tprfc.function_case_name as name,
tprfc.function_case_module as moduleName, tprfc.function_case_priority as priority, tprfc.function_case_module as moduleName, tprfc.function_case_priority as priority, tprfc.test_plan_name as planName,
ifnull(tprfc.function_case_execute_result, 'PENDING') as executeResult, tprfc.function_case_execute_user as executeUser, ifnull(tprfc.function_case_execute_result, 'PENDING') as executeResult, tprfc.function_case_execute_user as executeUser,
ifnull(tprfc.function_case_bug_count, 0) as bugCount, tprfc.function_case_execute_report_id reportId, fc.project_id projectId ifnull(tprfc.function_case_bug_count, 0) as bugCount, tprfc.function_case_execute_report_id reportId, fc.project_id projectId
from test_plan_report_function_case tprfc from test_plan_report_function_case tprfc

View File

@ -117,9 +117,8 @@ public class TestPlanReportLogService {
* @param report 报告 * @param report 报告
* @param userId 用户ID * @param userId 用户ID
* @param projectId 项目ID * @param projectId 项目ID
* @param path 路径
*/ */
public void addLog(TestPlanReport report, String userId, String projectId, String path) { public void addLog(TestPlanReport report, String userId, String projectId) {
Project project = projectMapper.selectByPrimaryKey(projectId); Project project = projectMapper.selectByPrimaryKey(projectId);
LogDTO log = new LogDTO( LogDTO log = new LogDTO(
projectId, projectId,
@ -129,7 +128,6 @@ public class TestPlanReportLogService {
OperationLogType.ADD.name(), OperationLogType.ADD.name(),
report.getIntegrated() ? OperationLogModule.TEST_PLAN_GROUP_REPORT : OperationLogModule.TEST_PLAN_REPORT, report.getIntegrated() ? OperationLogModule.TEST_PLAN_GROUP_REPORT : OperationLogModule.TEST_PLAN_REPORT,
report.getName()); report.getName());
log.setPath(path);
log.setMethod(HttpMethodConstants.POST.name()); log.setMethod(HttpMethodConstants.POST.name());
log.setOriginalValue(JSON.toJSONBytes(report)); log.setOriginalValue(JSON.toJSONBytes(report));
operationLogService.add(log); operationLogService.add(log);

View File

@ -234,7 +234,7 @@ public class TestPlanReportService {
* 2. 保存报告布局组件 (只对当前生成的计划/组有效, 不会对下面的子计划报告生效) * 2. 保存报告布局组件 (只对当前生成的计划/组有效, 不会对下面的子计划报告生效)
* 3. 处理富文本图片 * 3. 处理富文本图片
*/ */
Map<String, String> reportMap = genReport(IDGenerator.nextStr(), request, true, currentUser, "/test-plan/report/gen"); Map<String, String> reportMap = genReport(IDGenerator.nextStr(), request, true, currentUser);
String genReportId = reportMap.get(request.getTestPlanId()); String genReportId = reportMap.get(request.getTestPlanId());
List<TestPlanReportComponentSaveRequest> components = request.getComponents(); List<TestPlanReportComponentSaveRequest> components = request.getComponents();
if (CollectionUtils.isNotEmpty(components)) { if (CollectionUtils.isNotEmpty(components)) {
@ -269,7 +269,7 @@ public class TestPlanReportService {
* @param currentUser 当前用户 * @param currentUser 当前用户
*/ */
public String genReportByAuto(TestPlanReportGenRequest request, String currentUser) { public String genReportByAuto(TestPlanReportGenRequest request, String currentUser) {
Map<String, String> reportMap = genReport(IDGenerator.nextStr(), request, true, currentUser, "/test-plan/report/gen"); Map<String, String> reportMap = genReport(IDGenerator.nextStr(), request, true, currentUser);
return reportMap.get(request.getTestPlanId()); return reportMap.get(request.getTestPlanId());
} }
@ -282,10 +282,10 @@ public class TestPlanReportService {
*/ */
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW)
public Map<String, String> genReportByExecution(String prepareReportId, TestPlanReportGenRequest request, String currentUser) { public Map<String, String> genReportByExecution(String prepareReportId, TestPlanReportGenRequest request, String currentUser) {
return genReport(prepareReportId, request, false, currentUser, "/test-plan/report/gen"); return genReport(prepareReportId, request, false, currentUser);
} }
public Map<String, String> genReport(String prepareReportId, TestPlanReportGenRequest request, boolean manual, String currentUser, String logPath) { public Map<String, String> genReport(String prepareReportId, TestPlanReportGenRequest request, boolean manual, String currentUser) {
Map<String, String> preReportMap = new HashMap<>(); Map<String, String> preReportMap = new HashMap<>();
try { try {
// 所有计划 // 所有计划
@ -312,7 +312,7 @@ public class TestPlanReportService {
genPreParam.setUseManual(manual); genPreParam.setUseManual(manual);
//如果是测试计划的独立报告使用参数中的预生成的报告id否则只有测试计划组报告使用该id //如果是测试计划的独立报告使用参数中的预生成的报告id否则只有测试计划组报告使用该id
String prepareItemReportId = isGroupReports ? IDGenerator.nextStr() : prepareReportId; String prepareItemReportId = isGroupReports ? IDGenerator.nextStr() : prepareReportId;
TestPlanReport preReport = preGenReport(prepareItemReportId, genPreParam, currentUser, logPath, moduleParam, childPlanIds); TestPlanReport preReport = preGenReport(prepareItemReportId, genPreParam, currentUser, moduleParam, childPlanIds);
if (manual) { if (manual) {
// 汇总 // 汇总
if (genPreParam.getIntegrated()) { if (genPreParam.getIntegrated()) {
@ -332,11 +332,9 @@ public class TestPlanReportService {
preReportMap.put(plan.getId(), preReport.getId()); preReportMap.put(plan.getId(), preReport.getId());
}); });
} catch (Exception e) { } catch (Exception e) {
LogUtils.error("生成报告异常: " + e.getMessage()); LogUtils.error("Generate report exception: " + e.getMessage());
} }
// 生成报告组件记录
return preReportMap; return preReportMap;
} }
@ -345,7 +343,7 @@ public class TestPlanReportService {
* *
* @return 报告 * @return 报告
*/ */
public TestPlanReport preGenReport(String prepareId, TestPlanReportGenPreParam genParam, String currentUser, String logPath, TestPlanReportModuleParam moduleParam, List<String> childPlanIds) { public TestPlanReport preGenReport(String prepareId, TestPlanReportGenPreParam genParam, String currentUser, TestPlanReportModuleParam moduleParam, List<String> childPlanIds) {
// 计划配置 // 计划配置
TestPlanConfig config = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId()); TestPlanConfig config = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId());
@ -371,7 +369,7 @@ public class TestPlanReportService {
// 生成独立报告的关联数据 // 生成独立报告的关联数据
reportCaseDetail = genReportDetail(genParam, moduleParam, report); reportCaseDetail = genReportDetail(genParam, moduleParam, report);
} else { } else {
// TODO: 计划组报告暂不统计各用例类型, 汇总时再入库 // 计划组报告暂不统计各用例类型, 汇总时再入库
reportCaseDetail = TestPlanReportDetailCaseDTO.builder().build(); reportCaseDetail = TestPlanReportDetailCaseDTO.builder().build();
} }
// 报告统计内容 // 报告统计内容
@ -386,7 +384,7 @@ public class TestPlanReportService {
testPlanReportSummaryMapper.insertSelective(reportSummary); testPlanReportSummaryMapper.insertSelective(reportSummary);
// 报告日志 // 报告日志
testPlanReportLogService.addLog(report, currentUser, genParam.getProjectId(), logPath); testPlanReportLogService.addLog(report, currentUser, genParam.getProjectId());
return report; return report;
} }
@ -417,6 +415,7 @@ public class TestPlanReportService {
reportFunctionCases.forEach(reportFunctionalCase -> { reportFunctionCases.forEach(reportFunctionalCase -> {
reportFunctionalCase.setId(IDGenerator.nextStr()); reportFunctionalCase.setId(IDGenerator.nextStr());
reportFunctionalCase.setTestPlanReportId(report.getId()); reportFunctionalCase.setTestPlanReportId(report.getId());
reportFunctionalCase.setTestPlanName(genParam.getTestPlanName());
reportFunctionalCase.setFunctionCaseModule(moduleParam.getFunctionalModuleMap().getOrDefault(reportFunctionalCase.getFunctionCaseModule(), reportFunctionalCase.setFunctionCaseModule(moduleParam.getFunctionalModuleMap().getOrDefault(reportFunctionalCase.getFunctionCaseModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportFunctionalCase.getFunctionCaseModule())); ModuleTreeUtils.MODULE_PATH_PREFIX + reportFunctionalCase.getFunctionCaseModule()));
reportFunctionalCase.setFunctionCasePriority(casePriorityMap.get(reportFunctionalCase.getFunctionCaseId())); reportFunctionalCase.setFunctionCasePriority(casePriorityMap.get(reportFunctionalCase.getFunctionCaseId()));
@ -439,6 +438,7 @@ public class TestPlanReportService {
reportApiCases.forEach(reportApiCase -> { reportApiCases.forEach(reportApiCase -> {
reportApiCase.setId(IDGenerator.nextStr()); reportApiCase.setId(IDGenerator.nextStr());
reportApiCase.setTestPlanReportId(report.getId()); reportApiCase.setTestPlanReportId(report.getId());
reportApiCase.setTestPlanName(genParam.getTestPlanName());
reportApiCase.setApiCaseModule(moduleParam.getApiModuleMap().getOrDefault(reportApiCase.getApiCaseModule(), reportApiCase.setApiCaseModule(moduleParam.getApiModuleMap().getOrDefault(reportApiCase.getApiCaseModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportApiCase.getApiCaseModule())); ModuleTreeUtils.MODULE_PATH_PREFIX + reportApiCase.getApiCaseModule()));
//根据不超过数据库字段最大长度压缩模块名 //根据不超过数据库字段最大长度压缩模块名
@ -461,6 +461,7 @@ public class TestPlanReportService {
reportApiScenarios.forEach(reportApiScenario -> { reportApiScenarios.forEach(reportApiScenario -> {
reportApiScenario.setId(IDGenerator.nextStr()); reportApiScenario.setId(IDGenerator.nextStr());
reportApiScenario.setTestPlanReportId(report.getId()); reportApiScenario.setTestPlanReportId(report.getId());
reportApiScenario.setTestPlanName(genParam.getTestPlanName());
reportApiScenario.setApiScenarioModule(moduleParam.getScenarioModuleMap().getOrDefault(reportApiScenario.getApiScenarioModule(), reportApiScenario.setApiScenarioModule(moduleParam.getScenarioModuleMap().getOrDefault(reportApiScenario.getApiScenarioModule(),
ModuleTreeUtils.MODULE_PATH_PREFIX + reportApiScenario.getApiScenarioModule())); ModuleTreeUtils.MODULE_PATH_PREFIX + reportApiScenario.getApiScenarioModule()));
//根据不超过数据库字段最大长度压缩模块名 //根据不超过数据库字段最大长度压缩模块名

View File

@ -98,6 +98,8 @@ public class TestPlanService extends TestPlanBaseUtilsService {
@Resource @Resource
private TestPlanFunctionalCaseMapper testPlanFunctionalCaseMapper; private TestPlanFunctionalCaseMapper testPlanFunctionalCaseMapper;
@Resource @Resource
private TestPlanReportFunctionCaseMapper testPlanReportFunctionCaseMapper;
@Resource
private TestPlanApiCaseMapper testPlanApiCaseMapper; private TestPlanApiCaseMapper testPlanApiCaseMapper;
@Resource @Resource
private TestPlanApiScenarioMapper testPlanApiScenarioMapper; private TestPlanApiScenarioMapper testPlanApiScenarioMapper;
@ -146,6 +148,13 @@ public class TestPlanService extends TestPlanBaseUtilsService {
TestPlanFunctionalCase updateRecord = new TestPlanFunctionalCase(); TestPlanFunctionalCase updateRecord = new TestPlanFunctionalCase();
updateRecord.setLastExecResult(result); updateRecord.setLastExecResult(result);
testPlanFunctionalCaseMapper.updateByExampleSelective(updateRecord, updateExample); testPlanFunctionalCaseMapper.updateByExampleSelective(updateRecord, updateExample);
// 报告-功能用例的执行结果同步刷新
TestPlanReportFunctionCaseExample caseExample = new TestPlanReportFunctionCaseExample();
caseExample.createCriteria().andTestPlanReportIdEqualTo(testPlanReportId).andTestPlanFunctionCaseIdIn(funcCaseIds);
TestPlanReportFunctionCase reportFunctionCase = new TestPlanReportFunctionCase();
reportFunctionCase.setFunctionCaseExecuteResult(result);
reportFunctionCase.setFunctionCaseExecuteReportId(null);
testPlanReportFunctionCaseMapper.updateByExampleSelective(reportFunctionCase, caseExample);
}); });
} }
} }