org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper.xml Maven / Gradle / Ivy
<?xml version="1.0" encoding="UTF-8" ?> <!-- ~ Licensed to the Apache Software Foundation (ASF) under one or more ~ contributor license agreements. See the NOTICE file distributed with ~ this work for additional information regarding copyright ownership. ~ The ASF licenses this file to You under the Apache License, Version 2.0 ~ (the "License"); you may not use this file except in compliance with ~ the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License. --> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > <mapper namespace="org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper"> <select id="queryDetailById" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select inst.* from t_ds_process_instance inst where inst.id = #{processId} </select> <select id="queryByHostAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select * from t_ds_process_instance where 1=1 <if test="host != null and host != ''"> and host=#{host} </if> and state in <foreach collection="states" item="i" open="(" close=")" separator=","> #{i} </foreach> order by id asc </select> <select id="queryByTenantIdAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select * from t_ds_process_instance where 1=1 <if test="tenantId != -1"> and tenant_id =#{tenantId} </if> and state in <foreach collection="states" item="i" open="(" close=")" separator=","> #{i} </foreach> order by id asc </select> <select id="queryByWorkerGroupIdAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select * from t_ds_process_instance where 1=1 <if test="workerGroupId != -1"> and worker_group_id =#{workerGroupId} </if> and state in <foreach collection="states" item="i" open="(" close=")" separator=","> #{i} </foreach> order by id asc </select> <select id="queryProcessInstanceListPaging" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select instance.* from t_ds_process_instance instance join t_ds_process_definition define ON instance.process_definition_id = define.id where 1=1 and instance.is_sub_process=0 and define.project_id = #{projectId} <if test="processDefinitionId != 0"> and instance.process_definition_id = #{processDefinitionId} </if> <if test="searchVal != null and searchVal != ''"> and instance.name like concat('%', #{searchVal}, '%') </if> <if test="startTime != null "> and instance.start_time > #{startTime} and instance.start_time <![CDATA[ <=]]> #{endTime} </if> <if test="states != null and states != ''"> and instance.state in <foreach collection="states" index="index" item="i" open="(" separator="," close=")"> #{i} </foreach> </if> <if test="host != null and host != ''"> and instance.host like concat('%', #{host}, '%') </if> order by instance.start_time desc </select> <update id="setFailoverByHostAndStateArray"> update t_ds_process_instance set host=null where host =#{host} and state in <foreach collection="states" index="index" item="i" open="(" close=")" separator=","> #{i} </foreach> </update> <update id="updateProcessInstanceByState"> update t_ds_process_instance set state = #{destState} where state = #{originState} </update> <update id="updateProcessInstanceByTenantId"> update t_ds_process_instance set tenant_id = #{destTenantId} where tenant_id = #{originTenantId} </update> <update id="updateProcessInstanceByWorkerGroupId"> update t_ds_process_instance set worker_group_id = #{destWorkerGroupId} where worker_group_id = #{originWorkerGroupId} </update> <select id="countInstanceStateByUser" resultType="org.apache.dolphinscheduler.dao.entity.ExecuteStatusCount"> select t.state, count(0) as count from t_ds_process_instance t join t_ds_process_definition d on d.id=t.process_definition_id join t_ds_project p on p.id=d.project_id where 1 = 1 and t.is_sub_process = 0 <if test="startTime != null and endTime != null"> and t.start_time <![CDATA[ >= ]]> #{startTime} and t.start_time <![CDATA[ <= ]]> #{endTime} </if> <if test="projectIds != null and projectIds.length != 0"> and p.id in <foreach collection="projectIds" index="index" item="i" open="(" close=")" separator=","> #{i} </foreach> </if> group by t.state </select> <select id="queryByProcessDefineId" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select * from t_ds_process_instance where process_definition_id=#{processDefinitionId} order by start_time desc limit #{size} </select> <select id="queryLastSchedulerProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select * from t_ds_process_instance where process_definition_id=#{processDefinitionId} <if test="startTime!=null and endTime != null "> and schedule_time <![CDATA[ >= ]]> #{startTime} and schedule_time <![CDATA[ <= ]]> #{endTime} </if> order by end_time desc limit 1 </select> <select id="queryLastRunningProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select * from t_ds_process_instance where 1=1 <if test="states !=null and states.length != 0"> and state in <foreach collection="states" item="i" index="index" open="(" separator="," close=")"> #{i} </foreach> </if> <if test="startTime!=null and endTime != null "> and process_definition_id=#{processDefinitionId} and (schedule_time <![CDATA[ >= ]]> #{startTime} and schedule_time <![CDATA[ <= ]]> #{endTime} or start_time <![CDATA[ >= ]]> #{startTime} and start_time <![CDATA[ <= ]]> #{endTime}) </if> order by start_time desc limit 1 </select> <select id="queryLastManualProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance"> select * from t_ds_process_instance where process_definition_id=#{processDefinitionId} and schedule_time is null <if test="startTime!=null and endTime != null "> and start_time <![CDATA[ >= ]]> #{startTime} and start_time <![CDATA[ <= ]]> #{endTime} </if> order by end_time desc limit 1 </select> </mapper>
© 2015 - 2025 Weber Informatics LLC | Privacy Policy