mirror of
https://gitee.com/fit2cloud-feizhiyun/MeterSphere.git
synced 2024-12-03 20:49:56 +08:00
fix(测试计划): 测试计划保存实时报告时同时保存对应的最新报告
测试计划保存实时报告时同时保存对应的最新报告
This commit is contained in:
parent
a934f9925d
commit
b5dc1a4096
@ -21,6 +21,8 @@ public interface ExtApiDefinitionExecResultMapper {
|
||||
|
||||
ApiDefinitionExecResultWithBLOBs selectMaxResultByResourceId(String resourceId);
|
||||
|
||||
String selectMaxResultIdByResourceId(String resourceId);
|
||||
|
||||
ApiDefinitionExecResultWithBLOBs selectMaxResultByResourceIdAndType(String resourceId, String type);
|
||||
|
||||
long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("version") String version, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp);
|
||||
|
@ -12,7 +12,16 @@
|
||||
select *
|
||||
from api_definition_exec_result
|
||||
where resource_id = #{resourceId,jdbcType=VARCHAR}
|
||||
ORDER BY create_time DESC LIMIT 1
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectMaxResultIdByResourceId" parameterType="java.lang.String"
|
||||
resultType="java.lang.String">
|
||||
select id
|
||||
from api_definition_exec_result
|
||||
where resource_id = #{resourceId,jdbcType=VARCHAR}
|
||||
ORDER BY create_time DESC
|
||||
LIMIT 1
|
||||
</select>
|
||||
<select id="selectMaxResultByResourceIdAndType"
|
||||
resultType="io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs">
|
||||
@ -20,7 +29,8 @@
|
||||
from api_definition_exec_result
|
||||
where resource_id = #{resourceId,jdbcType=VARCHAR}
|
||||
and `type` = #{type, jdbcType=VARCHAR}
|
||||
ORDER BY start_time DESC LIMIT 5, 1
|
||||
ORDER BY start_time DESC
|
||||
LIMIT 5, 1
|
||||
</select>
|
||||
|
||||
<select id="countByProjectIDAndCreateInThisWeek" resultType="java.lang.Long">
|
||||
@ -283,12 +293,9 @@
|
||||
FROM api_definition_exec_result r
|
||||
INNER JOIN api_test_case c ON r.resource_id = c.id
|
||||
AND c.`status` != 'Trash'
|
||||
WHERE
|
||||
r.status not in ('SUCCESS'
|
||||
, 'FAKE_ERROR')
|
||||
WHERE r.status not in ('SUCCESS', 'FAKE_ERROR')
|
||||
AND r.integrated_report_id = #{reportId}
|
||||
ORDER BY
|
||||
r.create_time ASC
|
||||
ORDER BY r.create_time ASC
|
||||
</select>
|
||||
<select id="selectByProjectIdAndLessThanTime" resultType="java.lang.String">
|
||||
select id
|
||||
|
@ -14,6 +14,7 @@ import io.metersphere.base.domain.ApiScenarioReportResult;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ApiTestEnvironmentMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioModuleMapper;
|
||||
import io.metersphere.base.mapper.ext.ExtApiScenarioReportResultMapper;
|
||||
import io.metersphere.base.mapper.plan.TestPlanApiScenarioMapper;
|
||||
@ -96,6 +97,8 @@ public class TestPlanScenarioCaseService {
|
||||
private BaseEnvGroupProjectService environmentGroupProjectService;
|
||||
@Resource
|
||||
private ExtApiScenarioModuleMapper extApiScenarioModuleMapper;
|
||||
@Resource
|
||||
private ExtApiDefinitionExecResultMapper extApiDefinitionExecResultMapper;
|
||||
@Lazy
|
||||
@Resource
|
||||
private ApiScenarioModuleService apiScenarioModuleService;
|
||||
@ -868,12 +871,25 @@ public class TestPlanScenarioCaseService {
|
||||
if (checkReportConfig(config, "api", "all")) {
|
||||
// 接口
|
||||
apiAllCases = testPlanApiCaseService.getAllCases(planId);
|
||||
apiAllCases.forEach(item -> {
|
||||
String reportId = extApiDefinitionExecResultMapper.selectMaxResultIdByResourceId(item.getId());
|
||||
if (StringUtils.isBlank(reportId)) {
|
||||
item.setReportId(StringUtils.EMPTY);
|
||||
} else {
|
||||
item.setReportId(reportId);
|
||||
}
|
||||
});
|
||||
report.setApiAllCases(apiAllCases);
|
||||
if (saveResponse) {
|
||||
testPlanApiCaseService.buildApiResponse(apiAllCases);
|
||||
}
|
||||
//场景
|
||||
scenarioAllCases = getAllCases(planId);
|
||||
scenarioAllCases.forEach(item -> {
|
||||
if (StringUtils.isBlank(item.getReportId())) {
|
||||
item.setReportId(StringUtils.EMPTY);
|
||||
}
|
||||
});
|
||||
if (saveResponse) {
|
||||
buildScenarioResponse(scenarioAllCases);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user