测试报告模版curd

This commit is contained in:
chenjianxing 2020-05-06 16:03:39 +08:00
parent e370620c97
commit 4dc949864b
19 changed files with 805 additions and 180 deletions

View File

@ -9,6 +9,10 @@ public class TestCaseReport implements Serializable {
private String planId; private String planId;
private Long startTime;
private Long endTime;
private String content; private String content;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -37,6 +41,22 @@ public class TestCaseReport implements Serializable {
this.planId = planId == null ? null : planId.trim(); this.planId = planId == null ? null : planId.trim();
} }
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public String getContent() { public String getContent() {
return content; return content;
} }

View File

@ -303,6 +303,126 @@ public class TestCaseReportExample {
addCriterion("plan_id not between", value1, value2, "planId"); addCriterion("plan_id not between", value1, value2, "planId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStartTimeIsNull() {
addCriterion("start_time is null");
return (Criteria) this;
}
public Criteria andStartTimeIsNotNull() {
addCriterion("start_time is not null");
return (Criteria) this;
}
public Criteria andStartTimeEqualTo(Long value) {
addCriterion("start_time =", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotEqualTo(Long value) {
addCriterion("start_time <>", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThan(Long value) {
addCriterion("start_time >", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThanOrEqualTo(Long value) {
addCriterion("start_time >=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThan(Long value) {
addCriterion("start_time <", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThanOrEqualTo(Long value) {
addCriterion("start_time <=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeIn(List<Long> values) {
addCriterion("start_time in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotIn(List<Long> values) {
addCriterion("start_time not in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeBetween(Long value1, Long value2) {
addCriterion("start_time between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotBetween(Long value1, Long value2) {
addCriterion("start_time not between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andEndTimeIsNull() {
addCriterion("end_time is null");
return (Criteria) this;
}
public Criteria andEndTimeIsNotNull() {
addCriterion("end_time is not null");
return (Criteria) this;
}
public Criteria andEndTimeEqualTo(Long value) {
addCriterion("end_time =", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotEqualTo(Long value) {
addCriterion("end_time <>", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThan(Long value) {
addCriterion("end_time >", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("end_time >=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThan(Long value) {
addCriterion("end_time <", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThanOrEqualTo(Long value) {
addCriterion("end_time <=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeIn(List<Long> values) {
addCriterion("end_time in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotIn(List<Long> values) {
addCriterion("end_time not in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeBetween(Long value1, Long value2) {
addCriterion("end_time between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotBetween(Long value1, Long value2) {
addCriterion("end_time not between", value1, value2, "endTime");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -9,6 +9,10 @@ public class TestCaseReportTemplate implements Serializable {
private String workspaceId; private String workspaceId;
private Long startTime;
private Long endTime;
private String content; private String content;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -37,6 +41,22 @@ public class TestCaseReportTemplate implements Serializable {
this.workspaceId = workspaceId == null ? null : workspaceId.trim(); this.workspaceId = workspaceId == null ? null : workspaceId.trim();
} }
public Long getStartTime() {
return startTime;
}
public void setStartTime(Long startTime) {
this.startTime = startTime;
}
public Long getEndTime() {
return endTime;
}
public void setEndTime(Long endTime) {
this.endTime = endTime;
}
public String getContent() { public String getContent() {
return content; return content;
} }

View File

@ -303,6 +303,126 @@ public class TestCaseReportTemplateExample {
addCriterion("workspace_id not between", value1, value2, "workspaceId"); addCriterion("workspace_id not between", value1, value2, "workspaceId");
return (Criteria) this; return (Criteria) this;
} }
public Criteria andStartTimeIsNull() {
addCriterion("start_time is null");
return (Criteria) this;
}
public Criteria andStartTimeIsNotNull() {
addCriterion("start_time is not null");
return (Criteria) this;
}
public Criteria andStartTimeEqualTo(Long value) {
addCriterion("start_time =", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotEqualTo(Long value) {
addCriterion("start_time <>", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThan(Long value) {
addCriterion("start_time >", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeGreaterThanOrEqualTo(Long value) {
addCriterion("start_time >=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThan(Long value) {
addCriterion("start_time <", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeLessThanOrEqualTo(Long value) {
addCriterion("start_time <=", value, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeIn(List<Long> values) {
addCriterion("start_time in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotIn(List<Long> values) {
addCriterion("start_time not in", values, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeBetween(Long value1, Long value2) {
addCriterion("start_time between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andStartTimeNotBetween(Long value1, Long value2) {
addCriterion("start_time not between", value1, value2, "startTime");
return (Criteria) this;
}
public Criteria andEndTimeIsNull() {
addCriterion("end_time is null");
return (Criteria) this;
}
public Criteria andEndTimeIsNotNull() {
addCriterion("end_time is not null");
return (Criteria) this;
}
public Criteria andEndTimeEqualTo(Long value) {
addCriterion("end_time =", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotEqualTo(Long value) {
addCriterion("end_time <>", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThan(Long value) {
addCriterion("end_time >", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeGreaterThanOrEqualTo(Long value) {
addCriterion("end_time >=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThan(Long value) {
addCriterion("end_time <", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeLessThanOrEqualTo(Long value) {
addCriterion("end_time <=", value, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeIn(List<Long> values) {
addCriterion("end_time in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotIn(List<Long> values) {
addCriterion("end_time not in", values, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeBetween(Long value1, Long value2) {
addCriterion("end_time between", value1, value2, "endTime");
return (Criteria) this;
}
public Criteria andEndTimeNotBetween(Long value1, Long value2) {
addCriterion("end_time not between", value1, value2, "endTime");
return (Criteria) this;
}
} }
public static class Criteria extends GeneratedCriteria { public static class Criteria extends GeneratedCriteria {

View File

@ -5,6 +5,8 @@
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="plan_id" jdbcType="VARCHAR" property="planId" /> <result column="plan_id" jdbcType="VARCHAR" property="planId" />
<result column="start_time" jdbcType="BIGINT" property="startTime" />
<result column="end_time" jdbcType="BIGINT" property="endTime" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReport"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReport">
<result column="content" jdbcType="LONGVARCHAR" property="content" /> <result column="content" jdbcType="LONGVARCHAR" property="content" />
@ -68,7 +70,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, name, plan_id id, name, plan_id, start_time, end_time
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
content content
@ -125,10 +127,10 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
insert into test_case_report (name, plan_id, content insert into test_case_report (name, plan_id, start_time,
) end_time, content)
values (#{name,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR} values (#{name,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
) #{endTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReport"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReport">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@ -142,6 +144,12 @@
<if test="planId != null"> <if test="planId != null">
plan_id, plan_id,
</if> </if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="content != null"> <if test="content != null">
content, content,
</if> </if>
@ -153,6 +161,12 @@
<if test="planId != null"> <if test="planId != null">
#{planId,jdbcType=VARCHAR}, #{planId,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null">
#{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
#{endTime,jdbcType=BIGINT},
</if>
<if test="content != null"> <if test="content != null">
#{content,jdbcType=LONGVARCHAR}, #{content,jdbcType=LONGVARCHAR},
</if> </if>
@ -176,6 +190,12 @@
<if test="record.planId != null"> <if test="record.planId != null">
plan_id = #{record.planId,jdbcType=VARCHAR}, plan_id = #{record.planId,jdbcType=VARCHAR},
</if> </if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=BIGINT},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=BIGINT},
</if>
<if test="record.content != null"> <if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR}, content = #{record.content,jdbcType=LONGVARCHAR},
</if> </if>
@ -189,6 +209,8 @@
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR},
plan_id = #{record.planId,jdbcType=VARCHAR}, plan_id = #{record.planId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR} content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -198,7 +220,9 @@
update test_case_report update test_case_report
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR},
plan_id = #{record.planId,jdbcType=VARCHAR} plan_id = #{record.planId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,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>
@ -212,6 +236,12 @@
<if test="planId != null"> <if test="planId != null">
plan_id = #{planId,jdbcType=VARCHAR}, plan_id = #{planId,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=BIGINT},
</if>
<if test="content != null"> <if test="content != null">
content = #{content,jdbcType=LONGVARCHAR}, content = #{content,jdbcType=LONGVARCHAR},
</if> </if>
@ -222,13 +252,17 @@
update test_case_report update test_case_report
set name = #{name,jdbcType=VARCHAR}, set name = #{name,jdbcType=VARCHAR},
plan_id = #{planId,jdbcType=VARCHAR}, plan_id = #{planId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
content = #{content,jdbcType=LONGVARCHAR} content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReport"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReport">
update test_case_report update test_case_report
set name = #{name,jdbcType=VARCHAR}, set name = #{name,jdbcType=VARCHAR},
plan_id = #{planId,jdbcType=VARCHAR} plan_id = #{planId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>

View File

@ -5,6 +5,8 @@
<id column="id" jdbcType="BIGINT" property="id" /> <id column="id" jdbcType="BIGINT" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name" />
<result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" /> <result column="workspace_id" jdbcType="VARCHAR" property="workspaceId" />
<result column="start_time" jdbcType="BIGINT" property="startTime" />
<result column="end_time" jdbcType="BIGINT" property="endTime" />
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReportTemplate"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.TestCaseReportTemplate">
<result column="content" jdbcType="LONGVARCHAR" property="content" /> <result column="content" jdbcType="LONGVARCHAR" property="content" />
@ -68,7 +70,7 @@
</where> </where>
</sql> </sql>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, name, workspace_id id, name, workspace_id, start_time, end_time
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
content content
@ -125,10 +127,10 @@
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
SELECT LAST_INSERT_ID() SELECT LAST_INSERT_ID()
</selectKey> </selectKey>
insert into test_case_report_template (name, workspace_id, content insert into test_case_report_template (name, workspace_id, start_time,
) end_time, content)
values (#{name,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR} values (#{name,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR}, #{startTime,jdbcType=BIGINT},
) #{endTime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReportTemplate"> <insert id="insertSelective" parameterType="io.metersphere.base.domain.TestCaseReportTemplate">
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long"> <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
@ -142,6 +144,12 @@
<if test="workspaceId != null"> <if test="workspaceId != null">
workspace_id, workspace_id,
</if> </if>
<if test="startTime != null">
start_time,
</if>
<if test="endTime != null">
end_time,
</if>
<if test="content != null"> <if test="content != null">
content, content,
</if> </if>
@ -153,6 +161,12 @@
<if test="workspaceId != null"> <if test="workspaceId != null">
#{workspaceId,jdbcType=VARCHAR}, #{workspaceId,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null">
#{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
#{endTime,jdbcType=BIGINT},
</if>
<if test="content != null"> <if test="content != null">
#{content,jdbcType=LONGVARCHAR}, #{content,jdbcType=LONGVARCHAR},
</if> </if>
@ -176,6 +190,12 @@
<if test="record.workspaceId != null"> <if test="record.workspaceId != null">
workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
</if> </if>
<if test="record.startTime != null">
start_time = #{record.startTime,jdbcType=BIGINT},
</if>
<if test="record.endTime != null">
end_time = #{record.endTime,jdbcType=BIGINT},
</if>
<if test="record.content != null"> <if test="record.content != null">
content = #{record.content,jdbcType=LONGVARCHAR}, content = #{record.content,jdbcType=LONGVARCHAR},
</if> </if>
@ -189,6 +209,8 @@
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR}, workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,jdbcType=BIGINT},
content = #{record.content,jdbcType=LONGVARCHAR} content = #{record.content,jdbcType=LONGVARCHAR}
<if test="_parameter != null"> <if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" /> <include refid="Update_By_Example_Where_Clause" />
@ -198,7 +220,9 @@
update test_case_report_template update test_case_report_template
set id = #{record.id,jdbcType=BIGINT}, set id = #{record.id,jdbcType=BIGINT},
name = #{record.name,jdbcType=VARCHAR}, name = #{record.name,jdbcType=VARCHAR},
workspace_id = #{record.workspaceId,jdbcType=VARCHAR} workspace_id = #{record.workspaceId,jdbcType=VARCHAR},
start_time = #{record.startTime,jdbcType=BIGINT},
end_time = #{record.endTime,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>
@ -212,6 +236,12 @@
<if test="workspaceId != null"> <if test="workspaceId != null">
workspace_id = #{workspaceId,jdbcType=VARCHAR}, workspace_id = #{workspaceId,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null">
start_time = #{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
end_time = #{endTime,jdbcType=BIGINT},
</if>
<if test="content != null"> <if test="content != null">
content = #{content,jdbcType=LONGVARCHAR}, content = #{content,jdbcType=LONGVARCHAR},
</if> </if>
@ -222,13 +252,17 @@
update test_case_report_template update test_case_report_template
set name = #{name,jdbcType=VARCHAR}, set name = #{name,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR}, workspace_id = #{workspaceId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT},
content = #{content,jdbcType=LONGVARCHAR} content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReportTemplate"> <update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.TestCaseReportTemplate">
update test_case_report_template update test_case_report_template
set name = #{name,jdbcType=VARCHAR}, set name = #{name,jdbcType=VARCHAR},
workspace_id = #{workspaceId,jdbcType=VARCHAR} workspace_id = #{workspaceId,jdbcType=VARCHAR},
start_time = #{startTime,jdbcType=BIGINT},
end_time = #{endTime,jdbcType=BIGINT}
where id = #{id,jdbcType=BIGINT} where id = #{id,jdbcType=BIGINT}
</update> </update>
</mapper> </mapper>

View File

@ -335,6 +335,8 @@ CREATE TABLE IF NOT EXISTS `test_case_report_template` (
`name` varchar(64) NOT NULL COMMENT 'Test case report template name', `name` varchar(64) NOT NULL COMMENT 'Test case report template name',
`workspace_id` varchar(50) DEFAULT NULL COMMENT 'Workspace ID this project belongs to', `workspace_id` varchar(50) DEFAULT NULL COMMENT 'Workspace ID this project belongs to',
`content` longtext COMMENT 'Template content (JSON format)', `content` longtext COMMENT 'Template content (JSON format)',
`start_time` bigint(13) COMMENT 'Test start time',
`end_time` bigint(13) COMMENT 'Test end time',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) )
ENGINE=InnoDB ENGINE=InnoDB
@ -346,6 +348,8 @@ CREATE TABLE IF NOT EXISTS `test_case_report` (
`name` varchar(64) NOT NULL COMMENT 'Test case report name', `name` varchar(64) NOT NULL COMMENT 'Test case report name',
`plan_id` varchar(50) NOT NULL COMMENT 'Plan ID relation to', `plan_id` varchar(50) NOT NULL COMMENT 'Plan ID relation to',
`content` longtext COMMENT 'Report content (JSON format)', `content` longtext COMMENT 'Report content (JSON format)',
`start_time` bigint(13) COMMENT 'Test start time',
`end_time` bigint(13) COMMENT 'Test end time',
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) )
ENGINE=InnoDB ENGINE=InnoDB

View File

@ -10,4 +10,4 @@ INSERT INTO role (id, name, description, type, create_time, update_time) VALUES
INSERT INTO role (id, name, description, type, create_time, update_time) VALUES ('test_user', '测试人员', null, null, 1581576575948, 1581576575948); INSERT INTO role (id, name, description, type, create_time, update_time) VALUES ('test_user', '测试人员', null, null, 1581576575948, 1581576575948);
INSERT INTO role (id, name, description, type, create_time, update_time) VALUES ('test_viewer', 'Viewer', null, null, 1581576575948, 1581576575948); INSERT INTO role (id, name, description, type, create_time, update_time) VALUES ('test_viewer', 'Viewer', null, null, 1581576575948, 1581576575948);
INSERT INTO test_case_report_template (name,content) VALUES ("默认模版","{\"components\":[1,2,3,4,5],\"contentMap\":{\"richTextComponentTitleSet\":{},\"richTextComponentContentSet\":{}}}"); INSERT INTO test_case_report_template (name,content) VALUES ("默认模版","{\"components\": [1,2,3,4,5]}");

View File

@ -46,14 +46,22 @@
<!--要生成的数据库表 --> <!--要生成的数据库表 -->
<table tableName="api_test"/> <!--<table tableName="api_test"/>-->
<table tableName="api_test_file"/> <!--<table tableName="api_test_file"/>-->
<table tableName="api_test_report"/> <!--<table tableName="api_test_report"/>-->
<!--<table tableName="test_case_node">--> <!--<table tableName="test_case_node">-->
<!--<generatedKey column="id" sqlStatement="MySql" identity="true"/>--> <!--<generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!--</table>--> <!--</table>-->
<!--<table tableName="test_case"/>--> <!--<table tableName="test_case"/>-->
<!--<table tableName="test_plan_test_case"/>--> <!--<table tableName="test_plan_test_case"/>-->
<table tableName="test_case_report_template">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="test_case_report">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table>
</context> </context>
</generatorConfiguration> </generatorConfiguration>

View File

@ -12,10 +12,10 @@
<el-main> <el-main>
<testcase-template-item v-for="item in templates" :key="item.id" <testcase-template-item v-for="item in templates" :key="item.id"
:template="item" @templateEdit="templateEdit"/> :template="item" @templateEdit="templateEdit" @refresh="initData"/>
</el-main> </el-main>
<test-case-report-template-edit ref="templateEdit"/> <test-case-report-template-edit ref="templateEdit" @refresh="initData"/>
</el-card> </el-card>
@ -60,8 +60,8 @@
templateCreate() { templateCreate() {
}, },
templateEdit(template) { templateEdit(id) {
this.$refs.templateEdit.open(template); this.$refs.templateEdit.open(id);
} }
} }
} }
@ -70,5 +70,4 @@
<style scoped> <style scoped>
</style> </style>

View File

@ -3,34 +3,38 @@
<common-component :title="'基础信息'"> <common-component :title="'基础信息'">
<el-row type="flex" justify="space-between"> <template>
<el-col :span="12">
<span>所属项目</span>
<span class="item-value">{{reportInfo.project}}</span>
</el-col>
<el-col :span="12">
<span>测试负责人</span>
<span class="item-value">{{reportInfo.principal}}</span>
</el-col>
</el-row>
<el-row type="flex" justify="space-between"> <el-row type="flex" justify="space-between">
<el-col :span="12"> <el-col :span="12">
<span>开始时间</span> <span>所属项目</span>
<span class="item-value">{{reportInfo.startTime}}</span> <span class="item-value">{{reportInfo.project}}</span>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
<span>结束时间</span> <span>测试负责人</span>
<span class="item-value">{{reportInfo.endTime}}</span> <span class="item-value">{{reportInfo.principal}}</span>
</el-col> </el-col>
</el-row> </el-row>
<el-row type="flex" justify="space-between"> <el-row type="flex" justify="space-between">
<el-col :span="12"> <el-col :span="12">
<span>测试执行人</span> <span>开始时间</span>
<span v-for="item in reportInfo.executors" :key="item">{{item}}</span> <span class="item-value">{{reportInfo.startTime}}</span>
</el-col> </el-col>
</el-row> <el-col :span="12">
<span>结束时间</span>
<span class="item-value">{{reportInfo.endTime}}</span>
</el-col>
</el-row>
<el-row type="flex" justify="space-between">
<el-col :span="12">
<span>测试执行人</span>
<span v-for="item in reportInfo.executors" :key="item">{{item}}</span>
</el-col>
</el-row>
</template>
</common-component> </common-component>

View File

@ -1,17 +1,18 @@
<template> <template>
<el-card class="template-component"> <el-card class="template-component">
<template v-slot:header> <template v-slot:header >
<slot name="header"> <slot name="header">
<span class="title">{{title}}</span> <span class="title">{{title}}</span>
</slot> </slot>
</template> </template>
<el-main> <template>
<el-main>
<slot></slot> <slot></slot>
</el-main>
</el-main> </template>
</el-card> </el-card>
@ -30,6 +31,9 @@
type: String, type: String,
default: '标题' default: '标题'
} }
},
methods: {
} }
} }
</script> </script>

View File

@ -0,0 +1,47 @@
<template>
<common-component>
<template v-slot:header>
<el-input v-model="preview.title"></el-input>
</template>
<template>
<ckeditor :editor="editor" v-model="preview.content" :config="editorConfig"></ckeditor>
</template>
</common-component>
</template>
<script>
import CommonComponent from "./CommonComponent";
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
export default {
name: "RichTextComponent",
components: {CommonComponent},
data() {
return {
editor: ClassicEditor,
// editorData: '<p>Content of the editor.</p>',
editorConfig: {
// The configuration of the editor.
}
}
},
props: {
preview: Object,
default() {
return {
title: '',
content: '<p>Content of the editor.</p>'
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,82 @@
<template>
<el-row type="flex" class="head-bar">
<el-col :span="12">
<div class="name-edit">
<el-input :placeholder="'请填写模版名称'" v-model="template.name" @change="change"/>
<span v-if="template.name">{{template.name}}</span>
<span class="name-tip" v-if="!template.name">请填写模版名称</span>
</div>
</el-col>
<el-col :span="12" class="head-right">
<el-button plain size="mini" @click="handleCancel">{{$t('test_track.return')}}</el-button>
<el-button type="primary" size="mini" @click="handleSave">{{$t('test_track.save')}}</el-button>
</el-col>
</el-row>
</template>
<script>
export default {
name: "TemplateComponentEditHeader",
data() {
return {
}
},
props: {
template: {
type: Object,
default() {
return {}
}
},
},
methods: {
handleCancel() {
this.$emit('cancel');
},
handleSave() {
this.$emit('save');
},
change() {
this.$emit('update:template', this.templateName);
}
}
}
</script>
<style scoped>
.head-right {
text-align: right;
}
.head-bar {
background: white;
height: 45px;
line-height: 45px;
padding: 0 10px;
border: 1px solid #EBEEF5;
box-shadow: 0 0 2px 0 rgba(31,31,31,0.15), 0 1px 2px 0 rgba(31,31,31,0.15);
}
.name-edit:hover span {
display: none;
}
.name-edit .el-input {
display: none;
width: 200px;
}
.name-edit:hover .el-input{
display: inline-block;
}
.name-tip {
color: #909399;
}
</style>

View File

@ -7,95 +7,66 @@
size="100%" size="100%"
ref="drawer" ref="drawer"
v-loading="result.loading"> v-loading="result.loading">
<template v-slot:default="scope"> <template v-slot:default="scope">
<el-row type="flex" class="head-bar"> <template-component-edit-header :template="template" @cancel="handleClose" @save="handleSave"/>
<el-col :span="12">
<div class="name-edit">
<el-input :placeholder="'请填写模版名称'" v-model="name"/>
<span v-if="name != ''">{{name}}</span>
<span v-if="name == ''">请填写模版名称</span>
</div>
</el-col>
<el-col :span="12" class="head-right">
<el-button plain size="mini" @click="handleClose">{{$t('test_track.return')}}</el-button>
<el-button type="primary" size="mini" @click="handleClose">{{$t('test_track.save')}}</el-button>
</el-col>
</el-row>
<div class="container"> <div class="container">
<el-aside>
<div class="description">
<el-aside> <span class="title">组件库</span>
<span>从组件库把需要使用的组件拖到右侧预览测试报告的效果系统组件只能添加一次自定义组件可以设定默认的标题和内容</span>
<div class="description">
<span class="title">组件库</span>
<span>从组件库把需要使用的组件拖到右侧预览测试报告的效果系统组件只能添加一次自定义组件可以设定默认的标题和内容</span>
</div>
<draggable
class="component-group"
:list="components"
:group="{ name: 'people', pull: 'clone', put: false }"
:clone="cloneDog"
@change="log">
<template-component-bar v-for="item in components" :key="item.id" :component="item"/>
</draggable>
</el-aside>
<el-main>
<draggable
class="preview-group"
:list="previews"
group="people"
@change="log">
<base-info-component/>
<test-result-component/>
<test-result-chart-component/>
<el-card class="template-component" v-for="item in previews" :key="item.id">
<template v-slot:header>
{{item.name}}
</template>
<ckeditor :editor="editor" v-model="editorData" :config="editorConfig"></ckeditor>
</el-card>
</draggable>
</el-main>
</div> </div>
<draggable
class="dragArea list-group"
:list="components"
:group="{ name: 'component', pull: 'clone', put: false }"
:clone="clonePreview">
<transition-group>
<template-component-bar v-for="item in components" :key="item" :component="componentMap.get(item)"/>
</transition-group>
</draggable>
</el-aside>
<el-main>
<draggable
class="dragArea list-group"
:list="previews"
@change="change"
group="component">
<transition-group>
<div class="preview" v-for="item in previews" :key="item.id">
<base-info-component v-if="item.id == 1"/>
<test-result-component v-if="item.id == 2"/>
<test-result-chart-component v-if="item.id == 3"/>
<rich-text-component :preview="item" v-if="item.type != 'system'"/>
<i class="el-icon-error" @click="handleDelete(item)"/>
</div>
</transition-group>
</draggable>
</el-main>
</div>
</template> </template>
</el-drawer> </el-drawer>
</template> </template>
<script> <script>
import draggable from 'vuedraggable'; import draggable from 'vuedraggable';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import BaseInfoComponent from "./TemplateComponent/BaseInfoComponent"; import BaseInfoComponent from "./TemplateComponent/BaseInfoComponent";
import TestResultComponent from "./TemplateComponent/TestResultComponent"; import TestResultComponent from "./TemplateComponent/TestResultComponent";
import TestResultChartComponent from "./TemplateComponent/TestResultChartComponent"; import TestResultChartComponent from "./TemplateComponent/TestResultChartComponent";
import TemplateComponentBar from "./TemplateComponentBar"; import TemplateComponentBar from "./TemplateComponentBar";
import RichTextComponent from "./TemplateComponent/RichTextComponent";
import TemplateComponentEditHeader from "./TemplateComponentEditHeader";
import {WORKSPACE_ID} from '../../../../../common/js/constants';
import {jsonToMap, mapToJson} from "../../../../../common/js/utils";
let idGlobal = 8;
export default { export default {
name: "TestCaseReportTemplateEdit", name: "TestCaseReportTemplateEdit",
components: { components: {
TemplateComponentEditHeader,
RichTextComponent,
TemplateComponentBar, TemplateComponentBar,
TestResultChartComponent, TestResultChartComponent,
TestResultComponent, TestResultComponent,
@ -105,45 +76,163 @@
data() { data() {
return { return {
showDialog: false, showDialog: false,
template: {},
result: {}, result: {},
name: '', name: '',
type: 'edit', type: 'edit',
components: [ componentMap: new Map(
{ name: "基础信息", id: 1 , type: 'system'}, [
{ name: "测试结果", id: 2 , type: 'system'}, [1, { name: "基础信息", id: 1 , type: 'system'}],
{ name: "测试结果分布", id: 3 ,type: 'system'}, [2, { name: "测试结果", id: 2 , type: 'system'}],
{ name: "自定义模块", id: 4 ,type: 'custom'} [3, { name: "测试结果分布", id: 3 ,type: 'system'}],
], [4, { name: "自定义模块", id: 4 ,type: 'custom'}]
previews: [ ]
{ name: "cat 5", id: 5 }, ),
{ name: "cat 6", id: 6 }, components: [4],
{ name: "cat 7", id: 7 } previews: [],
], template: {}
editor: ClassicEditor,
editorData: '<p>Content of the editor.</p>',
editorConfig: {
// The configuration of the editor.
}
} }
}, },
props: {
},
watch: {
},
methods: { methods: {
open() { open(id) {
this.template = {
name: '',
content: {
components: [1,2,3,4],
customComponent: new Map()
}
};
this.previews = [];
this.components = [4];
if (id) {
this.type = 'edit';
this.getTemplateById(id);
} else {
this.type = 'add';
this.initComponents();
}
this.showDialog = true; this.showDialog = true;
}, },
initComponents() {
this.componentMap.forEach((value, key) =>{
if (this.template.content.components.indexOf(key) < 0 && this.components.indexOf(key) < 0) {
this.components.push(key);
}
});
this.template.content.components.forEach(item => {
let preview = this.componentMap.get(item);
if (preview && preview.type != 'custom') {
this.previews.push(preview);
} else {
if (this.template.content.customComponent) {
let customComponent = this.template.content.customComponent.get(item.toString());
if (customComponent) {
this.previews.push({id: item, title: customComponent.title, content: customComponent.content});
}
}
}
});
},
handleClose() { handleClose() {
this.showDialog = false; this.showDialog = false;
}, },
log: function(evt) { change(evt) {
window.console.log(evt); if (evt.added) {
let preview = evt.added.element;
if ( preview.type == 'system') {
for (let i = 0; i < this.components.length; i++) {
this.deleteComponentById(preview.id);
}
}
}
}, },
cloneDog({ id }) { clonePreview(componentId) {
let component = this.componentMap.get(componentId);
let id = componentId;
if (component.type != 'system') {
id = this.generateComponentId();
}
return { return {
id: idGlobal++, id: id,
name: `cat ${id}` name: component.name,
type: component.type,
}; };
},
handleDelete(preview) {
if (this.previews.length == 1) {
this.$warning('请至少保留一个组件');
return;
}
for (let i = 0; i < this.previews.length; i++) {
if (this.previews[i].id == preview.id) {
this.previews.splice(i,1);
if (preview.type == 'system') {
this.components.push(preview.id);
}
break;
}
}
},
generateComponentId() {
return Date.parse(new Date()) + Math.ceil(Math.random()*100000);
},
deleteComponentById(id) {
for (let i = 0; i < this.components.length; i++) {
if (this.components[i] == id) {
this.components.splice(i,1);
break;
}
}
},
getTemplateById(id) {
this.$get('/case/report/template/get/' + id, (response) =>{
this.template = response.data;
this.template.content = JSON.parse(response.data.content);
if (this.template.content.customComponent) {
this.template.content.customComponent = jsonToMap(this.template.content.customComponent);
}
this.initComponents();
});
},
handleSave() {
if (this.template.name == '') {
this.$warning('请填写模版名称');
return;
}
let param = {};
this.buildParam(param);
this.$post('/case/report/template/' + this.type, param, () =>{
this.$success('保存成功');
this.showDialog = false;
this.$emit('refresh');
});
},
buildParam(param) {
let content = {};
content.components = [];
this.previews.forEach(item => {
content.components.push(item.id);
if (!this.componentMap.get(item.id)) {
content.customComponent = new Map();
content.customComponent.set(item.id, {title: item.title, content: item.content})
}
});
param.name = this.template.name;
if (content.customComponent) {
content.customComponent = mapToJson(content.customComponent);
}
param.content = JSON.stringify(content);
if (this.type == 'edit') {
param.id = this.template.id;
}
if (this.template.workspaceId) {
param.workspaceId = localStorage.getItem(WORKSPACE_ID);
}
} }
} }
} }
@ -151,32 +240,6 @@
<style scoped> <style scoped>
.head-right {
text-align: right;
}
.head-bar {
background: white;
height: 45px;
line-height: 45px;
padding: 0 10px;
border: 1px solid #EBEEF5;
box-shadow: 0 0 2px 0 rgba(31,31,31,0.15), 0 1px 2px 0 rgba(31,31,31,0.15);
}
.name-edit:hover span {
display: none;
}
.name-edit .el-input {
display: none;
width: 200px;
}
.name-edit:hover .el-input{
display: inline-block;
}
.el-aside { .el-aside {
border: 1px solid #EBEEF5; border: 1px solid #EBEEF5;
box-sizing: border-box; box-sizing: border-box;
@ -204,6 +267,10 @@
width: 80%; width: 80%;
} }
.el-card:hover {
box-shadow: 0 0 2px 2px #409EFF;
}
.description > span { .description > span {
display: block; display: block;
padding-bottom: 5px; padding-bottom: 5px;
@ -218,4 +285,26 @@
background: #F5F5F5; background: #F5F5F5;
} }
.preview {
position: relative;
}
.el-icon-error {
position: absolute;
right: 11%;
top: 13px;
color: gray;
display:none;
font-size: 20px;
}
.el-icon-error:hover {
display: inline;
color: red;
}
.template-component:hover+i {
display: inline;
}
</style> </style>

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="testcase-template" @click="templateEdit"> <div class="testcase-template" @click="templateEdit">
<div class="template-img" @click="templateDelete"> <div class="template-img">
<i class="el-icon-error" v-if="template.workspaceId"/> <i class="el-icon-error" @click.stop="templateDelete"/>
</div> </div>
<span class="demonstration">{{ template.name }}</span> <span class="demonstration">{{ template.name }}</span>
</div> </div>
@ -20,11 +20,26 @@
}, },
methods: { methods: {
templateEdit() { templateEdit() {
this.$emit('templateEdit', this.template); this.$emit('templateEdit', this.template.id);
}, },
templateDelete() { templateDelete() {
this.post('/case/report/template/delete/' + this.template.id, () => { if (!this.template.workspaceId) {
this.$warning('不能删除默认模版');
return;
}
this.$alert(this.$t('load_test.delete_file_confirm') + this.template.name + "", '', {
confirmButtonText: this.$t('commons.confirm'),
callback: (action) => {
if (action === 'confirm') {
this.handleDelete();
}
}
});
},
handleDelete() {
this.$post('/case/report/template/delete/' + this.template.id, {}, () => {
this.$success('删除成功'); this.$success('删除成功');
this.$emit('refresh');
}); });
} }
} }
@ -67,7 +82,7 @@
cursor: pointer; cursor: pointer;
} }
.template-img > i { .template-img > i{
display:none; display:none;
float: right; float: right;
color: gray; color: gray;

View File

@ -5,7 +5,7 @@
<ms-tag v-if="value == 'Pass'" type="success" :content="$t('test_track.plan_view.pass')"/> <ms-tag v-if="value == 'Pass'" type="success" :content="$t('test_track.plan_view.pass')"/>
<ms-tag v-if="value == 'Failure'" type="danger" :content="$t('test_track.plan_view.failure')"/> <ms-tag v-if="value == 'Failure'" type="danger" :content="$t('test_track.plan_view.failure')"/>
<ms-tag v-if="value == 'Blocking'" type="warning" :content="$t('test_track.plan_view.blocking')"/> <ms-tag v-if="value == 'Blocking'" type="warning" :content="$t('test_track.plan_view.blocking')"/>
<ms-tag v-if="value == 'Skip'" type="info" :content="$t('test_track.plan.plan_view.skip')"/> <ms-tag v-if="value == 'Skip'" type="info" :content="$t('test_track.plan_view.skip')"/>
</div> </div>
</template> </template>

View File

@ -25,3 +25,10 @@ body {
word-wrap: break-word; word-wrap: break-word;
white-space: nowrap; white-space: nowrap;
} }
/*解决高度塌陷和边距重叠*/
.clearfix:before,.clearfix:after{
content: "";
display: table;
clear: both;
}

View File

@ -37,3 +37,21 @@ export function saveLocalStorage(response) {
// 保存角色 // 保存角色
localStorage.setItem("roles", roles); localStorage.setItem("roles", roles);
} }
export function jsonToMap(jsonStr) {
let obj = JSON.parse(jsonStr);
let strMap = new Map();
for (let k of Object.keys(obj)) {
strMap.set(k,obj[k]);
}
return strMap;
}
export function mapToJson(strMap){
let obj= Object.create(null);
for (let[k,v] of strMap) {
obj[k] = v;
}
return JSON.stringify(obj);
}