feat(测试计划): 补充报告手动生成功能

This commit is contained in:
song-cc-rock 2024-07-05 11:30:13 +08:00 committed by Craftsman
parent 450139c017
commit ef3971cfe5
14 changed files with 1351 additions and 20 deletions

View File

@ -87,6 +87,10 @@ public class TestPlanReport implements Serializable {
@Size(min = 1, max = 255, message = "{test_plan_report.test_plan_name.length_range}", groups = {Created.class, Updated.class})
private String testPlanName;
@Schema(description = "是否默认布局", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_plan_report.default_layout.not_blank}", groups = {Created.class})
private Boolean defaultLayout;
private static final long serialVersionUID = 1L;
public enum Column {
@ -107,7 +111,8 @@ public class TestPlanReport implements Serializable {
deleted("deleted", "deleted", "BIT", false),
executeRate("execute_rate", "executeRate", "DECIMAL", false),
parentId("parent_id", "parentId", "VARCHAR", false),
testPlanName("test_plan_name", "testPlanName", "VARCHAR", false);
testPlanName("test_plan_name", "testPlanName", "VARCHAR", false),
defaultLayout("default_layout", "defaultLayout", "BIT", false);
private static final String BEGINNING_DELIMITER = "`";

View File

@ -0,0 +1,127 @@
package io.metersphere.plan.domain;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
@Data
public class TestPlanReportComponent implements Serializable {
@Schema(title = "ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_component.id.not_blank}", groups = {Updated.class})
@Size(min = 1, max = 50, message = "{test_plan_report_component.id.length_range}", groups = {Created.class, Updated.class})
private String id;
@Schema(title = "测试计划报告ID", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_component.test_plan_report_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_component.test_plan_report_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanReportId;
@Schema(title = "组件名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_component.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_component.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(title = "组件标题", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_component.label.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{test_plan_report_component.label.length_range}", groups = {Created.class, Updated.class})
private String label;
@Schema(title = "组件分类", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_component.type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_component.type.length_range}", groups = {Created.class, Updated.class})
private String type;
@Schema(title = "自定义排序1开始整数递增", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_plan_report_component.pos.not_blank}", groups = {Created.class})
private Long pos;
@Schema(title = "组件内容")
private String value;
private static final long serialVersionUID = 1L;
public enum Column {
id("id", "id", "VARCHAR", false),
testPlanReportId("test_plan_report_id", "testPlanReportId", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
label("label", "label", "VARCHAR", true),
type("type", "type", "VARCHAR", true),
pos("pos", "pos", "BIGINT", false),
value("value", "value", "LONGVARCHAR", true);
private static final String BEGINNING_DELIMITER = "`";
private static final String ENDING_DELIMITER = "`";
private final String column;
private final boolean isColumnNameDelimited;
private final String javaProperty;
private final String jdbcType;
public String value() {
return this.column;
}
public String getValue() {
return this.column;
}
public String getJavaProperty() {
return this.javaProperty;
}
public String getJdbcType() {
return this.jdbcType;
}
Column(String column, String javaProperty, String jdbcType, boolean isColumnNameDelimited) {
this.column = column;
this.javaProperty = javaProperty;
this.jdbcType = jdbcType;
this.isColumnNameDelimited = isColumnNameDelimited;
}
public String desc() {
return this.getEscapedColumnName() + " DESC";
}
public String asc() {
return this.getEscapedColumnName() + " ASC";
}
public static Column[] excludes(Column ... excludes) {
ArrayList<Column> columns = new ArrayList<>(Arrays.asList(Column.values()));
if (excludes != null && excludes.length > 0) {
columns.removeAll(new ArrayList<>(Arrays.asList(excludes)));
}
return columns.toArray(new Column[]{});
}
public static Column[] all() {
return Column.values();
}
public String getEscapedColumnName() {
if (this.isColumnNameDelimited) {
return new StringBuilder().append(BEGINNING_DELIMITER).append(this.column).append(ENDING_DELIMITER).toString();
} else {
return this.column;
}
}
public String getAliasedEscapedColumnName() {
return this.getEscapedColumnName();
}
}
}

View File

@ -0,0 +1,610 @@
package io.metersphere.plan.domain;
import java.util.ArrayList;
import java.util.List;
public class TestPlanReportComponentExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public TestPlanReportComponentExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("id like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("id not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTestPlanReportIdIsNull() {
addCriterion("test_plan_report_id is null");
return (Criteria) this;
}
public Criteria andTestPlanReportIdIsNotNull() {
addCriterion("test_plan_report_id is not null");
return (Criteria) this;
}
public Criteria andTestPlanReportIdEqualTo(String value) {
addCriterion("test_plan_report_id =", value, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdNotEqualTo(String value) {
addCriterion("test_plan_report_id <>", value, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdGreaterThan(String value) {
addCriterion("test_plan_report_id >", value, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_report_id >=", value, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdLessThan(String value) {
addCriterion("test_plan_report_id <", value, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdLessThanOrEqualTo(String value) {
addCriterion("test_plan_report_id <=", value, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdLike(String value) {
addCriterion("test_plan_report_id like", value, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdNotLike(String value) {
addCriterion("test_plan_report_id not like", value, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdIn(List<String> values) {
addCriterion("test_plan_report_id in", values, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdNotIn(List<String> values) {
addCriterion("test_plan_report_id not in", values, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdBetween(String value1, String value2) {
addCriterion("test_plan_report_id between", value1, value2, "testPlanReportId");
return (Criteria) this;
}
public Criteria andTestPlanReportIdNotBetween(String value1, String value2) {
addCriterion("test_plan_report_id not between", value1, value2, "testPlanReportId");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("`name` is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("`name` is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("`name` =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("`name` <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("`name` >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("`name` >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("`name` <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("`name` <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("`name` like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("`name` not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("`name` in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("`name` not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("`name` between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("`name` not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andLabelIsNull() {
addCriterion("`label` is null");
return (Criteria) this;
}
public Criteria andLabelIsNotNull() {
addCriterion("`label` is not null");
return (Criteria) this;
}
public Criteria andLabelEqualTo(String value) {
addCriterion("`label` =", value, "label");
return (Criteria) this;
}
public Criteria andLabelNotEqualTo(String value) {
addCriterion("`label` <>", value, "label");
return (Criteria) this;
}
public Criteria andLabelGreaterThan(String value) {
addCriterion("`label` >", value, "label");
return (Criteria) this;
}
public Criteria andLabelGreaterThanOrEqualTo(String value) {
addCriterion("`label` >=", value, "label");
return (Criteria) this;
}
public Criteria andLabelLessThan(String value) {
addCriterion("`label` <", value, "label");
return (Criteria) this;
}
public Criteria andLabelLessThanOrEqualTo(String value) {
addCriterion("`label` <=", value, "label");
return (Criteria) this;
}
public Criteria andLabelLike(String value) {
addCriterion("`label` like", value, "label");
return (Criteria) this;
}
public Criteria andLabelNotLike(String value) {
addCriterion("`label` not like", value, "label");
return (Criteria) this;
}
public Criteria andLabelIn(List<String> values) {
addCriterion("`label` in", values, "label");
return (Criteria) this;
}
public Criteria andLabelNotIn(List<String> values) {
addCriterion("`label` not in", values, "label");
return (Criteria) this;
}
public Criteria andLabelBetween(String value1, String value2) {
addCriterion("`label` between", value1, value2, "label");
return (Criteria) this;
}
public Criteria andLabelNotBetween(String value1, String value2) {
addCriterion("`label` not between", value1, value2, "label");
return (Criteria) this;
}
public Criteria andTypeIsNull() {
addCriterion("`type` is null");
return (Criteria) this;
}
public Criteria andTypeIsNotNull() {
addCriterion("`type` is not null");
return (Criteria) this;
}
public Criteria andTypeEqualTo(String value) {
addCriterion("`type` =", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotEqualTo(String value) {
addCriterion("`type` <>", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThan(String value) {
addCriterion("`type` >", value, "type");
return (Criteria) this;
}
public Criteria andTypeGreaterThanOrEqualTo(String value) {
addCriterion("`type` >=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThan(String value) {
addCriterion("`type` <", value, "type");
return (Criteria) this;
}
public Criteria andTypeLessThanOrEqualTo(String value) {
addCriterion("`type` <=", value, "type");
return (Criteria) this;
}
public Criteria andTypeLike(String value) {
addCriterion("`type` like", value, "type");
return (Criteria) this;
}
public Criteria andTypeNotLike(String value) {
addCriterion("`type` not like", value, "type");
return (Criteria) this;
}
public Criteria andTypeIn(List<String> values) {
addCriterion("`type` in", values, "type");
return (Criteria) this;
}
public Criteria andTypeNotIn(List<String> values) {
addCriterion("`type` not in", values, "type");
return (Criteria) this;
}
public Criteria andTypeBetween(String value1, String value2) {
addCriterion("`type` between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andTypeNotBetween(String value1, String value2) {
addCriterion("`type` not between", value1, value2, "type");
return (Criteria) this;
}
public Criteria andPosIsNull() {
addCriterion("pos is null");
return (Criteria) this;
}
public Criteria andPosIsNotNull() {
addCriterion("pos is not null");
return (Criteria) this;
}
public Criteria andPosEqualTo(Long value) {
addCriterion("pos =", value, "pos");
return (Criteria) this;
}
public Criteria andPosNotEqualTo(Long value) {
addCriterion("pos <>", value, "pos");
return (Criteria) this;
}
public Criteria andPosGreaterThan(Long value) {
addCriterion("pos >", value, "pos");
return (Criteria) this;
}
public Criteria andPosGreaterThanOrEqualTo(Long value) {
addCriterion("pos >=", value, "pos");
return (Criteria) this;
}
public Criteria andPosLessThan(Long value) {
addCriterion("pos <", value, "pos");
return (Criteria) this;
}
public Criteria andPosLessThanOrEqualTo(Long value) {
addCriterion("pos <=", value, "pos");
return (Criteria) this;
}
public Criteria andPosIn(List<Long> values) {
addCriterion("pos in", values, "pos");
return (Criteria) this;
}
public Criteria andPosNotIn(List<Long> values) {
addCriterion("pos not in", values, "pos");
return (Criteria) this;
}
public Criteria andPosBetween(Long value1, Long value2) {
addCriterion("pos between", value1, value2, "pos");
return (Criteria) this;
}
public Criteria andPosNotBetween(Long value1, Long value2) {
addCriterion("pos not between", value1, value2, "pos");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

View File

@ -1284,6 +1284,66 @@ public class TestPlanReportExample {
addCriterion("test_plan_name not between", value1, value2, "testPlanName");
return (Criteria) this;
}
public Criteria andDefaultLayoutIsNull() {
addCriterion("default_layout is null");
return (Criteria) this;
}
public Criteria andDefaultLayoutIsNotNull() {
addCriterion("default_layout is not null");
return (Criteria) this;
}
public Criteria andDefaultLayoutEqualTo(Boolean value) {
addCriterion("default_layout =", value, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutNotEqualTo(Boolean value) {
addCriterion("default_layout <>", value, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutGreaterThan(Boolean value) {
addCriterion("default_layout >", value, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutGreaterThanOrEqualTo(Boolean value) {
addCriterion("default_layout >=", value, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutLessThan(Boolean value) {
addCriterion("default_layout <", value, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutLessThanOrEqualTo(Boolean value) {
addCriterion("default_layout <=", value, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutIn(List<Boolean> values) {
addCriterion("default_layout in", values, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutNotIn(List<Boolean> values) {
addCriterion("default_layout not in", values, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutBetween(Boolean value1, Boolean value2) {
addCriterion("default_layout between", value1, value2, "defaultLayout");
return (Criteria) this;
}
public Criteria andDefaultLayoutNotBetween(Boolean value1, Boolean value2) {
addCriterion("default_layout not between", value1, value2, "defaultLayout");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {

View File

@ -0,0 +1,41 @@
package io.metersphere.plan.mapper;
import io.metersphere.plan.domain.TestPlanReportComponent;
import io.metersphere.plan.domain.TestPlanReportComponentExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface TestPlanReportComponentMapper {
long countByExample(TestPlanReportComponentExample example);
int deleteByExample(TestPlanReportComponentExample example);
int deleteByPrimaryKey(String id);
int insert(TestPlanReportComponent record);
int insertSelective(TestPlanReportComponent record);
List<TestPlanReportComponent> selectByExampleWithBLOBs(TestPlanReportComponentExample example);
List<TestPlanReportComponent> selectByExample(TestPlanReportComponentExample example);
TestPlanReportComponent selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") TestPlanReportComponent record, @Param("example") TestPlanReportComponentExample example);
int updateByExampleWithBLOBs(@Param("record") TestPlanReportComponent record, @Param("example") TestPlanReportComponentExample example);
int updateByExample(@Param("record") TestPlanReportComponent record, @Param("example") TestPlanReportComponentExample example);
int updateByPrimaryKeySelective(TestPlanReportComponent record);
int updateByPrimaryKeyWithBLOBs(TestPlanReportComponent record);
int updateByPrimaryKey(TestPlanReportComponent record);
int batchInsert(@Param("list") List<TestPlanReportComponent> list);
int batchInsertSelective(@Param("list") List<TestPlanReportComponent> list, @Param("selective") TestPlanReportComponent.Column ... selective);
}

View File

@ -0,0 +1,332 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.plan.mapper.TestPlanReportComponentMapper">
<resultMap id="BaseResultMap" type="io.metersphere.plan.domain.TestPlanReportComponent">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="test_plan_report_id" jdbcType="VARCHAR" property="testPlanReportId" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="label" jdbcType="VARCHAR" property="label" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="pos" jdbcType="BIGINT" property="pos" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.plan.domain.TestPlanReportComponent">
<result column="value" jdbcType="LONGVARCHAR" property="value" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
id, test_plan_report_id, `name`, `label`, `type`, pos
</sql>
<sql id="Blob_Column_List">
`value`
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.plan.domain.TestPlanReportComponentExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from test_plan_report_component
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportComponentExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from test_plan_report_component
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from test_plan_report_component
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from test_plan_report_component
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.plan.domain.TestPlanReportComponentExample">
delete from test_plan_report_component
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.plan.domain.TestPlanReportComponent">
insert into test_plan_report_component (id, test_plan_report_id, `name`,
`label`, `type`, pos, `value`
)
values (#{id,jdbcType=VARCHAR}, #{testPlanReportId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{label,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, #{pos,jdbcType=BIGINT}, #{value,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReportComponent">
insert into test_plan_report_component
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="testPlanReportId != null">
test_plan_report_id,
</if>
<if test="name != null">
`name`,
</if>
<if test="label != null">
`label`,
</if>
<if test="type != null">
`type`,
</if>
<if test="pos != null">
pos,
</if>
<if test="value != null">
`value`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=VARCHAR},
</if>
<if test="testPlanReportId != null">
#{testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="label != null">
#{label,jdbcType=VARCHAR},
</if>
<if test="type != null">
#{type,jdbcType=VARCHAR},
</if>
<if test="pos != null">
#{pos,jdbcType=BIGINT},
</if>
<if test="value != null">
#{value,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportComponentExample" resultType="java.lang.Long">
select count(*) from test_plan_report_component
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update test_plan_report_component
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
</if>
<if test="record.testPlanReportId != null">
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="record.name != null">
`name` = #{record.name,jdbcType=VARCHAR},
</if>
<if test="record.label != null">
`label` = #{record.label,jdbcType=VARCHAR},
</if>
<if test="record.type != null">
`type` = #{record.type,jdbcType=VARCHAR},
</if>
<if test="record.pos != null">
pos = #{record.pos,jdbcType=BIGINT},
</if>
<if test="record.value != null">
`value` = #{record.value,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update test_plan_report_component
set id = #{record.id,jdbcType=VARCHAR},
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`label` = #{record.label,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
pos = #{record.pos,jdbcType=BIGINT},
`value` = #{record.value,jdbcType=LONGVARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
update test_plan_report_component
set id = #{record.id,jdbcType=VARCHAR},
test_plan_report_id = #{record.testPlanReportId,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
`label` = #{record.label,jdbcType=VARCHAR},
`type` = #{record.type,jdbcType=VARCHAR},
pos = #{record.pos,jdbcType=BIGINT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.plan.domain.TestPlanReportComponent">
update test_plan_report_component
<set>
<if test="testPlanReportId != null">
test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
</if>
<if test="name != null">
`name` = #{name,jdbcType=VARCHAR},
</if>
<if test="label != null">
`label` = #{label,jdbcType=VARCHAR},
</if>
<if test="type != null">
`type` = #{type,jdbcType=VARCHAR},
</if>
<if test="pos != null">
pos = #{pos,jdbcType=BIGINT},
</if>
<if test="value != null">
`value` = #{value,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.plan.domain.TestPlanReportComponent">
update test_plan_report_component
set test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`label` = #{label,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
pos = #{pos,jdbcType=BIGINT},
`value` = #{value,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.plan.domain.TestPlanReportComponent">
update test_plan_report_component
set test_plan_report_id = #{testPlanReportId,jdbcType=VARCHAR},
`name` = #{name,jdbcType=VARCHAR},
`label` = #{label,jdbcType=VARCHAR},
`type` = #{type,jdbcType=VARCHAR},
pos = #{pos,jdbcType=BIGINT}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into test_plan_report_component
(id, test_plan_report_id, `name`, `label`, `type`, pos, `value`)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanReportId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
#{item.label,jdbcType=VARCHAR}, #{item.type,jdbcType=VARCHAR}, #{item.pos,jdbcType=BIGINT},
#{item.value,jdbcType=LONGVARCHAR})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
insert into test_plan_report_component (
<foreach collection="selective" item="column" separator=",">
${column.escapedColumnName}
</foreach>
)
values
<foreach collection="list" item="item" separator=",">
(
<foreach collection="selective" item="column" separator=",">
<if test="'id'.toString() == column.value">
#{item.id,jdbcType=VARCHAR}
</if>
<if test="'test_plan_report_id'.toString() == column.value">
#{item.testPlanReportId,jdbcType=VARCHAR}
</if>
<if test="'name'.toString() == column.value">
#{item.name,jdbcType=VARCHAR}
</if>
<if test="'label'.toString() == column.value">
#{item.label,jdbcType=VARCHAR}
</if>
<if test="'type'.toString() == column.value">
#{item.type,jdbcType=VARCHAR}
</if>
<if test="'pos'.toString() == column.value">
#{item.pos,jdbcType=BIGINT}
</if>
<if test="'value'.toString() == column.value">
#{item.value,jdbcType=LONGVARCHAR}
</if>
</foreach>
)
</foreach>
</insert>
</mapper>

View File

@ -20,6 +20,7 @@
<result column="execute_rate" jdbcType="DECIMAL" property="executeRate" />
<result column="parent_id" jdbcType="VARCHAR" property="parentId" />
<result column="test_plan_name" jdbcType="VARCHAR" property="testPlanName" />
<result column="default_layout" jdbcType="BIT" property="defaultLayout" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
@ -82,7 +83,7 @@
<sql id="Base_Column_List">
id, test_plan_id, `name`, create_user, create_time, start_time, end_time, exec_status,
result_status, pass_rate, trigger_mode, pass_threshold, project_id, integrated, deleted,
execute_rate, parent_id, test_plan_name
execute_rate, parent_id, test_plan_name, default_layout
</sql>
<select id="selectByExample" parameterType="io.metersphere.plan.domain.TestPlanReportExample" resultMap="BaseResultMap">
select
@ -120,15 +121,15 @@
end_time, exec_status, result_status,
pass_rate, trigger_mode, pass_threshold,
project_id, integrated, deleted,
execute_rate, parent_id, test_plan_name
)
execute_rate, parent_id, test_plan_name,
default_layout)
values (#{id,jdbcType=VARCHAR}, #{testPlanId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT},
#{endTime,jdbcType=BIGINT}, #{execStatus,jdbcType=VARCHAR}, #{resultStatus,jdbcType=VARCHAR},
#{passRate,jdbcType=DECIMAL}, #{triggerMode,jdbcType=VARCHAR}, #{passThreshold,jdbcType=DECIMAL},
#{projectId,jdbcType=VARCHAR}, #{integrated,jdbcType=BIT}, #{deleted,jdbcType=BIT},
#{executeRate,jdbcType=DECIMAL}, #{parentId,jdbcType=VARCHAR}, #{testPlanName,jdbcType=VARCHAR}
)
#{executeRate,jdbcType=DECIMAL}, #{parentId,jdbcType=VARCHAR}, #{testPlanName,jdbcType=VARCHAR},
#{defaultLayout,jdbcType=BIT})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.plan.domain.TestPlanReport">
insert into test_plan_report
@ -187,6 +188,9 @@
<if test="testPlanName != null">
test_plan_name,
</if>
<if test="defaultLayout != null">
default_layout,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -243,6 +247,9 @@
<if test="testPlanName != null">
#{testPlanName,jdbcType=VARCHAR},
</if>
<if test="defaultLayout != null">
#{defaultLayout,jdbcType=BIT},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.plan.domain.TestPlanReportExample" resultType="java.lang.Long">
@ -308,6 +315,9 @@
<if test="record.testPlanName != null">
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
</if>
<if test="record.defaultLayout != null">
default_layout = #{record.defaultLayout,jdbcType=BIT},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
@ -332,7 +342,8 @@
deleted = #{record.deleted,jdbcType=BIT},
execute_rate = #{record.executeRate,jdbcType=DECIMAL},
parent_id = #{record.parentId,jdbcType=VARCHAR},
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR}
test_plan_name = #{record.testPlanName,jdbcType=VARCHAR},
default_layout = #{record.defaultLayout,jdbcType=BIT}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
@ -391,6 +402,9 @@
<if test="testPlanName != null">
test_plan_name = #{testPlanName,jdbcType=VARCHAR},
</if>
<if test="defaultLayout != null">
default_layout = #{defaultLayout,jdbcType=BIT},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
@ -412,14 +426,15 @@
deleted = #{deleted,jdbcType=BIT},
execute_rate = #{executeRate,jdbcType=DECIMAL},
parent_id = #{parentId,jdbcType=VARCHAR},
test_plan_name = #{testPlanName,jdbcType=VARCHAR}
test_plan_name = #{testPlanName,jdbcType=VARCHAR},
default_layout = #{defaultLayout,jdbcType=BIT}
where id = #{id,jdbcType=VARCHAR}
</update>
<insert id="batchInsert" parameterType="map">
insert into test_plan_report
(id, test_plan_id, `name`, create_user, create_time, start_time, end_time, exec_status,
result_status, pass_rate, trigger_mode, pass_threshold, project_id, integrated,
deleted, execute_rate, parent_id, test_plan_name)
deleted, execute_rate, parent_id, test_plan_name, default_layout)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.testPlanId,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR},
@ -427,8 +442,8 @@
#{item.endTime,jdbcType=BIGINT}, #{item.execStatus,jdbcType=VARCHAR}, #{item.resultStatus,jdbcType=VARCHAR},
#{item.passRate,jdbcType=DECIMAL}, #{item.triggerMode,jdbcType=VARCHAR}, #{item.passThreshold,jdbcType=DECIMAL},
#{item.projectId,jdbcType=VARCHAR}, #{item.integrated,jdbcType=BIT}, #{item.deleted,jdbcType=BIT},
#{item.executeRate,jdbcType=DECIMAL}, #{item.parentId,jdbcType=VARCHAR}, #{item.testPlanName,jdbcType=VARCHAR}
)
#{item.executeRate,jdbcType=DECIMAL}, #{item.parentId,jdbcType=VARCHAR}, #{item.testPlanName,jdbcType=VARCHAR},
#{item.defaultLayout,jdbcType=BIT})
</foreach>
</insert>
<insert id="batchInsertSelective" parameterType="map">
@ -495,6 +510,9 @@
<if test="'test_plan_name'.toString() == column.value">
#{item.testPlanName,jdbcType=VARCHAR}
</if>
<if test="'default_layout'.toString() == column.value">
#{item.defaultLayout,jdbcType=BIT}
</if>
</foreach>
)
</foreach>

View File

@ -3,7 +3,19 @@ SET SESSION innodb_lock_wait_timeout = 7200;
DROP TABLE IF EXISTS functional_mind_insert_relation;
-- 报告添加默认布局字段
ALTER TABLE test_plan_report ADD `default_layout` BIT NOT NULL DEFAULT 1 COMMENT '是否默认布局';
CREATE TABLE IF NOT EXISTS test_plan_report_component(
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,
`test_plan_report_id` VARCHAR(50) NOT NULL COMMENT '测试计划报告ID' ,
`name` VARCHAR(50) NOT NULL COMMENT '组件名称' ,
`label` VARCHAR(255) NOT NULL COMMENT '组件标题' ,
`type` VARCHAR(50) NOT NULL COMMENT '组件分类' ,
`value` LONGTEXT COMMENT '组件内容' ,
`pos` BIGINT NOT NULL COMMENT '自定义排序1开始整数递增' ,
PRIMARY KEY (id)
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '测试计划报告逐组件表';
-- set innodb lock wait timeout to default
SET SESSION innodb_lock_wait_timeout = DEFAULT;

View File

@ -87,15 +87,24 @@ public class TestPlanReportController {
testPlanReportService.batchSetReportDelete(request, SessionUtils.getUserId());
}
@PostMapping("/gen")
@Operation(summary = "测试计划-详情-生成报告")
@PostMapping("/manual-gen")
@Operation(summary = "测试计划-详情-手动生成报告")
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
public void genReportByManual(@Validated @RequestBody TestPlanReportGenRequest request) {
public void genReportByManual(@Validated @RequestBody TestPlanReportManualRequest request) {
testPlanService.checkTestPlanNotArchived(request.getTestPlanId());
testPlanReportService.genReportByManual(request, SessionUtils.getUserId());
}
@PostMapping("/auto-gen")
@Operation(summary = "测试计划-详情-自动生成报告")
@RequiresPermissions(PermissionConstants.TEST_PLAN_READ_EXECUTE)
@CheckOwner(resourceId = "#request.getTestPlanId()", resourceType = "test_plan")
public void genReportByAuto(@Validated @RequestBody TestPlanReportGenRequest request) {
testPlanService.checkTestPlanNotArchived(request.getTestPlanId());
testPlanReportService.genReportByAuto(request, SessionUtils.getUserId());
}
// 报告详情开始
@GetMapping("/get/{reportId}")

View File

@ -0,0 +1,35 @@
package io.metersphere.plan.dto.request;
import io.metersphere.validation.groups.Created;
import io.metersphere.validation.groups.Updated;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
@Data
public class TestPlanReportComponentSaveRequest {
@Schema(title = "组件名称", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_component.name.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_component.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(title = "组件标题", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_component.label.not_blank}", groups = {Created.class})
@Size(min = 1, max = 255, message = "{test_plan_report_component.label.length_range}", groups = {Created.class, Updated.class})
private String label;
@Schema(title = "组件分类", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{test_plan_report_component.type.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{test_plan_report_component.type.length_range}", groups = {Created.class, Updated.class})
private String type;
@Schema(title = "组件内容")
private String value;
@Schema(title = "自定义排序1开始整数递增", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "{test_plan_report_component.pos.not_blank}", groups = {Created.class})
private Long pos;
}

View File

@ -0,0 +1,19 @@
package io.metersphere.plan.dto.request;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
public class TestPlanReportManualRequest extends TestPlanReportGenRequest{
@Schema(description = "报告名称", requiredMode = Schema.RequiredMode.REQUIRED)
private String reportName;
@Schema(description = "报告组件集合")
private List<TestPlanReportComponentSaveRequest> components;
@Schema(description = "富文本组件临时生成的文件ID(图片)")
private List<String> richTextTmpFileIds;
}

View File

@ -226,7 +226,45 @@ public class TestPlanReportService {
* @param request 请求参数
* @param currentUser 当前用户
*/
public void genReportByManual(TestPlanReportGenRequest request, String currentUser) {
public void genReportByManual(TestPlanReportManualRequest request, String currentUser) {
/*
* 1. 生成报告 (全量生成; 暂不根据布局来选择生成报告预览数据, 因为影响分析汇总)
* 2. 保存报告布局组件 (只对当前生成的计划/组有效, 不会对下面的子计划报告生效)
* 3. 处理富文本图片
*/
Map<String, String> reportMap = genReport(IDGenerator.nextStr(), request, true, currentUser, "/test-plan/report/gen");
String genReportId = reportMap.get(request.getTestPlanId());
List<TestPlanReportComponentSaveRequest> components = request.getComponents();
if (CollectionUtils.isNotEmpty(components)) {
SqlSession sqlSession = sqlSessionFactory.openSession(ExecutorType.BATCH);
TestPlanReportComponentMapper batchMapper = sqlSession.getMapper(TestPlanReportComponentMapper.class);
List<TestPlanReportComponent> reportComponents = new ArrayList<>();
components.forEach(component -> {
TestPlanReportComponent reportComponent = new TestPlanReportComponent();
BeanUtils.copyBean(reportComponent, component);
reportComponent.setId(IDGenerator.nextStr());
reportComponent.setTestPlanReportId(genReportId);
reportComponents.add(reportComponent);
});
batchMapper.batchInsert(reportComponents);
sqlSession.flushStatements();
SqlSessionUtils.closeSqlSession(sqlSession, sqlSessionFactory);
}
// 更新报告默认布局字段
TestPlanReport record = new TestPlanReport();
record.setId(genReportId);
record.setDefaultLayout(false);
testPlanReportMapper.updateByPrimaryKey(record);
// 处理富文本文件
transferRichTextTmpFile(genReportId, request.getProjectId(), request.getRichTextTmpFileIds(), currentUser, TestPlanReportAttachmentSourceType.RICH_TEXT.name());
}
/**
* 自动生成报告 (计划 或者 )
* @param request 请求参数
* @param currentUser 当前用户
*/
public void genReportByAuto(TestPlanReportGenRequest request, String currentUser) {
genReport(IDGenerator.nextStr(), request, true, currentUser, "/test-plan/report/gen");
}
@ -291,6 +329,9 @@ public class TestPlanReportService {
} catch (Exception e) {
LogUtils.error("生成报告异常: " + e.getMessage());
}
// 生成报告组件记录
return preReportMap;
}
@ -325,7 +366,7 @@ public class TestPlanReportService {
// 生成独立报告的关联数据
reportCaseDetail = genReportDetail(genParam, moduleParam, report);
} else {
// 计划组报告暂不统计各用例类型, 汇总时再入库
// TODO: 计划组报告暂不统计各用例类型, 汇总时再入库
reportCaseDetail = TestPlanReportDetailCaseDTO.builder().build();
}
// 报告统计内容

View File

@ -45,7 +45,8 @@ public class TestPlanReportControllerTests extends BaseTest {
private static final String RENAME_PLAN_REPORT = "/test-plan/report/rename";
private static final String DELETE_PLAN_REPORT = "/test-plan/report/delete";
private static final String BATCH_DELETE_PLAN_REPORT = "/test-plan/report/batch-delete";
private static final String GEN_PLAN_REPORT = "/test-plan/report/gen";
private static final String MANUAL_GEN_PLAN_REPORT = "/test-plan/report/manual-gen";
private static final String AUTO_GEN_PLAN_REPORT = "/test-plan/report/auto-gen";
private static final String GET_PLAN_REPORT = "/test-plan/report/get";
private static final String EDIT_PLAN_REPORT_AND_UPLOAD_PIC = "/test-plan/report/upload/md/file";
private static final String EDIT_PLAN_REPORT = "/test-plan/report/detail/edit";
@ -269,7 +270,7 @@ public class TestPlanReportControllerTests extends BaseTest {
TestPlanReportGenRequest genRequest = new TestPlanReportGenRequest();
genRequest.setProjectId("100001100001");
genRequest.setTestPlanId("plan_id_for_gen_report-x");
this.requestPost(GEN_PLAN_REPORT, genRequest, status().is5xxServerError());
this.requestPost(AUTO_GEN_PLAN_REPORT, genRequest, status().is5xxServerError());
}
@Test
@ -279,9 +280,9 @@ public class TestPlanReportControllerTests extends BaseTest {
genRequest.setProjectId("100001100001");
genRequest.setTestPlanId("plan_id_for_gen_report_1");
genRequest.setTriggerMode(TaskTriggerMode.MANUAL.name());
this.requestPost(GEN_PLAN_REPORT, genRequest);
this.requestPost(AUTO_GEN_PLAN_REPORT, genRequest);
genRequest.setTestPlanId("plan_id_for_gen_report");
this.requestPost(GEN_PLAN_REPORT, genRequest);
this.requestPost(AUTO_GEN_PLAN_REPORT, genRequest);
GEN_REPORT_ID = getGenReportId();
}
@ -355,6 +356,26 @@ public class TestPlanReportControllerTests extends BaseTest {
this.requestGet(GET_PLAN_REPORT_DETAIL_FUNCTIONAL_RESULT + "/execute-his-2");
}
@Test
@Order(20)
void testGenReportByManual() throws Exception {
TestPlanReportComponentSaveRequest component = new TestPlanReportComponentSaveRequest();
component.setName("component-for-test");
component.setType("RICH_TEXT");
component.setLabel("component-for-test");
component.setValue("Val for test!");
component.setPos(1L);
TestPlanReportManualRequest genRequest = new TestPlanReportManualRequest();
genRequest.setProjectId("100001100001");
genRequest.setTestPlanId("plan_id_for_gen_report");
genRequest.setTriggerMode(TaskTriggerMode.MANUAL.name());
genRequest.setReportName("oasis");
genRequest.setComponents(List.of(component));
this.requestPost(MANUAL_GEN_PLAN_REPORT, genRequest);
genRequest.setComponents(null);
this.requestPost(MANUAL_GEN_PLAN_REPORT, genRequest);
}
@Resource
private TestPlanReportSummaryMapper testPlanReportSummaryMapper;
@Resource

View File

@ -614,6 +614,7 @@ public class TestPlanTests extends BaseTest {
testPlanReport.setIntegrated(false);
testPlanReport.setDeleted(false);
testPlanReport.setTestPlanName("test");
testPlanReport.setDefaultLayout(true);
batchInsert.insert(testPlanReport);
}
sqlSession.flushStatements();