fix(系统设置): 修复任务中心筛选不生效的缺陷

--bug=1039094 --user=王孝刚 【项目任务中心】场景任务列表-按ID搜索抱参数校验失败
https://www.tapd.cn/55049933/s/1495524
This commit is contained in:
wxg0103 2024-04-12 11:18:00 +08:00 committed by 刘瑞斌
parent ed4a860bbb
commit ce975229c9
5 changed files with 63 additions and 57 deletions

View File

@ -161,49 +161,52 @@
</sql>
<select id="taskCenterlist" resultType="io.metersphere.system.dto.taskcenter.TaskCenterDTO">
SELECT
distinct api_report.id,
api_report.project_id,
api_report.integrated,
api_report.STATUS,
api_report.start_time AS operationTime,
api_report.create_user AS operationName,
api_report.trigger_mode,
SELECT api_report.* from (
select
distinct ar.id,
ar.project_id,
ar.integrated,
ar.STATUS,
ar.start_time AS operationTime,
ar.create_user AS operationName,
ar.trigger_mode,
ar.start_time,
CASE
WHEN api_report.integrated = 0 THEN
c.num ELSE api_report.id
WHEN ar.integrated = 0 THEN
c.num ELSE ar.id
END AS resourceNum,
CASE
WHEN api_report.integrated = 0 THEN
c.id ELSE api_report.id
WHEN ar.integrated = 0 THEN
c.id ELSE ar.id
END AS resourceId,
CASE
WHEN api_report.integrated = 0 THEN
c.NAME ELSE api_report.NAME
WHEN ar.integrated = 0 THEN
c.NAME ELSE ar.NAME
END AS resourceName,
t.NAME AS poolName
FROM
api_report
LEFT JOIN api_test_case_record a ON api_report.id = a.api_report_id
api_report ar
LEFT JOIN api_test_case_record a ON ar.id = a.api_report_id
LEFT JOIN api_test_case c ON a.api_test_case_id = c.id
LEFT JOIN test_resource_pool t ON api_report.pool_id = t.id
left join project on api_report.project_id = project.id
where api_report.deleted = false
and api_report.test_plan_id = 'NONE'
and api_report.start_time BETWEEN #{startTime} AND #{endTime}
and api_report.project_id IN
LEFT JOIN test_resource_pool t ON ar.pool_id = t.id
left join project on ar.project_id = project.id
where ar.deleted = false
and ar.test_plan_id = 'NONE'
and ar.start_time BETWEEN #{startTime} AND #{endTime}
) as api_report
where
api_report.project_id IN
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
#{projectId}
</foreach>
<if test="request.keyword != null and request.keyword != ''">
and ( (api_report.name like concat('%', #{request.keyword},'%')
and c.name like concat('%', #{request.keyword},'%'))
or (api_report.id like concat('%', #{request.keyword},'%')
and c.num like concat('%', #{request.keyword},'%'))
and ( api_report.resourceName like concat('%', #{request.keyword},'%')
or api_report.resourceNum like concat('%', #{request.keyword},'%')
)
</if>
<include refid="filters">

View File

@ -140,51 +140,52 @@
</select>
<select id="taskCenterlist" resultType="io.metersphere.system.dto.taskcenter.TaskCenterDTO">
select * from (
select
distinct api_scenario_report.id,
api_scenario_report.project_id,
api_scenario_report.integrated,
api_scenario_report.status,
api_scenario_report.start_time as operationTime,
api_scenario_report.create_user as operationName,
api_scenario_report.trigger_mode,
api_scenario_report.script_identifier,
distinct asr.id,
asr.project_id,
asr.integrated,
asr.status,
asr.start_time as operationTime,
asr.create_user as operationName,
asr.trigger_mode,
asr.script_identifier,
asr.start_time,
CASE
WHEN api_scenario_report.integrated = 0 THEN
s.num ELSE api_scenario_report.id
WHEN asr.integrated = 0 THEN
s.num ELSE asr.id
END AS resourceNum,
CASE
WHEN api_scenario_report.integrated = 0 THEN
s.NAME ELSE api_scenario_report.NAME
WHEN asr.integrated = 0 THEN
s.NAME ELSE asr.NAME
END AS resourceName,
CASE
WHEN api_scenario_report.integrated = 0 THEN
s.id ELSE api_scenario_report.id
WHEN asr.integrated = 0 THEN
s.id ELSE asr.id
END AS resourceId,
t.name as poolName
from api_scenario_report
left join api_scenario_record a on api_scenario_report.id = a.api_scenario_report_id
from api_scenario_report asr
left join api_scenario_record a on asr.id = a.api_scenario_report_id
left JOIN api_scenario s on a.api_scenario_id = s.id
left JOIN test_resource_pool t on api_scenario_report.pool_id = t.id
left join project on api_scenario_report.project_id = project.id
where api_scenario_report.deleted = false
and api_scenario_report.test_plan_id = 'NONE'
and api_scenario_report.start_time BETWEEN #{startTime} AND #{endTime}
and api_scenario_report.project_id IN
left JOIN test_resource_pool t on asr.pool_id = t.id
left join project on asr.project_id = project.id
where asr.deleted = false
and asr.test_plan_id = 'NONE'
and asr.start_time BETWEEN #{startTime} AND #{endTime} ) api_scenario_report
where
api_scenario_report.project_id IN
<foreach collection="projectIds" item="projectId" separator="," open="(" close=")">
#{projectId}
</foreach>
<if test="request.keyword != null and request.keyword != ''">
and (
(api_scenario_report.name like concat('%', #{request.keyword},'%')
and s.name like concat('%', #{request.keyword},'%'))
or (api_scenario_report.id like concat('%', #{request.keyword},'%')
and s.num like concat('%', #{request.keyword},'%'))
)
api_scenario_report.resourceName like concat('%', #{request.keyword},'%')
or api_scenario_report.resourceId like concat('%', #{request.keyword},'%')
)
</if>
<include refid="filters">
<property name="filter" value="request.filter"/>

View File

@ -187,7 +187,9 @@ public class ApiReportService {
consoleExample.createCriteria().andReportIdEqualTo(id);
List<ApiReportLog> apiReportLogs = apiReportLogMapper.selectByExampleWithBLOBs(consoleExample);
if (CollectionUtils.isNotEmpty(apiReportLogs)) {
apiReportDTO.setConsole(new String(apiReportLogs.getFirst().getConsole()));
//获取所有的console,生成集合
List<String> consoleList = apiReportLogs.stream().map(c -> new String (c.getConsole())).toList();
apiReportDTO.setConsole(String.join("\n", consoleList));
}
//查询资源池名称
apiReportDTO.setPoolName(testResourcePoolMapper.selectByPrimaryKey(apiReportDTO.getPoolId()).getName());
@ -251,7 +253,7 @@ public class ApiReportService {
apiReportDetails.forEach(apiReportDetail -> {
ApiReportDetailDTO apiReportDetailDTO = new ApiReportDetailDTO();
BeanUtils.copyBean(apiReportDetailDTO, apiReportDetail);
apiReportDetailDTO.setContent(ApiDataUtils.parseObject(new String(apiReportDetail.getContent()), RequestResult.class));
apiReportDetailDTO.setContent(apiReportDetail.getContent() != null ? ApiDataUtils.parseObject(new String(apiReportDetail.getContent()), RequestResult.class): null);
results.add(apiReportDetailDTO);
});
return results;

View File

@ -345,7 +345,7 @@ public class ApiScenarioReportService {
apiReportDetails.forEach(apiReportDetail -> {
ApiScenarioReportDetailDTO apiReportDetailDTO = new ApiScenarioReportDetailDTO();
BeanUtils.copyBean(apiReportDetailDTO, apiReportDetail);
apiReportDetailDTO.setContent(ApiDataUtils.parseObject(new String(apiReportDetail.getContent()), RequestResult.class));
apiReportDetailDTO.setContent(apiReportDetail.getContent() != null ? ApiDataUtils.parseObject(new String(apiReportDetail.getContent()), RequestResult.class) : null);
results.add(apiReportDetailDTO);
});
return results;

View File

@ -194,7 +194,7 @@
};
const activeIndex = ref<number>(0);
const total = computed(() => (activeStepDetail.value?.content.subRequestResults || []).length);
const total = computed(() => (activeStepDetail.value?.content?.subRequestResults || []).length);
const current = ref(1);
const pageSize = ref(1);