refactor(接口测试): 支持测试计划执行报告

This commit is contained in:
fit2-zhao 2024-01-18 16:14:34 +08:00 committed by Craftsman
parent 5570d2ba17
commit 280723aee0
7 changed files with 277 additions and 78 deletions

View File

@ -20,11 +20,16 @@ public class ApiReport implements Serializable {
@Size(min = 1, max = 255, message = "{api_report.name.length_range}", groups = {Created.class, Updated.class})
private String name;
@Schema(description = "接口资源fk/api_definition_id/api_test_case_id", requiredMode = Schema.RequiredMode.REQUIRED)
@Schema(description = "用例id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_report.resource_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{api_report.resource_id.length_range}", groups = {Created.class, Updated.class})
private String resourceId;
@Schema(description = "测试计划id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_report.test_plan_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{api_report.test_plan_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanId;
@Schema(description = "创建人")
private String createUser;
@ -138,6 +143,7 @@ public class ApiReport implements Serializable {
id("id", "id", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
resourceId("resource_id", "resourceId", "VARCHAR", false),
testPlanId("test_plan_id", "testPlanId", "VARCHAR", false),
createUser("create_user", "createUser", "VARCHAR", false),
deleteTime("delete_time", "deleteTime", "BIGINT", false),
deleteUser("delete_user", "deleteUser", "VARCHAR", false),

View File

@ -314,6 +314,76 @@ public class ApiReportExample {
return (Criteria) this;
}
public Criteria andTestPlanIdIsNull() {
addCriterion("test_plan_id is null");
return (Criteria) this;
}
public Criteria andTestPlanIdIsNotNull() {
addCriterion("test_plan_id is not null");
return (Criteria) this;
}
public Criteria andTestPlanIdEqualTo(String value) {
addCriterion("test_plan_id =", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdNotEqualTo(String value) {
addCriterion("test_plan_id <>", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdGreaterThan(String value) {
addCriterion("test_plan_id >", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_id >=", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdLessThan(String value) {
addCriterion("test_plan_id <", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdLessThanOrEqualTo(String value) {
addCriterion("test_plan_id <=", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdLike(String value) {
addCriterion("test_plan_id like", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdNotLike(String value) {
addCriterion("test_plan_id not like", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdIn(List<String> values) {
addCriterion("test_plan_id in", values, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdNotIn(List<String> values) {
addCriterion("test_plan_id not in", values, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdBetween(String value1, String value2) {
addCriterion("test_plan_id between", value1, value2, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdNotBetween(String value1, String value2) {
addCriterion("test_plan_id not between", value1, value2, "testPlanId");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;

View File

@ -25,6 +25,11 @@ public class ApiScenarioReport implements Serializable {
@Size(min = 1, max = 50, message = "{api_scenario_report.scenario_id.length_range}", groups = {Created.class, Updated.class})
private String scenarioId;
@Schema(description = "测试计划id", requiredMode = Schema.RequiredMode.REQUIRED)
@NotBlank(message = "{api_scenario_report.test_plan_id.not_blank}", groups = {Created.class})
@Size(min = 1, max = 50, message = "{api_scenario_report.test_plan_id.length_range}", groups = {Created.class, Updated.class})
private String testPlanId;
@Schema(description = "创建人")
private String createUser;
@ -138,6 +143,7 @@ public class ApiScenarioReport implements Serializable {
id("id", "id", "VARCHAR", false),
name("name", "name", "VARCHAR", true),
scenarioId("scenario_id", "scenarioId", "VARCHAR", false),
testPlanId("test_plan_id", "testPlanId", "VARCHAR", false),
createUser("create_user", "createUser", "VARCHAR", false),
deleteTime("delete_time", "deleteTime", "BIGINT", false),
deleteUser("delete_user", "deleteUser", "VARCHAR", false),

View File

@ -314,6 +314,76 @@ public class ApiScenarioReportExample {
return (Criteria) this;
}
public Criteria andTestPlanIdIsNull() {
addCriterion("test_plan_id is null");
return (Criteria) this;
}
public Criteria andTestPlanIdIsNotNull() {
addCriterion("test_plan_id is not null");
return (Criteria) this;
}
public Criteria andTestPlanIdEqualTo(String value) {
addCriterion("test_plan_id =", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdNotEqualTo(String value) {
addCriterion("test_plan_id <>", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdGreaterThan(String value) {
addCriterion("test_plan_id >", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdGreaterThanOrEqualTo(String value) {
addCriterion("test_plan_id >=", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdLessThan(String value) {
addCriterion("test_plan_id <", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdLessThanOrEqualTo(String value) {
addCriterion("test_plan_id <=", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdLike(String value) {
addCriterion("test_plan_id like", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdNotLike(String value) {
addCriterion("test_plan_id not like", value, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdIn(List<String> values) {
addCriterion("test_plan_id in", values, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdNotIn(List<String> values) {
addCriterion("test_plan_id not in", values, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdBetween(String value1, String value2) {
addCriterion("test_plan_id between", value1, value2, "testPlanId");
return (Criteria) this;
}
public Criteria andTestPlanIdNotBetween(String value1, String value2) {
addCriterion("test_plan_id not between", value1, value2, "testPlanId");
return (Criteria) this;
}
public Criteria andCreateUserIsNull() {
addCriterion("create_user is null");
return (Criteria) this;

View File

@ -5,6 +5,7 @@
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="resource_id" jdbcType="VARCHAR" property="resourceId" />
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
<result column="delete_user" jdbcType="VARCHAR" property="deleteUser" />
@ -92,11 +93,11 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, resource_id, create_user, delete_time, delete_user, deleted, update_user,
update_time, start_time, end_time, request_duration, `status`, trigger_mode, run_mode,
pool_id, version_id, integrated, project_id, environment_id, error_count, fake_error_count,
pending_count, success_count, assertion_count, assertion_success_count, request_execution_rate,
request_pass_rate, assertion_pass_rate, script_identifier
id, `name`, resource_id, test_plan_id, create_user, delete_time, delete_user, deleted,
update_user, update_time, start_time, end_time, request_duration, `status`, trigger_mode,
run_mode, pool_id, version_id, integrated, project_id, environment_id, error_count,
fake_error_count, pending_count, success_count, assertion_count, assertion_success_count,
request_execution_rate, request_pass_rate, assertion_pass_rate, script_identifier
</sql>
<select id="selectByExample" parameterType="io.metersphere.api.domain.ApiReportExample" resultMap="BaseResultMap">
select
@ -130,27 +131,27 @@
</delete>
<insert id="insert" parameterType="io.metersphere.api.domain.ApiReport">
insert into api_report (id, `name`, resource_id,
create_user, delete_time, delete_user,
deleted, update_user, update_time,
start_time, end_time, request_duration,
`status`, trigger_mode, run_mode,
pool_id, version_id, integrated,
project_id, environment_id, error_count,
fake_error_count, pending_count, success_count,
assertion_count, assertion_success_count, request_execution_rate,
request_pass_rate, assertion_pass_rate, script_identifier
)
test_plan_id, create_user, delete_time,
delete_user, deleted, update_user,
update_time, start_time, end_time,
request_duration, `status`, trigger_mode,
run_mode, pool_id, version_id,
integrated, project_id, environment_id,
error_count, fake_error_count, pending_count,
success_count, assertion_count, assertion_success_count,
request_execution_rate, request_pass_rate,
assertion_pass_rate, script_identifier)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{resourceId,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleteUser,jdbcType=VARCHAR},
#{deleted,jdbcType=BIT}, #{updateUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT},
#{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{requestDuration,jdbcType=BIGINT},
#{status,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{runMode,jdbcType=VARCHAR},
#{poolId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{integrated,jdbcType=BIT},
#{projectId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{errorCount,jdbcType=BIGINT},
#{fakeErrorCount,jdbcType=BIGINT}, #{pendingCount,jdbcType=BIGINT}, #{successCount,jdbcType=BIGINT},
#{assertionCount,jdbcType=BIGINT}, #{assertionSuccessCount,jdbcType=BIGINT}, #{requestExecutionRate,jdbcType=VARCHAR},
#{requestPassRate,jdbcType=VARCHAR}, #{assertionPassRate,jdbcType=VARCHAR}, #{scriptIdentifier,jdbcType=VARCHAR}
)
#{testPlanId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
#{deleteUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, #{updateUser,jdbcType=VARCHAR},
#{updateTime,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
#{requestDuration,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR},
#{runMode,jdbcType=VARCHAR}, #{poolId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR},
#{integrated,jdbcType=BIT}, #{projectId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
#{errorCount,jdbcType=BIGINT}, #{fakeErrorCount,jdbcType=BIGINT}, #{pendingCount,jdbcType=BIGINT},
#{successCount,jdbcType=BIGINT}, #{assertionCount,jdbcType=BIGINT}, #{assertionSuccessCount,jdbcType=BIGINT},
#{requestExecutionRate,jdbcType=VARCHAR}, #{requestPassRate,jdbcType=VARCHAR},
#{assertionPassRate,jdbcType=VARCHAR}, #{scriptIdentifier,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiReport">
insert into api_report
@ -164,6 +165,9 @@
<if test="resourceId != null">
resource_id,
</if>
<if test="testPlanId != null">
test_plan_id,
</if>
<if test="createUser != null">
create_user,
</if>
@ -256,6 +260,9 @@
<if test="resourceId != null">
#{resourceId,jdbcType=VARCHAR},
</if>
<if test="testPlanId != null">
#{testPlanId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
@ -357,6 +364,9 @@
<if test="record.resourceId != null">
resource_id = #{record.resourceId,jdbcType=VARCHAR},
</if>
<if test="record.testPlanId != null">
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
@ -448,6 +458,7 @@
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
resource_id = #{record.resourceId,jdbcType=VARCHAR},
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user = #{record.deleteUser,jdbcType=VARCHAR},
@ -488,6 +499,9 @@
<if test="resourceId != null">
resource_id = #{resourceId,jdbcType=VARCHAR},
</if>
<if test="testPlanId != null">
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
@ -576,6 +590,7 @@
update api_report
set `name` = #{name,jdbcType=VARCHAR},
resource_id = #{resourceId,jdbcType=VARCHAR},
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user = #{deleteUser,jdbcType=VARCHAR},
@ -607,22 +622,23 @@
</update>
<insert id="batchInsert" parameterType="map">
insert into api_report
(id, `name`, resource_id, create_user, delete_time, delete_user, deleted, update_user,
update_time, start_time, end_time, request_duration, `status`, trigger_mode, run_mode,
pool_id, version_id, integrated, project_id, environment_id, error_count, fake_error_count,
pending_count, success_count, assertion_count, assertion_success_count, request_execution_rate,
request_pass_rate, assertion_pass_rate, script_identifier)
(id, `name`, resource_id, test_plan_id, create_user, delete_time, delete_user, deleted,
update_user, update_time, start_time, end_time, request_duration, `status`, trigger_mode,
run_mode, pool_id, version_id, integrated, project_id, environment_id, error_count,
fake_error_count, pending_count, success_count, assertion_count, assertion_success_count,
request_execution_rate, request_pass_rate, assertion_pass_rate, script_identifier
)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.resourceId,jdbcType=VARCHAR},
#{item.createUser,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=BIGINT}, #{item.deleteUser,jdbcType=VARCHAR},
#{item.deleted,jdbcType=BIT}, #{item.updateUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT},
#{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT}, #{item.requestDuration,jdbcType=BIGINT},
#{item.status,jdbcType=VARCHAR}, #{item.triggerMode,jdbcType=VARCHAR}, #{item.runMode,jdbcType=VARCHAR},
#{item.poolId,jdbcType=VARCHAR}, #{item.versionId,jdbcType=VARCHAR}, #{item.integrated,jdbcType=BIT},
#{item.projectId,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR}, #{item.errorCount,jdbcType=BIGINT},
#{item.fakeErrorCount,jdbcType=BIGINT}, #{item.pendingCount,jdbcType=BIGINT}, #{item.successCount,jdbcType=BIGINT},
#{item.assertionCount,jdbcType=BIGINT}, #{item.assertionSuccessCount,jdbcType=BIGINT},
#{item.testPlanId,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=BIGINT},
#{item.deleteUser,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT}, #{item.updateUser,jdbcType=VARCHAR},
#{item.updateTime,jdbcType=BIGINT}, #{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT},
#{item.requestDuration,jdbcType=BIGINT}, #{item.status,jdbcType=VARCHAR}, #{item.triggerMode,jdbcType=VARCHAR},
#{item.runMode,jdbcType=VARCHAR}, #{item.poolId,jdbcType=VARCHAR}, #{item.versionId,jdbcType=VARCHAR},
#{item.integrated,jdbcType=BIT}, #{item.projectId,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR},
#{item.errorCount,jdbcType=BIGINT}, #{item.fakeErrorCount,jdbcType=BIGINT}, #{item.pendingCount,jdbcType=BIGINT},
#{item.successCount,jdbcType=BIGINT}, #{item.assertionCount,jdbcType=BIGINT}, #{item.assertionSuccessCount,jdbcType=BIGINT},
#{item.requestExecutionRate,jdbcType=VARCHAR}, #{item.requestPassRate,jdbcType=VARCHAR},
#{item.assertionPassRate,jdbcType=VARCHAR}, #{item.scriptIdentifier,jdbcType=VARCHAR}
)
@ -647,6 +663,9 @@
<if test="'resource_id'.toString() == column.value">
#{item.resourceId,jdbcType=VARCHAR}
</if>
<if test="'test_plan_id'.toString() == column.value">
#{item.testPlanId,jdbcType=VARCHAR}
</if>
<if test="'create_user'.toString() == column.value">
#{item.createUser,jdbcType=VARCHAR}
</if>

View File

@ -5,6 +5,7 @@
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="scenario_id" jdbcType="VARCHAR" property="scenarioId" />
<result column="test_plan_id" jdbcType="VARCHAR" property="testPlanId" />
<result column="create_user" jdbcType="VARCHAR" property="createUser" />
<result column="delete_time" jdbcType="BIGINT" property="deleteTime" />
<result column="delete_user" jdbcType="VARCHAR" property="deleteUser" />
@ -92,11 +93,11 @@
</where>
</sql>
<sql id="Base_Column_List">
id, `name`, scenario_id, create_user, delete_time, delete_user, deleted, update_user,
update_time, start_time, end_time, request_duration, `status`, trigger_mode, run_mode,
pool_id, version_id, integrated, project_id, environment_id, error_count, fake_error_count,
pending_count, success_count, assertion_count, assertion_success_count, request_execution_rate,
request_pass_rate, assertion_pass_rate, script_identifier
id, `name`, scenario_id, test_plan_id, create_user, delete_time, delete_user, deleted,
update_user, update_time, start_time, end_time, request_duration, `status`, trigger_mode,
run_mode, pool_id, version_id, integrated, project_id, environment_id, error_count,
fake_error_count, pending_count, success_count, assertion_count, assertion_success_count,
request_execution_rate, request_pass_rate, assertion_pass_rate, script_identifier
</sql>
<select id="selectByExample" parameterType="io.metersphere.api.domain.ApiScenarioReportExample" resultMap="BaseResultMap">
select
@ -130,27 +131,27 @@
</delete>
<insert id="insert" parameterType="io.metersphere.api.domain.ApiScenarioReport">
insert into api_scenario_report (id, `name`, scenario_id,
create_user, delete_time, delete_user,
deleted, update_user, update_time,
start_time, end_time, request_duration,
`status`, trigger_mode, run_mode,
pool_id, version_id, integrated,
project_id, environment_id, error_count,
fake_error_count, pending_count, success_count,
assertion_count, assertion_success_count, request_execution_rate,
request_pass_rate, assertion_pass_rate, script_identifier
)
test_plan_id, create_user, delete_time,
delete_user, deleted, update_user,
update_time, start_time, end_time,
request_duration, `status`, trigger_mode,
run_mode, pool_id, version_id,
integrated, project_id, environment_id,
error_count, fake_error_count, pending_count,
success_count, assertion_count, assertion_success_count,
request_execution_rate, request_pass_rate,
assertion_pass_rate, script_identifier)
values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{scenarioId,jdbcType=VARCHAR},
#{createUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT}, #{deleteUser,jdbcType=VARCHAR},
#{deleted,jdbcType=BIT}, #{updateUser,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT},
#{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{requestDuration,jdbcType=BIGINT},
#{status,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR}, #{runMode,jdbcType=VARCHAR},
#{poolId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR}, #{integrated,jdbcType=BIT},
#{projectId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR}, #{errorCount,jdbcType=BIGINT},
#{fakeErrorCount,jdbcType=BIGINT}, #{pendingCount,jdbcType=BIGINT}, #{successCount,jdbcType=BIGINT},
#{assertionCount,jdbcType=BIGINT}, #{assertionSuccessCount,jdbcType=BIGINT}, #{requestExecutionRate,jdbcType=VARCHAR},
#{requestPassRate,jdbcType=VARCHAR}, #{assertionPassRate,jdbcType=VARCHAR}, #{scriptIdentifier,jdbcType=VARCHAR}
)
#{testPlanId,jdbcType=VARCHAR}, #{createUser,jdbcType=VARCHAR}, #{deleteTime,jdbcType=BIGINT},
#{deleteUser,jdbcType=VARCHAR}, #{deleted,jdbcType=BIT}, #{updateUser,jdbcType=VARCHAR},
#{updateTime,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
#{requestDuration,jdbcType=BIGINT}, #{status,jdbcType=VARCHAR}, #{triggerMode,jdbcType=VARCHAR},
#{runMode,jdbcType=VARCHAR}, #{poolId,jdbcType=VARCHAR}, #{versionId,jdbcType=VARCHAR},
#{integrated,jdbcType=BIT}, #{projectId,jdbcType=VARCHAR}, #{environmentId,jdbcType=VARCHAR},
#{errorCount,jdbcType=BIGINT}, #{fakeErrorCount,jdbcType=BIGINT}, #{pendingCount,jdbcType=BIGINT},
#{successCount,jdbcType=BIGINT}, #{assertionCount,jdbcType=BIGINT}, #{assertionSuccessCount,jdbcType=BIGINT},
#{requestExecutionRate,jdbcType=VARCHAR}, #{requestPassRate,jdbcType=VARCHAR},
#{assertionPassRate,jdbcType=VARCHAR}, #{scriptIdentifier,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.api.domain.ApiScenarioReport">
insert into api_scenario_report
@ -164,6 +165,9 @@
<if test="scenarioId != null">
scenario_id,
</if>
<if test="testPlanId != null">
test_plan_id,
</if>
<if test="createUser != null">
create_user,
</if>
@ -256,6 +260,9 @@
<if test="scenarioId != null">
#{scenarioId,jdbcType=VARCHAR},
</if>
<if test="testPlanId != null">
#{testPlanId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
#{createUser,jdbcType=VARCHAR},
</if>
@ -357,6 +364,9 @@
<if test="record.scenarioId != null">
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
</if>
<if test="record.testPlanId != null">
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
</if>
<if test="record.createUser != null">
create_user = #{record.createUser,jdbcType=VARCHAR},
</if>
@ -448,6 +458,7 @@
set id = #{record.id,jdbcType=VARCHAR},
`name` = #{record.name,jdbcType=VARCHAR},
scenario_id = #{record.scenarioId,jdbcType=VARCHAR},
test_plan_id = #{record.testPlanId,jdbcType=VARCHAR},
create_user = #{record.createUser,jdbcType=VARCHAR},
delete_time = #{record.deleteTime,jdbcType=BIGINT},
delete_user = #{record.deleteUser,jdbcType=VARCHAR},
@ -488,6 +499,9 @@
<if test="scenarioId != null">
scenario_id = #{scenarioId,jdbcType=VARCHAR},
</if>
<if test="testPlanId != null">
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
</if>
<if test="createUser != null">
create_user = #{createUser,jdbcType=VARCHAR},
</if>
@ -576,6 +590,7 @@
update api_scenario_report
set `name` = #{name,jdbcType=VARCHAR},
scenario_id = #{scenarioId,jdbcType=VARCHAR},
test_plan_id = #{testPlanId,jdbcType=VARCHAR},
create_user = #{createUser,jdbcType=VARCHAR},
delete_time = #{deleteTime,jdbcType=BIGINT},
delete_user = #{deleteUser,jdbcType=VARCHAR},
@ -607,22 +622,23 @@
</update>
<insert id="batchInsert" parameterType="map">
insert into api_scenario_report
(id, `name`, scenario_id, create_user, delete_time, delete_user, deleted, update_user,
update_time, start_time, end_time, request_duration, `status`, trigger_mode, run_mode,
pool_id, version_id, integrated, project_id, environment_id, error_count, fake_error_count,
pending_count, success_count, assertion_count, assertion_success_count, request_execution_rate,
request_pass_rate, assertion_pass_rate, script_identifier)
(id, `name`, scenario_id, test_plan_id, create_user, delete_time, delete_user, deleted,
update_user, update_time, start_time, end_time, request_duration, `status`, trigger_mode,
run_mode, pool_id, version_id, integrated, project_id, environment_id, error_count,
fake_error_count, pending_count, success_count, assertion_count, assertion_success_count,
request_execution_rate, request_pass_rate, assertion_pass_rate, script_identifier
)
values
<foreach collection="list" item="item" separator=",">
(#{item.id,jdbcType=VARCHAR}, #{item.name,jdbcType=VARCHAR}, #{item.scenarioId,jdbcType=VARCHAR},
#{item.createUser,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=BIGINT}, #{item.deleteUser,jdbcType=VARCHAR},
#{item.deleted,jdbcType=BIT}, #{item.updateUser,jdbcType=VARCHAR}, #{item.updateTime,jdbcType=BIGINT},
#{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT}, #{item.requestDuration,jdbcType=BIGINT},
#{item.status,jdbcType=VARCHAR}, #{item.triggerMode,jdbcType=VARCHAR}, #{item.runMode,jdbcType=VARCHAR},
#{item.poolId,jdbcType=VARCHAR}, #{item.versionId,jdbcType=VARCHAR}, #{item.integrated,jdbcType=BIT},
#{item.projectId,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR}, #{item.errorCount,jdbcType=BIGINT},
#{item.fakeErrorCount,jdbcType=BIGINT}, #{item.pendingCount,jdbcType=BIGINT}, #{item.successCount,jdbcType=BIGINT},
#{item.assertionCount,jdbcType=BIGINT}, #{item.assertionSuccessCount,jdbcType=BIGINT},
#{item.testPlanId,jdbcType=VARCHAR}, #{item.createUser,jdbcType=VARCHAR}, #{item.deleteTime,jdbcType=BIGINT},
#{item.deleteUser,jdbcType=VARCHAR}, #{item.deleted,jdbcType=BIT}, #{item.updateUser,jdbcType=VARCHAR},
#{item.updateTime,jdbcType=BIGINT}, #{item.startTime,jdbcType=BIGINT}, #{item.endTime,jdbcType=BIGINT},
#{item.requestDuration,jdbcType=BIGINT}, #{item.status,jdbcType=VARCHAR}, #{item.triggerMode,jdbcType=VARCHAR},
#{item.runMode,jdbcType=VARCHAR}, #{item.poolId,jdbcType=VARCHAR}, #{item.versionId,jdbcType=VARCHAR},
#{item.integrated,jdbcType=BIT}, #{item.projectId,jdbcType=VARCHAR}, #{item.environmentId,jdbcType=VARCHAR},
#{item.errorCount,jdbcType=BIGINT}, #{item.fakeErrorCount,jdbcType=BIGINT}, #{item.pendingCount,jdbcType=BIGINT},
#{item.successCount,jdbcType=BIGINT}, #{item.assertionCount,jdbcType=BIGINT}, #{item.assertionSuccessCount,jdbcType=BIGINT},
#{item.requestExecutionRate,jdbcType=VARCHAR}, #{item.requestPassRate,jdbcType=VARCHAR},
#{item.assertionPassRate,jdbcType=VARCHAR}, #{item.scriptIdentifier,jdbcType=VARCHAR}
)
@ -647,6 +663,9 @@
<if test="'scenario_id'.toString() == column.value">
#{item.scenarioId,jdbcType=VARCHAR}
</if>
<if test="'test_plan_id'.toString() == column.value">
#{item.testPlanId,jdbcType=VARCHAR}
</if>
<if test="'create_user'.toString() == column.value">
#{item.createUser,jdbcType=VARCHAR}
</if>

View File

@ -101,7 +101,8 @@ CREATE INDEX idx_name ON api_definition(name);
CREATE TABLE IF NOT EXISTS api_report(
`id` VARCHAR(50) NOT NULL COMMENT '接口报告pk' ,
`name` VARCHAR(255) NOT NULL COMMENT '接口报告名称' ,
`resource_id` VARCHAR(50) NOT NULL COMMENT '接口资源fk/api_definition_id/api_test_case_id' ,
`resource_id` VARCHAR(50) NOT NULL COMMENT '用例id' ,
`test_plan_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '测试计划id' ,
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人' ,
`delete_time` BIGINT COMMENT '删除时间' ,
`delete_user` VARCHAR(50) COMMENT '删除人' ,
@ -144,6 +145,10 @@ CREATE INDEX idx_update_time ON api_report(update_time);
CREATE INDEX idx_create_user ON api_report(create_user);
CREATE INDEX idx_name ON api_report(name);
CREATE INDEX idx_pool_id ON api_report(pool_id);
CREATE INDEX idx_start_time ON api_report(start_time);
CREATE INDEX idx_integrated ON api_report(integrated);
CREATE INDEX idx_test_plan_id ON api_report(test_plan_id);
DROP TABLE IF EXISTS api_scenario_report;
CREATE TABLE IF NOT EXISTS api_report_step(
`step_id` VARCHAR(50) NOT NULL COMMENT '步骤id' ,
@ -333,6 +338,7 @@ CREATE TABLE IF NOT EXISTS api_scenario_report(
`id` VARCHAR(50) NOT NULL COMMENT '场景报告pk' ,
`name` VARCHAR(255) NOT NULL COMMENT '报告名称' ,
`scenario_id` VARCHAR(50) NOT NULL COMMENT '场景fk' ,
`test_plan_id` VARCHAR(50) NOT NULL DEFAULT 'NONE' COMMENT '测试计划id' ,
`create_user` VARCHAR(50) NOT NULL COMMENT '创建人' ,
`delete_time` BIGINT COMMENT '删除时间' ,
`delete_user` VARCHAR(50) COMMENT '删除人' ,
@ -374,6 +380,9 @@ CREATE INDEX idx_update_time ON api_scenario_report(update_time);
CREATE INDEX idx_create_user ON api_scenario_report(create_user);
CREATE INDEX idx_name ON api_scenario_report(name);
CREATE INDEX idx_pool_id ON api_scenario_report(pool_id);
CREATE INDEX idx_integrated ON api_scenario_report(integrated);
CREATE INDEX idx_start_time ON api_scenario_report(start_time);
CREATE INDEX idx_test_plan_id ON api_scenario_report(test_plan_id);
CREATE TABLE IF NOT EXISTS api_scenario_report_detail(
`id` VARCHAR(50) NOT NULL COMMENT 'ID' ,