diff --git a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiReportMapper.xml b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiReportMapper.xml index 2debbcd7d1..8b75cc4a6a 100644 --- a/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiReportMapper.xml +++ b/backend/services/api-test/src/main/java/io/metersphere/api/mapper/ExtApiReportMapper.xml @@ -25,16 +25,16 @@ - SELECT api_report.* from ( + select distinct ar.id, ar.project_id, @@ -173,20 +173,9 @@ ar.start_time, project.organization_id, - CASE - WHEN ar.integrated = 0 THEN - c.num ELSE ar.id - END AS resourceNum, - - CASE - WHEN ar.integrated = 0 THEN - c.id ELSE ar.id - END AS resourceId, - - CASE - WHEN ar.integrated = 0 THEN - c.NAME ELSE ar.NAME - END AS resourceName, + if(ar.integrated, ar.id, c.num) AS resourceNum, + if(ar.integrated, ar.name,c.name) AS resourceName, + if (ar.integrated,ar.id,c.id ) AS resourceId, t.NAME AS poolName FROM @@ -198,16 +187,16 @@ where ar.test_plan_id = 'NONE' and ar.start_time BETWEEN #{startTime} AND #{endTime} - ) as api_report - where - api_report.project_id IN + + and + ar.project_id IN #{projectId} - and ( api_report.resourceName like concat('%', #{request.keyword},'%') + and ( if(ar.integrated, ar.id, c.num) like concat('%', #{request.keyword},'%') - or api_report.resourceNum like concat('%', #{request.keyword},'%') + or if(ar.integrated, ar.name,c.name) like concat('%', #{request.keyword},'%') ) @@ -215,29 +204,34 @@ select - api_scenario_report.* - from api_scenario_report where api_scenario_report.deleted = false - and api_scenario_report.test_plan_id = 'NONE' + asr.* + from api_scenario_report asr where asr.deleted = false + and asr.test_plan_id = 'NONE' and ( - api_scenario_report.name like concat('%', #{request.keyword},'%') + asr.name like concat('%', #{request.keyword},'%') ) - and api_scenario_report.project_id = #{request.projectId} + and asr.project_id = #{request.projectId} @@ -41,16 +41,16 @@