refactor(测试计划): 修改报告详情汇总domain

This commit is contained in:
song-cc-rock 2024-06-11 18:28:30 +08:00 committed by 刘瑞斌
parent bad708148a
commit 62280513fd
5 changed files with 207 additions and 12 deletions

View File

@ -40,9 +40,25 @@ public class TestPlanReportSummary implements Serializable {
@Size(min = 1, max = 50, message = "{test_plan_report_summary.test_plan_report_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanReportId;
@Schema(description = "总结")
@Schema(description = "计划数量", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_plan_report_summary.plan_count.not_blank}", groups = {Created.class})
private Long planCount;
@Schema(title = "总结")
private String summary;
@Schema(description = "功能用例执行结果")
private byte[] functionalExecuteResult;
@Schema(description = "接口执行结果")
private byte[] apiExecuteResult;
@Schema(description = "场景执行结果")
private byte[] scenarioExecuteResult;
@Schema(description = "执行结果")
private byte[] executeResult;
private static final long serialVersionUID = 1L;
public enum Column {
@ -52,7 +68,12 @@ public class TestPlanReportSummary implements Serializable {
apiScenarioCount("api_scenario_count", "apiScenarioCount", "BIGINT", false),
bugCount("bug_count", "bugCount", "BIGINT", false),
testPlanReportId("test_plan_report_id", "testPlanReportId", "VARCHAR", false),
summary("summary", "summary", "LONGVARCHAR", false);
planCount("plan_count", "planCount", "BIGINT", false),
summary("summary", "summary", "LONGVARCHAR", false),
functionalExecuteResult("functional_execute_result", "functionalExecuteResult", "LONGVARBINARY", false),
apiExecuteResult("api_execute_result", "apiExecuteResult", "LONGVARBINARY", false),
scenarioExecuteResult("scenario_execute_result", "scenarioExecuteResult", "LONGVARBINARY", false),
executeResult("execute_result", "executeResult", "LONGVARBINARY", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -483,6 +483,66 @@ public class TestPlanReportSummaryExample {
addCriterion("test_plan_report_id not between", value1, value2, "testPlanReportId");
return (Criteria) this;
}
public Criteria andPlanCountIsNull() {
addCriterion("plan_count is null");
return (Criteria) this;
}
public Criteria andPlanCountIsNotNull() {
addCriterion("plan_count is not null");
return (Criteria) this;
}
public Criteria andPlanCountEqualTo(Long value) {
addCriterion("plan_count =", value, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountNotEqualTo(Long value) {
addCriterion("plan_count <>", value, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountGreaterThan(Long value) {
addCriterion("plan_count >", value, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountGreaterThanOrEqualTo(Long value) {
addCriterion("plan_count >=", value, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountLessThan(Long value) {
addCriterion("plan_count <", value, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountLessThanOrEqualTo(Long value) {
addCriterion("plan_count <=", value, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountIn(List<Long> values) {
addCriterion("plan_count in", values, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountNotIn(List<Long> values) {
addCriterion("plan_count not in", values, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountBetween(Long value1, Long value2) {
addCriterion("plan_count between", value1, value2, "planCount");
return (Criteria) this;
}
public Criteria andPlanCountNotBetween(Long value1, Long value2) {
addCriterion("plan_count not between", value1, value2, "planCount");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -8,9 +8,14 @@
<result column="api_scenario_count" jdbcType="BIGINT" property="apiScenarioCount" />
<result column="bug_count" jdbcType="BIGINT" property="bugCount" />
<result column="test_plan_report_id" jdbcType="VARCHAR" property="testPlanReportId" />
<result column="plan_count" jdbcType="BIGINT" property="planCount" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.plan.domain.TestPlanReportSummary">
<result column="summary" jdbcType="LONGVARCHAR" property="summary" />
<result column="functional_execute_result" jdbcType="LONGVARBINARY" property="functionalExecuteResult" />
<result column="api_execute_result" jdbcType="LONGVARBINARY" property="apiExecuteResult" />
<result column="scenario_execute_result" jdbcType="LONGVARBINARY" property="scenarioExecuteResult" />
<result column="execute_result" jdbcType="LONGVARBINARY" property="executeResult" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -71,10 +76,12 @@
</where>
</sql>
<sql id="Base_Column_List">
id, functional_case_count, api_case_count, api_scenario_count, bug_count, test_plan_report_id
id, functional_case_count, api_case_count, api_scenario_count, bug_count, test_plan_report_id,
plan_count
</sql>
<sql id="Blob_Column_List">
summary
summary, functional_execute_result, api_execute_result, scenario_execute_result,
execute_result
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.plan.domain.TestPlanReportSummaryExample" resultMap="ResultMapWithBLOBs">
select
@ -127,10 +134,14 @@
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanReportSummary">
insert into test_plan_report_summary (id, functional_case_count, api_case_count,
api_scenario_count, bug_count, test_plan_report_id,
summary)
plan_count, summary, functional_execute_result,
api_execute_result, scenario_execute_result,
execute_result)
values (#{id,jdbcType=VARCHAR}, #{functionalCaseCount,jdbcType=BIGINT}, #{apiCaseCount,jdbcType=BIGINT},
#{apiScenarioCount,jdbcType=BIGINT}, #{bugCount,jdbcType=BIGINT}, #{testPlanReportId,jdbcType=VARCHAR},
#{summary,jdbcType=LONGVARCHAR})
#{planCount,jdbcType=BIGINT}, #{summary,jdbcType=LONGVARCHAR}, #{functionalExecuteResult,jdbcType=LONGVARBINARY},
#{apiExecuteResult,jdbcType=LONGVARBINARY}, #{scenarioExecuteResult,jdbcType=LONGVARBINARY},
#{executeResult,jdbcType=LONGVARBINARY})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportSummary">
insert into test_plan_report_summary
@ -153,9 +164,24 @@
<if test="testPlanReportId != null">
test_plan_report_id,
</if>
<if test="planCount != null">
plan_count,
</if>
<if test="summary != null">
summary,
</if>
<if test="functionalExecuteResult != null">
functional_execute_result,
</if>
<if test="apiExecuteResult != null">
api_execute_result,
</if>
<if test="scenarioExecuteResult != null">
scenario_execute_result,
</if>
<if test="executeResult != null">
execute_result,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -176,9 +202,24 @@
<if test="testPlanReportId != null">
#{testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="planCount != null">
#{planCount,jdbcType=BIGINT},
</if>
<if test="summary != null">
#{summary,jdbcType=LONGVARCHAR},
</if>
<if test="functionalExecuteResult != null">
#{functionalExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="apiExecuteResult != null">
#{apiExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="scenarioExecuteResult != null">
#{scenarioExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="executeResult != null">
#{executeResult,jdbcType=LONGVARBINARY},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportSummaryExample" resultType="java.lang.Long">
@ -208,9 +249,24 @@
<if test="record.testPlanReportId != null">
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="record.planCount != null">
plan_count = #{record.planCount,jdbcType=BIGINT},
</if>
<if test="record.summary != null">
summary = #{record.summary,jdbcType=LONGVARCHAR},
</if>
<if test="record.functionalExecuteResult != null">
functional_execute_result = #{record.functionalExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="record.apiExecuteResult != null">
api_execute_result = #{record.apiExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="record.scenarioExecuteResult != null">
scenario_execute_result = #{record.scenarioExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="record.executeResult != null">
execute_result = #{record.executeResult,jdbcType=LONGVARBINARY},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -224,7 +280,12 @@
api_scenario_count = #{record.apiScenarioCount,jdbcType=BIGINT},
bug_count = #{record.bugCount,jdbcType=BIGINT},
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
summary = #{record.summary,jdbcType=LONGVARCHAR}
plan_count = #{record.planCount,jdbcType=BIGINT},
summary = #{record.summary,jdbcType=LONGVARCHAR},
functional_execute_result = #{record.functionalExecuteResult,jdbcType=LONGVARBINARY},
api_execute_result = #{record.apiExecuteResult,jdbcType=LONGVARBINARY},
scenario_execute_result = #{record.scenarioExecuteResult,jdbcType=LONGVARBINARY},
execute_result = #{record.executeResult,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -236,7 +297,8 @@
api_case_count = #{record.apiCaseCount,jdbcType=BIGINT},
api_scenario_count = #{record.apiScenarioCount,jdbcType=BIGINT},
bug_count = #{record.bugCount,jdbcType=BIGINT},
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR}
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
plan_count = #{record.planCount,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -259,9 +321,24 @@
<if test="testPlanReportId != null">
test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="planCount != null">
plan_count = #{planCount,jdbcType=BIGINT},
</if>
<if test="summary != null">
summary = #{summary,jdbcType=LONGVARCHAR},
</if>
<if test="functionalExecuteResult != null">
functional_execute_result = #{functionalExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="apiExecuteResult != null">
api_execute_result = #{apiExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="scenarioExecuteResult != null">
scenario_execute_result = #{scenarioExecuteResult,jdbcType=LONGVARBINARY},
</if>
<if test="executeResult != null">
execute_result = #{executeResult,jdbcType=LONGVARBINARY},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -272,7 +349,12 @@
api_scenario_count = #{apiScenarioCount,jdbcType=BIGINT},
bug_count = #{bugCount,jdbcType=BIGINT},
test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
summary = #{summary,jdbcType=LONGVARCHAR}
plan_count = #{planCount,jdbcType=BIGINT},
summary = #{summary,jdbcType=LONGVARCHAR},
functional_execute_result = #{functionalExecuteResult,jdbcType=LONGVARBINARY},
api_execute_result = #{apiExecuteResult,jdbcType=LONGVARBINARY},
scenario_execute_result = #{scenarioExecuteResult,jdbcType=LONGVARBINARY},
execute_result = #{executeResult,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanReportSummary">
@ -281,18 +363,22 @@
api_case_count = #{apiCaseCount,jdbcType=BIGINT},
api_scenario_count = #{apiScenarioCount,jdbcType=BIGINT},
bug_count = #{bugCount,jdbcType=BIGINT},
test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR}
test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
plan_count = #{planCount,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into test_plan_report_summary
(id, functional_case_count, api_case_count, api_scenario_count, bug_count, test_plan_report_id,
summary)
plan_count, summary, functional_execute_result, api_execute_result, scenario_execute_result,
execute_result)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.functionalCaseCount,jdbcType=BIGINT}, #{item.apiCaseCount,jdbcType=BIGINT},
#{item.apiScenarioCount,jdbcType=BIGINT}, #{item.bugCount,jdbcType=BIGINT}, #{item.testPlanReportId,jdbcType=VARCHAR},
#{item.summary,jdbcType=LONGVARCHAR})
#{item.planCount,jdbcType=BIGINT}, #{item.summary,jdbcType=LONGVARCHAR}, #{item.functionalExecuteResult,jdbcType=LONGVARBINARY},
#{item.apiExecuteResult,jdbcType=LONGVARBINARY}, #{item.scenarioExecuteResult,jdbcType=LONGVARBINARY},
#{item.executeResult,jdbcType=LONGVARBINARY})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -323,9 +409,24 @@
<if test="'test_plan_report_id'.toString() == column.value">
#{item.testPlanReportId,jdbcType=VARCHAR}
</if>
<if test="'plan_count'.toString() == column.value">
#{item.planCount,jdbcType=BIGINT}
</if>
<if test="'summary'.toString() == column.value">
#{item.summary,jdbcType=LONGVARCHAR}
</if>
<if test="'functional_execute_result'.toString() == column.value">
#{item.functionalExecuteResult,jdbcType=LONGVARBINARY}
</if>
<if test="'api_execute_result'.toString() == column.value">
#{item.apiExecuteResult,jdbcType=LONGVARBINARY}
</if>
<if test="'scenario_execute_result'.toString() == column.value">
#{item.scenarioExecuteResult,jdbcType=LONGVARBINARY}
</if>
<if test="'execute_result'.toString() == column.value">
#{item.executeResult,jdbcType=LONGVARBINARY}
</if>
</foreach>
)
</foreach>

View File

@ -44,10 +44,18 @@ alter table test_plan
-- 修改计划配置表
ALTER TABLE test_plan_config DROP `test_planning`;
-- 移除规划配置表
DROP TABLE `test_plan_allocation`;
-- 修改计划报告详情表字段
UPDATE test_plan_report_summary SET bug_count = 0 WHERE bug_count IS NULL;
ALTER TABLE test_plan_report_summary MODIFY `bug_count` BIGINT NOT NULL DEFAULT 0 COMMENT '缺陷数量';
ALTER TABLE test_plan_report_summary DROP `report_count`;
ALTER TABLE test_plan_report_summary ADD `plan_count` BIGINT NOT NULL DEFAULT 0 COMMENT '计划数量';
ALTER TABLE test_plan_report_summary ADD `functional_execute_result` BLOB COMMENT '功能用例执行结果';
ALTER TABLE test_plan_report_summary ADD `api_execute_result` BLOB COMMENT '接口执行结果';
ALTER TABLE test_plan_report_summary ADD `scenario_execute_result` BLOB COMMENT '场景执行结果';
ALTER TABLE test_plan_report_summary ADD `execute_result` BLOB COMMENT '执行结果';
-- 修改计划报告功能用例表字段
UPDATE test_plan_report_function_case SET function_case_bug_count = 0 WHERE function_case_bug_count IS NULL;

View File

@ -1,6 +1,7 @@
package io.metersphere.system.config.interceptor;
import io.metersphere.plan.domain.TestPlanCaseExecuteHistory;
import io.metersphere.plan.domain.TestPlanReportSummary;
import io.metersphere.sdk.util.CompressUtils;
import io.metersphere.system.utils.MybatisInterceptorConfig;
import org.springframework.context.annotation.Bean;
@ -17,6 +18,10 @@ public class TestPlanInterceptor {
configList.add(new MybatisInterceptorConfig(TestPlanCaseExecuteHistory.class, "content", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(TestPlanCaseExecuteHistory.class, "steps", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(TestPlanReportSummary.class, "functionalExecuteResult", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(TestPlanReportSummary.class, "apiExecuteResult", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(TestPlanReportSummary.class, "scenarioExecuteResult", CompressUtils.class, "zip", "unzip"));
configList.add(new MybatisInterceptorConfig(TestPlanReportSummary.class, "executeResult", CompressUtils.class, "zip", "unzip"));
return configList;
}