fix(测试计划): 修复测试计划报告详情展示问题&&生成报告日志缺失

--bug=1040811 --user=宋昌昌 【测试计划】计划详情-生成报告-未生成系统日志 https://www.tapd.cn/55049933/s/1517457
This commit is contained in:
song-cc-rock 2024-05-21 17:26:48 +08:00 committed by Craftsman
parent 73f1b1df6c
commit 43c1ac26dc
14 changed files with 160 additions and 52 deletions

View File

@ -44,6 +44,10 @@ public class TestPlanReportBug implements Serializable {
@Schema(description = "缺陷处理人") @Schema(description = "缺陷处理人")
private String bugHandleUser; private String bugHandleUser;
@Schema(description = "缺陷用例数", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_plan_report_bug.bug_case_count.not_blank}", groups = {Created.class})
private Long bugCaseCount;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public enum Column { public enum Column {
@ -53,7 +57,8 @@ public class TestPlanReportBug implements Serializable {
bugNum("bug_num", "bugNum", "BIGINT", false), bugNum("bug_num", "bugNum", "BIGINT", false),
bugTitle("bug_title", "bugTitle", "VARCHAR", false), bugTitle("bug_title", "bugTitle", "VARCHAR", false),
bugStatus("bug_status", "bugStatus", "VARCHAR", false), bugStatus("bug_status", "bugStatus", "VARCHAR", false),
bugHandleUser("bug_handle_user", "bugHandleUser", "VARCHAR", false); bugHandleUser("bug_handle_user", "bugHandleUser", "VARCHAR", false),
bugCaseCount("bug_case_count", "bugCaseCount", "BIGINT", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -583,6 +583,66 @@ public class TestPlanReportBugExample {
addCriterion("bug_handle_user not between", value1, value2, "bugHandleUser"); addCriterion("bug_handle_user not between", value1, value2, "bugHandleUser");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andBugCaseCountIsNull() {
addCriterion("bug_case_count is null");
return (Criteria) this;
}
public Criteria andBugCaseCountIsNotNull() {
addCriterion("bug_case_count is not null");
return (Criteria) this;
}
public Criteria andBugCaseCountEqualTo(Long value) {
addCriterion("bug_case_count =", value, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountNotEqualTo(Long value) {
addCriterion("bug_case_count <>", value, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountGreaterThan(Long value) {
addCriterion("bug_case_count >", value, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountGreaterThanOrEqualTo(Long value) {
addCriterion("bug_case_count >=", value, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountLessThan(Long value) {
addCriterion("bug_case_count <", value, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountLessThanOrEqualTo(Long value) {
addCriterion("bug_case_count <=", value, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountIn(List<Long> values) {
addCriterion("bug_case_count in", values, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountNotIn(List<Long> values) {
addCriterion("bug_case_count not in", values, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountBetween(Long value1, Long value2) {
addCriterion("bug_case_count between", value1, value2, "bugCaseCount");
return (Criteria) this;
}
public Criteria andBugCaseCountNotBetween(Long value1, Long value2) {
addCriterion("bug_case_count not between", value1, value2, "bugCaseCount");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -53,7 +53,7 @@ public class TestPlanReportFunctionCase implements Serializable {
private String functionCaseExecuteUser; private String functionCaseExecuteUser;
@Schema(description = "功能用例关联缺陷数") @Schema(description = "功能用例关联缺陷数")
private String functionCaseBugCount; private Long functionCaseBugCount;
@Schema(description = "执行结果", requiredMode = Schema.RequiredMode.REQUIRED) @Schema(description = "执行结果", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_function_case.function_case_execute_result.not_blank}", groups = {Created.class}) @NotBlank(message = "{test_plan_report_function_case.function_case_execute_result.not_blank}", groups = {Created.class})
@ -72,7 +72,7 @@ public class TestPlanReportFunctionCase implements Serializable {
functionCaseModule("function_case_module", "functionCaseModule", "VARCHAR", false), functionCaseModule("function_case_module", "functionCaseModule", "VARCHAR", false),
functionCasePriority("function_case_priority", "functionCasePriority", "VARCHAR", false), functionCasePriority("function_case_priority", "functionCasePriority", "VARCHAR", false),
functionCaseExecuteUser("function_case_execute_user", "functionCaseExecuteUser", "VARCHAR", false), functionCaseExecuteUser("function_case_execute_user", "functionCaseExecuteUser", "VARCHAR", false),
functionCaseBugCount("function_case_bug_count", "functionCaseBugCount", "VARCHAR", false), functionCaseBugCount("function_case_bug_count", "functionCaseBugCount", "BIGINT", false),
functionCaseExecuteResult("function_case_execute_result", "functionCaseExecuteResult", "VARCHAR", false); functionCaseExecuteResult("function_case_execute_result", "functionCaseExecuteResult", "VARCHAR", false);
private static final String BEGINNING_DELIMITER = "`"; private static final String BEGINNING_DELIMITER = "`";

View File

@ -734,62 +734,52 @@ public class TestPlanReportFunctionCaseExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountEqualTo(String value) { public Criteria andFunctionCaseBugCountEqualTo(Long value) {
addCriterion("function_case_bug_count =", value, "functionCaseBugCount"); addCriterion("function_case_bug_count =", value, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountNotEqualTo(String value) { public Criteria andFunctionCaseBugCountNotEqualTo(Long value) {
addCriterion("function_case_bug_count <>", value, "functionCaseBugCount"); addCriterion("function_case_bug_count <>", value, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountGreaterThan(String value) { public Criteria andFunctionCaseBugCountGreaterThan(Long value) {
addCriterion("function_case_bug_count >", value, "functionCaseBugCount"); addCriterion("function_case_bug_count >", value, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountGreaterThanOrEqualTo(String value) { public Criteria andFunctionCaseBugCountGreaterThanOrEqualTo(Long value) {
addCriterion("function_case_bug_count >=", value, "functionCaseBugCount"); addCriterion("function_case_bug_count >=", value, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountLessThan(String value) { public Criteria andFunctionCaseBugCountLessThan(Long value) {
addCriterion("function_case_bug_count <", value, "functionCaseBugCount"); addCriterion("function_case_bug_count <", value, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountLessThanOrEqualTo(String value) { public Criteria andFunctionCaseBugCountLessThanOrEqualTo(Long value) {
addCriterion("function_case_bug_count <=", value, "functionCaseBugCount"); addCriterion("function_case_bug_count <=", value, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountLike(String value) { public Criteria andFunctionCaseBugCountIn(List<Long> values) {
addCriterion("function_case_bug_count like", value, "functionCaseBugCount");
return (Criteria) this;
}
public Criteria andFunctionCaseBugCountNotLike(String value) {
addCriterion("function_case_bug_count not like", value, "functionCaseBugCount");
return (Criteria) this;
}
public Criteria andFunctionCaseBugCountIn(List<String> values) {
addCriterion("function_case_bug_count in", values, "functionCaseBugCount"); addCriterion("function_case_bug_count in", values, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountNotIn(List<String> values) { public Criteria andFunctionCaseBugCountNotIn(List<Long> values) {
addCriterion("function_case_bug_count not in", values, "functionCaseBugCount"); addCriterion("function_case_bug_count not in", values, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountBetween(String value1, String value2) { public Criteria andFunctionCaseBugCountBetween(Long value1, Long value2) {
addCriterion("function_case_bug_count between", value1, value2, "functionCaseBugCount"); addCriterion("function_case_bug_count between", value1, value2, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andFunctionCaseBugCountNotBetween(String value1, String value2) { public Criteria andFunctionCaseBugCountNotBetween(Long value1, Long value2) {
addCriterion("function_case_bug_count not between", value1, value2, "functionCaseBugCount"); addCriterion("function_case_bug_count not between", value1, value2, "functionCaseBugCount");
return (Criteria) this; return (Criteria) this;
} }

View File

@ -2,9 +2,8 @@ package io.metersphere.plan.mapper;
import io.metersphere.plan.domain.TestPlanReportBug; import io.metersphere.plan.domain.TestPlanReportBug;
import io.metersphere.plan.domain.TestPlanReportBugExample; import io.metersphere.plan.domain.TestPlanReportBugExample;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestPlanReportBugMapper { public interface TestPlanReportBugMapper {
long countByExample(TestPlanReportBugExample example); long countByExample(TestPlanReportBugExample example);

View File

@ -9,6 +9,7 @@
<result column="bug_title" jdbcType="VARCHAR" property="bugTitle" /> <result column="bug_title" jdbcType="VARCHAR" property="bugTitle" />
<result column="bug_status" jdbcType="VARCHAR" property="bugStatus" /> <result column="bug_status" jdbcType="VARCHAR" property="bugStatus" />
<result column="bug_handle_user" jdbcType="VARCHAR" property="bugHandleUser" /> <result column="bug_handle_user" jdbcType="VARCHAR" property="bugHandleUser" />
<result column="bug_case_count" jdbcType="BIGINT" property="bugCaseCount" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
<where> <where>
@ -69,7 +70,8 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, test_plan_report_id, bug_id, bug_num, bug_title, bug_status, bug_handle_user id, test_plan_report_id, bug_id, bug_num, bug_title, bug_status, bug_handle_user,
bug_case_count
</sql> </sql>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportBugExample" resultMap="BaseResultMap"> <select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportBugExample" resultMap="BaseResultMap">
select select
@ -104,10 +106,10 @@
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanReportBug"> <insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanReportBug">
insert into test_plan_report_bug (id, test_plan_report_id, bug_id, insert into test_plan_report_bug (id, test_plan_report_id, bug_id,
bug_num, bug_title, bug_status, bug_num, bug_title, bug_status,
bug_handle_user) bug_handle_user, bug_case_count)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{bugId,jdbcType=VARCHAR}, values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{bugId,jdbcType=VARCHAR},
#{bugNum,jdbcType=BIGINT}, #{bugTitle,jdbcType=VARCHAR}, #{bugStatus,jdbcType=VARCHAR}, #{bugNum,jdbcType=BIGINT}, #{bugTitle,jdbcType=VARCHAR}, #{bugStatus,jdbcType=VARCHAR},
#{bugHandleUser,jdbcType=VARCHAR}) #{bugHandleUser,jdbcType=VARCHAR}, #{bugCaseCount,jdbcType=BIGINT})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportBug"> <insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportBug">
insert into test_plan_report_bug insert into test_plan_report_bug
@ -133,6 +135,9 @@
<if test="bugHandleUser != null"> <if test="bugHandleUser != null">
bug_handle_user, bug_handle_user,
</if> </if>
<if test="bugCaseCount != null">
bug_case_count,
</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -156,6 +161,9 @@
<if test="bugHandleUser != null"> <if test="bugHandleUser != null">
#{bugHandleUser,jdbcType=VARCHAR}, #{bugHandleUser,jdbcType=VARCHAR},
</if> </if>
<if test="bugCaseCount != null">
#{bugCaseCount,jdbcType=BIGINT},
</if>
</trim> </trim>
</insert> </insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportBugExample" resultType="java.lang.Long"> <select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportBugExample" resultType="java.lang.Long">
@ -188,6 +196,9 @@
<if test="record.bugHandleUser != null"> <if test="record.bugHandleUser != null">
bug_handle_user = #{record.bugHandleUser,jdbcType=VARCHAR}, bug_handle_user = #{record.bugHandleUser,jdbcType=VARCHAR},
</if> </if>
<if test="record.bugCaseCount != null">
bug_case_count = #{record.bugCaseCount,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" />
@ -201,7 +212,8 @@
bug_num = #{record.bugNum,jdbcType=BIGINT}, bug_num = #{record.bugNum,jdbcType=BIGINT},
bug_title = #{record.bugTitle,jdbcType=VARCHAR}, bug_title = #{record.bugTitle,jdbcType=VARCHAR},
bug_status = #{record.bugStatus,jdbcType=VARCHAR}, bug_status = #{record.bugStatus,jdbcType=VARCHAR},
bug_handle_user = #{record.bugHandleUser,jdbcType=VARCHAR} bug_handle_user = #{record.bugHandleUser,jdbcType=VARCHAR},
bug_case_count = #{record.bugCaseCount,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>
@ -227,6 +239,9 @@
<if test="bugHandleUser != null"> <if test="bugHandleUser != null">
bug_handle_user = #{bugHandleUser,jdbcType=VARCHAR}, bug_handle_user = #{bugHandleUser,jdbcType=VARCHAR},
</if> </if>
<if test="bugCaseCount != null">
bug_case_count = #{bugCaseCount,jdbcType=BIGINT},
</if>
</set> </set>
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -237,18 +252,19 @@
bug_num = #{bugNum,jdbcType=BIGINT}, bug_num = #{bugNum,jdbcType=BIGINT},
bug_title = #{bugTitle,jdbcType=VARCHAR}, bug_title = #{bugTitle,jdbcType=VARCHAR},
bug_status = #{bugStatus,jdbcType=VARCHAR}, bug_status = #{bugStatus,jdbcType=VARCHAR},
bug_handle_user = #{bugHandleUser,jdbcType=VARCHAR} bug_handle_user = #{bugHandleUser,jdbcType=VARCHAR},
bug_case_count = #{bugCaseCount,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_bug insert into test_plan_report_bug
(id, test_plan_report_id, bug_id, bug_num, bug_title, bug_status, bug_handle_user (id, test_plan_report_id, bug_id, bug_num, bug_title, bug_status, bug_handle_user,
) bug_case_count)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.bugId,jdbcType=VARCHAR}, (#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.bugId,jdbcType=VARCHAR},
#{item.bugNum,jdbcType=BIGINT}, #{item.bugTitle,jdbcType=VARCHAR}, #{item.bugStatus,jdbcType=VARCHAR}, #{item.bugNum,jdbcType=BIGINT}, #{item.bugTitle,jdbcType=VARCHAR}, #{item.bugStatus,jdbcType=VARCHAR},
#{item.bugHandleUser,jdbcType=VARCHAR}) #{item.bugHandleUser,jdbcType=VARCHAR}, #{item.bugCaseCount,jdbcType=BIGINT})
</foreach> </foreach>
</insert> </insert>
<insert id="batchInsertSelective" parameterType="map"> <insert id="batchInsertSelective" parameterType="map">
@ -282,6 +298,9 @@
<if test="'bug_handle_user'.toString() == column.value"> <if test="'bug_handle_user'.toString() == column.value">
#{item.bugHandleUser,jdbcType=VARCHAR} #{item.bugHandleUser,jdbcType=VARCHAR}
</if> </if>
<if test="'bug_case_count'.toString() == column.value">
#{item.bugCaseCount,jdbcType=BIGINT}
</if>
</foreach> </foreach>
) )
</foreach> </foreach>

View File

@ -2,9 +2,8 @@ package io.metersphere.plan.mapper;
import io.metersphere.plan.domain.TestPlanReportFunctionCase; import io.metersphere.plan.domain.TestPlanReportFunctionCase;
import io.metersphere.plan.domain.TestPlanReportFunctionCaseExample; import io.metersphere.plan.domain.TestPlanReportFunctionCaseExample;
import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface TestPlanReportFunctionCaseMapper { public interface TestPlanReportFunctionCaseMapper {
long countByExample(TestPlanReportFunctionCaseExample example); long countByExample(TestPlanReportFunctionCaseExample example);

View File

@ -11,7 +11,7 @@
<result column="function_case_module" jdbcType="VARCHAR" property="functionCaseModule" /> <result column="function_case_module" jdbcType="VARCHAR" property="functionCaseModule" />
<result column="function_case_priority" jdbcType="VARCHAR" property="functionCasePriority" /> <result column="function_case_priority" jdbcType="VARCHAR" property="functionCasePriority" />
<result column="function_case_execute_user" jdbcType="VARCHAR" property="functionCaseExecuteUser" /> <result column="function_case_execute_user" jdbcType="VARCHAR" property="functionCaseExecuteUser" />
<result column="function_case_bug_count" jdbcType="VARCHAR" property="functionCaseBugCount" /> <result column="function_case_bug_count" jdbcType="BIGINT" property="functionCaseBugCount" />
<result column="function_case_execute_result" jdbcType="VARCHAR" property="functionCaseExecuteResult" /> <result column="function_case_execute_result" jdbcType="VARCHAR" property="functionCaseExecuteResult" />
</resultMap> </resultMap>
<sql id="Example_Where_Clause"> <sql id="Example_Where_Clause">
@ -116,7 +116,7 @@
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=VARCHAR}, #{functionCaseExecuteUser,jdbcType=VARCHAR}, #{functionCaseBugCount,jdbcType=BIGINT},
#{functionCaseExecuteResult,jdbcType=VARCHAR}) #{functionCaseExecuteResult,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCase"> <insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportFunctionCase">
@ -185,7 +185,7 @@
#{functionCaseExecuteUser,jdbcType=VARCHAR}, #{functionCaseExecuteUser,jdbcType=VARCHAR},
</if> </if>
<if test="functionCaseBugCount != null"> <if test="functionCaseBugCount != null">
#{functionCaseBugCount,jdbcType=VARCHAR}, #{functionCaseBugCount,jdbcType=BIGINT},
</if> </if>
<if test="functionCaseExecuteResult != null"> <if test="functionCaseExecuteResult != null">
#{functionCaseExecuteResult,jdbcType=VARCHAR}, #{functionCaseExecuteResult,jdbcType=VARCHAR},
@ -229,7 +229,7 @@
function_case_execute_user = #{record.functionCaseExecuteUser,jdbcType=VARCHAR}, function_case_execute_user = #{record.functionCaseExecuteUser,jdbcType=VARCHAR},
</if> </if>
<if test="record.functionCaseBugCount != null"> <if test="record.functionCaseBugCount != null">
function_case_bug_count = #{record.functionCaseBugCount,jdbcType=VARCHAR}, function_case_bug_count = #{record.functionCaseBugCount,jdbcType=BIGINT},
</if> </if>
<if test="record.functionCaseExecuteResult != null"> <if test="record.functionCaseExecuteResult != null">
function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR}, function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR},
@ -250,7 +250,7 @@
function_case_module = #{record.functionCaseModule,jdbcType=VARCHAR}, function_case_module = #{record.functionCaseModule,jdbcType=VARCHAR},
function_case_priority = #{record.functionCasePriority,jdbcType=VARCHAR}, function_case_priority = #{record.functionCasePriority,jdbcType=VARCHAR},
function_case_execute_user = #{record.functionCaseExecuteUser,jdbcType=VARCHAR}, function_case_execute_user = #{record.functionCaseExecuteUser,jdbcType=VARCHAR},
function_case_bug_count = #{record.functionCaseBugCount,jdbcType=VARCHAR}, function_case_bug_count = #{record.functionCaseBugCount,jdbcType=BIGINT},
function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR} function_case_execute_result = #{record.functionCaseExecuteResult,jdbcType=VARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -284,7 +284,7 @@
function_case_execute_user = #{functionCaseExecuteUser,jdbcType=VARCHAR}, function_case_execute_user = #{functionCaseExecuteUser,jdbcType=VARCHAR},
</if> </if>
<if test="functionCaseBugCount != null"> <if test="functionCaseBugCount != null">
function_case_bug_count = #{functionCaseBugCount,jdbcType=VARCHAR}, function_case_bug_count = #{functionCaseBugCount,jdbcType=BIGINT},
</if> </if>
<if test="functionCaseExecuteResult != null"> <if test="functionCaseExecuteResult != null">
function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR}, function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR},
@ -302,7 +302,7 @@
function_case_module = #{functionCaseModule,jdbcType=VARCHAR}, function_case_module = #{functionCaseModule,jdbcType=VARCHAR},
function_case_priority = #{functionCasePriority,jdbcType=VARCHAR}, function_case_priority = #{functionCasePriority,jdbcType=VARCHAR},
function_case_execute_user = #{functionCaseExecuteUser,jdbcType=VARCHAR}, function_case_execute_user = #{functionCaseExecuteUser,jdbcType=VARCHAR},
function_case_bug_count = #{functionCaseBugCount,jdbcType=VARCHAR}, function_case_bug_count = #{functionCaseBugCount,jdbcType=BIGINT},
function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR} function_case_execute_result = #{functionCaseExecuteResult,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</update> </update>
@ -317,7 +317,7 @@
#{item.functionCaseId,jdbcType=VARCHAR}, #{item.functionCaseNum,jdbcType=BIGINT}, #{item.functionCaseId,jdbcType=VARCHAR}, #{item.functionCaseNum,jdbcType=BIGINT},
#{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=VARCHAR}, #{item.functionCaseExecuteResult,jdbcType=VARCHAR} #{item.functionCaseBugCount,jdbcType=BIGINT}, #{item.functionCaseExecuteResult,jdbcType=VARCHAR}
) )
</foreach> </foreach>
</insert> </insert>
@ -359,7 +359,7 @@
#{item.functionCaseExecuteUser,jdbcType=VARCHAR} #{item.functionCaseExecuteUser,jdbcType=VARCHAR}
</if> </if>
<if test="'function_case_bug_count'.toString() == column.value"> <if test="'function_case_bug_count'.toString() == column.value">
#{item.functionCaseBugCount,jdbcType=VARCHAR} #{item.functionCaseBugCount,jdbcType=BIGINT}
</if> </if>
<if test="'function_case_execute_result'.toString() == column.value"> <if test="'function_case_execute_result'.toString() == column.value">
#{item.functionCaseExecuteResult,jdbcType=VARCHAR} #{item.functionCaseExecuteResult,jdbcType=VARCHAR}

View File

@ -122,7 +122,7 @@ CREATE TABLE IF NOT EXISTS test_plan_report_function_case(
`function_case_module` VARCHAR(255) COMMENT '功能用例所属模块' , `function_case_module` VARCHAR(255) COMMENT '功能用例所属模块' ,
`function_case_priority` VARCHAR(50) COMMENT '功能用例用例等级' , `function_case_priority` VARCHAR(50) COMMENT '功能用例用例等级' ,
`function_case_execute_user` VARCHAR(50) COMMENT '功能用例执行人' , `function_case_execute_user` VARCHAR(50) COMMENT '功能用例执行人' ,
`function_case_bug_count` VARCHAR(255) COMMENT '功能用例关联缺陷数' , `function_case_bug_count` BIGINT COMMENT '功能用例关联缺陷数' ,
`function_case_execute_result` VARCHAR(50) NOT NULL COMMENT '执行结果' , `function_case_execute_result` VARCHAR(50) NOT NULL COMMENT '执行结果' ,
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 = '测试计划报告内容功能用例部分';
@ -137,6 +137,7 @@ CREATE TABLE IF NOT EXISTS test_plan_report_bug(
`bug_title` VARCHAR(255) NOT NULL COMMENT '缺陷标题' , `bug_title` VARCHAR(255) NOT NULL COMMENT '缺陷标题' ,
`bug_status` VARCHAR(50) COMMENT '缺陷状态' , `bug_status` VARCHAR(50) COMMENT '缺陷状态' ,
`bug_handle_user` VARCHAR(50) COMMENT '缺陷处理人' , `bug_handle_user` VARCHAR(50) COMMENT '缺陷处理人' ,
`bug_case_count` BIGINT NOT NULL COMMENT '缺陷用例数' ,
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 = '测试计划报告内容缺陷部分';

View File

@ -799,7 +799,13 @@ public class BugService {
// 状态从内置自定义字段中获取 // 状态从内置自定义字段中获取
Optional<BugCustomFieldDTO> statusField = request.getCustomFields().stream().filter(field -> StringUtils.equals(field.getId(), BugTemplateCustomField.STATUS.getId())).findFirst(); Optional<BugCustomFieldDTO> statusField = request.getCustomFields().stream().filter(field -> StringUtils.equals(field.getId(), BugTemplateCustomField.STATUS.getId())).findFirst();
if (statusField.isPresent()) { if (statusField.isPresent()) {
if (StringUtils.isBlank(statusField.get().getValue()) && StringUtils.equalsIgnoreCase(BugPlatform.LOCAL.getName(), platformName)) {
// Local平台设置状态默认值为状态流-开始状态
List<SelectOption> localStartStatusItem = bugStatusService.getToStatusItemOptionOnLocal(request.getProjectId(), StringUtils.EMPTY);
bug.setStatus(localStartStatusItem.get(0).getValue());
} else {
bug.setStatus(statusField.get().getValue()); bug.setStatus(statusField.get().getValue());
}
request.getCustomFields().removeIf(field -> StringUtils.equals(field.getId(), BugTemplateCustomField.STATUS.getId())); request.getCustomFields().removeIf(field -> StringUtils.equals(field.getId(), BugTemplateCustomField.STATUS.getId()));
} else { } else {
throw new MSException(Translator.get("bug_status_can_not_be_empty")); throw new MSException(Translator.get("bug_status_can_not_be_empty"));

View File

@ -25,7 +25,7 @@ public class OrganizationEditRequest implements Serializable {
private String name; private String name;
@Schema(description = "描述") @Schema(description = "描述")
@Size(max = 500, groups = {Created.class, Updated.class}) @Size(max = 1000, groups = {Created.class, Updated.class})
private String description; private String description;
@Schema(description = "成员ID集合") @Schema(description = "成员ID集合")

View File

@ -3,13 +3,16 @@
<mapper namespace="io.metersphere.plan.mapper.ExtTestPlanReportBugMapper"> <mapper namespace="io.metersphere.plan.mapper.ExtTestPlanReportBugMapper">
<select id="getPlanBugs" resultType="io.metersphere.plan.domain.TestPlanReportBug"> <select id="getPlanBugs" resultType="io.metersphere.plan.domain.TestPlanReportBug">
select b.id as bugId, b.num as bugNum, b.title as bugTitle, b.status bugStatus, b.handle_user bugHandleUser select distinct brc.bug_id as bugId, b.num as bugNum, b.title as bugTitle, b.status bugStatus,
from bug_relation_case brc join bug b b.handle_user bugHandleUser, count(brc.id) bugCaseCount
from bug_relation_case brc join bug b on brc.bug_id = b.id
where brc.test_plan_id = #{id} where brc.test_plan_id = #{id}
group by brc.bug_id
</select> </select>
<select id="list" resultType="io.metersphere.bug.dto.response.BugDTO"> <select id="list" resultType="io.metersphere.bug.dto.response.BugDTO">
select distinct tprb.bug_id as id, tprb.bug_num as num, tprb.bug_title as title, tprb.bug_status as status, tprb.bug_handle_user as handleUser select tprb.bug_id as id, tprb.bug_num as num, tprb.bug_title as title, tprb.bug_status as status, tprb.bug_handle_user as handleUserName,
tprb.bug_case_count as relationCaseCount
from test_plan_report_bug tprb from test_plan_report_bug tprb
where tprb.test_plan_report_id = #{request.reportId} where tprb.test_plan_report_id = #{request.reportId}
</select> </select>

View File

@ -93,4 +93,27 @@ public class TestPlanReportLogService {
}); });
operationLogService.batchAdd(logs); operationLogService.batchAdd(logs);
} }
/**
* 生成报告日志
* @param report 报告
* @param userId 用户ID
* @param projectId 项目ID
* @param path 路径
*/
public void addLog(TestPlanReport report, String userId, String projectId, String path) {
Project project = projectMapper.selectByPrimaryKey(projectId);
LogDTO log = new LogDTO(
projectId,
project.getOrganizationId(),
report.getId(),
userId,
OperationLogType.ADD.name(),
OperationLogModule.TEST_PLAN_REPORT,
report.getName());
log.setPath(path);
log.setMethod(HttpMethodConstants.POST.name());
log.setOriginalValue(JSON.toJSONBytes(report));
operationLogService.add(log);
}
} }

View File

@ -211,7 +211,7 @@ public class TestPlanReportService {
genPreParam.setResultStatus("-"); genPreParam.setResultStatus("-");
// 是否集成报告, 目前根据是否计划组来区分 // 是否集成报告, 目前根据是否计划组来区分
genPreParam.setIntegrated(StringUtils.equals(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_GROUP)); genPreParam.setIntegrated(StringUtils.equals(testPlan.getType(), TestPlanConstants.TEST_PLAN_TYPE_GROUP));
TestPlanReport preReport = preGenReport(genPreParam, currentUser); TestPlanReport preReport = preGenReport(genPreParam, currentUser, "/test-plan/report/gen");
TestPlanReportPostParam postParam = new TestPlanReportPostParam(); TestPlanReportPostParam postParam = new TestPlanReportPostParam();
BeanUtils.copyBean(postParam, request); BeanUtils.copyBean(postParam, request);
postParam.setReportId(preReport.getId()); postParam.setReportId(preReport.getId());
@ -227,7 +227,7 @@ public class TestPlanReportService {
* 预生成报告内容(后续拆分优化) * 预生成报告内容(后续拆分优化)
* @return 报告 * @return 报告
*/ */
public TestPlanReport preGenReport(TestPlanReportGenPreParam genParam, String currentUser) { public TestPlanReport preGenReport(TestPlanReportGenPreParam genParam, String currentUser, String logPath) {
// 准备计划数据 // 准备计划数据
TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId()); TestPlanConfig testPlanConfig = testPlanConfigMapper.selectByPrimaryKey(genParam.getTestPlanId());
@ -298,6 +298,9 @@ public class TestPlanReportService {
report.setDeleted(false); report.setDeleted(false);
report.setPassThreshold(testPlanConfig.getPassThreshold()); report.setPassThreshold(testPlanConfig.getPassThreshold());
testPlanReportMapper.insertSelective(report); testPlanReportMapper.insertSelective(report);
// 插入生成报告日志
testPlanReportLogService.addLog(report, currentUser, genParam.getProjectId(), logPath);
return report; return report;
} }