fix(任务中心): 修复停止任务,未执行任务项状态没有更新问题

--bug=1049101 --user=王旭 【任务中心】-手动停止执行中的任务,任务详情中未执行的用例和场景的执行状态没有更新为已停止 https://www.tapd.cn/55049933/s/1612863
This commit is contained in:
WangXu10 2024-11-20 11:25:19 +08:00 committed by 刘瑞斌
parent eb974c121a
commit bf34c5d21e
4 changed files with 20 additions and 3 deletions

View File

@ -194,7 +194,7 @@
<if test="organizationId != null and organizationId != ''"> <if test="organizationId != null and organizationId != ''">
and organization_id = #{organizationId} and organization_id = #{organizationId}
</if> </if>
and `status` = 'RUNNING' and `status` in ('RUNNING', 'PENDING')
and deleted = false and deleted = false
</update> </update>
@ -236,7 +236,7 @@
<if test="organizationId != null and organizationId != ''"> <if test="organizationId != null and organizationId != ''">
and organization_id = #{organizationId} and organization_id = #{organizationId}
</if> </if>
and `status` = 'RUNNING' and `status` in ('RUNNING', 'PENDING')
</update> </update>
<select id="getResourcePoolsByItemIds" resultType="io.metersphere.system.domain.ExecTaskItem"> <select id="getResourcePoolsByItemIds" resultType="io.metersphere.system.domain.ExecTaskItem">

View File

@ -23,6 +23,7 @@ public interface ExtExecTaskMapper {
/** /**
* 查询时间范围内的任务ID集合 * 查询时间范围内的任务ID集合
*
* @param timeMills 时间戳 * @param timeMills 时间戳
* @param projectId 项目ID * @param projectId 项目ID
* @return 任务ID列表 * @return 任务ID列表
@ -30,4 +31,6 @@ public interface ExtExecTaskMapper {
List<String> getTaskIdsByTime(@Param("timeMills") long timeMills, @Param("projectId") String projectId); List<String> getTaskIdsByTime(@Param("timeMills") long timeMills, @Param("projectId") String projectId);
List<ExecTaskItemDetailDTO> selectTypeByItemId(@Param("itemId") String itemId); List<ExecTaskItemDetailDTO> selectTypeByItemId(@Param("itemId") String itemId);
List<String> getSelectIds(@Param("ids") List<String> ids, @Param("flag") boolean flag);
} }

View File

@ -149,4 +149,18 @@
exec_task_item.task_origin as taskOrigin exec_task_item.task_origin as taskOrigin
from exec_task inner join exec_task_item on exec_task.id = exec_task_item.task_id where exec_task_item.id = #{itemId} from exec_task inner join exec_task_item on exec_task.id = exec_task_item.task_id where exec_task_item.id = #{itemId}
</select> </select>
<select id="getSelectIds" resultType="java.lang.String">
select id from exec_task
where deleted = false
<if test="flag">
and status = 'RUNNING'
</if>
<if test="ids != null and ids.size() > 0">
and id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
</select>
</mapper> </mapper>

View File

@ -692,7 +692,7 @@ public class BaseTaskHubService {
} }
return ids; return ids;
} else { } else {
return request.getSelectIds(); return extExecTaskMapper.getSelectIds(request.getSelectIds(), flag);
} }
} }