diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.java b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.java index c6eb8b8a10..e91b382ea8 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.java +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.java @@ -1,11 +1,11 @@ package io.metersphere.base.mapper.ext; -import io.metersphere.dto.PlanReportCaseDTO; import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.datacount.ExecutedCaseInfoResult; import io.metersphere.base.domain.ApiDefinitionExecResult; import io.metersphere.base.domain.ApiDefinitionExecResultExpand; import io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs; +import io.metersphere.dto.PlanReportCaseDTO; import io.metersphere.task.dto.TaskCenterRequest; import org.apache.ibatis.annotations.InsertProvider; import org.apache.ibatis.annotations.Param; @@ -24,7 +24,7 @@ public interface ExtApiDefinitionExecResultMapper { ApiDefinitionExecResultWithBLOBs selectMaxResultByResourceIdAndType(String resourceId, String type); - long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp); + long countByProjectIDAndCreateInThisWeek(@Param("projectId") String projectId, @Param("version") String version, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp); long countByTestCaseIDInProject(String projectId); diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml index 547cfc7b82..7e55f7b874 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiDefinitionExecResultMapper.xml @@ -31,6 +31,9 @@ FROM api_test_case testCase WHERE testCase.project_id = #{projectId} ) + + AND version = #{version} + AND create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java index 33443af228..40eb41e7bb 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.java @@ -1,11 +1,11 @@ package io.metersphere.base.mapper.ext; -import io.metersphere.dto.PlanReportCaseDTO; import io.metersphere.api.dto.QueryAPIReportRequest; import io.metersphere.api.dto.automation.ApiScenarioReportResult; import io.metersphere.api.dto.datacount.ApiDataCountResult; import io.metersphere.base.domain.ApiScenarioReport; import io.metersphere.dto.ApiReportCountDTO; +import io.metersphere.dto.PlanReportCaseDTO; import io.metersphere.task.dto.TaskCenterRequest; import org.apache.ibatis.annotations.InsertProvider; import org.apache.ibatis.annotations.Param; @@ -20,11 +20,11 @@ public interface ExtApiScenarioReportMapper { long countByProjectID(String projectId); - long countByProjectIdAndCreateInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp); + long countByProjectIdAndCreateInThisWeek(@Param("projectId") String projectId, @Param("version") String version, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp); - long countByProjectIdAndCreateAndByScheduleInThisWeek(@Param("projectId") String projectId, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp); + long countByProjectIdAndCreateAndByScheduleInThisWeek(@Param("projectId") String projectId, @Param("version") String version, @Param("firstDayTimestamp") long firstDayTimestamp, @Param("lastDayTimestamp") long lastDayTimestamp); - List countByProjectIdGroupByExecuteResult(String projectId); + List countByProjectIdGroupByExecuteResult(@Param("projectId") String projectId, @Param("version") String version); List selectLastReportByIds(@Param("scenarioIdList") List ids); diff --git a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml index d2125a112e..b5c88a2d05 100644 --- a/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml +++ b/api-test/backend/src/main/java/io/metersphere/base/mapper/ext/ExtApiScenarioReportMapper.xml @@ -358,41 +358,37 @@ SELECT count(id) AS countNumber FROM scenario_execution_info WHERE create_time BETWEEN #{firstDayTimestamp} AND #{lastDayTimestamp} - AND ( - source_id in ( - SELECT id - FROM api_scenario - WHERE project_id = #{projectId} - ) or - source_id in ( - select id - FROM test_plan_api_scenario - WHERE api_scenario_id in (SELECT id - FROM api_scenario - WHERE project_id = #{projectId}) - ) - ) + AND project_id = #{projectId} + + AND version = #{version} +