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

View File

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

View File

@ -187,7 +187,9 @@ public class ApiReportService {
consoleExample.createCriteria().andReportIdEqualTo(id); consoleExample.createCriteria().andReportIdEqualTo(id);
List<ApiReportLog> apiReportLogs = apiReportLogMapper.selectByExampleWithBLOBs(consoleExample); List<ApiReportLog> apiReportLogs = apiReportLogMapper.selectByExampleWithBLOBs(consoleExample);
if (CollectionUtils.isNotEmpty(apiReportLogs)) { 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()); apiReportDTO.setPoolName(testResourcePoolMapper.selectByPrimaryKey(apiReportDTO.getPoolId()).getName());
@ -251,7 +253,7 @@ public class ApiReportService {
apiReportDetails.forEach(apiReportDetail -> { apiReportDetails.forEach(apiReportDetail -> {
ApiReportDetailDTO apiReportDetailDTO = new ApiReportDetailDTO(); ApiReportDetailDTO apiReportDetailDTO = new ApiReportDetailDTO();
BeanUtils.copyBean(apiReportDetailDTO, apiReportDetail); 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); results.add(apiReportDetailDTO);
}); });
return results; return results;

View File

@ -345,7 +345,7 @@ public class ApiScenarioReportService {
apiReportDetails.forEach(apiReportDetail -> { apiReportDetails.forEach(apiReportDetail -> {
ApiScenarioReportDetailDTO apiReportDetailDTO = new ApiScenarioReportDetailDTO(); ApiScenarioReportDetailDTO apiReportDetailDTO = new ApiScenarioReportDetailDTO();
BeanUtils.copyBean(apiReportDetailDTO, apiReportDetail); 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); results.add(apiReportDetailDTO);
}); });
return results; return results;

View File

@ -194,7 +194,7 @@
}; };
const activeIndex = ref<number>(0); 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 current = ref(1);
const pageSize = ref(1); const pageSize = ref(1);