Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@
workflow_instance_priority, worker_group,environment_code, timeout, tenant_code, var_pool,
dry_run, next_workflow_instance_id, restart_time, state_history
</sql>
<sql id="listSql">
id
, name, workflow_definition_version, workflow_definition_code, project_code, state, recovery, start_time, end_time, run_times,host,
command_type, task_depend_type, max_try_times, failure_strategy, warning_type,
warning_group_id, schedule_time, command_start_time, flag,
update_time, is_sub_workflow, executor_id,
workflow_instance_priority, worker_group,environment_code, timeout, tenant_code,
dry_run, next_workflow_instance_id, restart_time
</sql>

<select id="queryDetailById" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
Expand All @@ -36,7 +45,7 @@
</select>
<select id="queryByHostAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where 1=1
<if test="host != null and host != ''">
Expand All @@ -63,7 +72,7 @@

<select id="queryTopNWorkflowInstance" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where state = #{status}
<if test="projectCode != 0">
Expand All @@ -77,7 +86,7 @@

<select id="queryByTenantCodeAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where 1=1
<if test="tenantCode != ''">
Expand All @@ -91,10 +100,9 @@
</if>
order by id asc
</select>

<select id="queryByWorkerGroupNameAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where 1=1
<if test="workerGroupName != ''">
Expand All @@ -111,7 +119,7 @@

<select id="queryWorkflowInstanceListPaging" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where is_sub_workflow=0
and project_code = #{projectCode}
Expand Down Expand Up @@ -195,7 +203,7 @@

<select id="queryByWorkflowDefinitionCode" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where workflow_definition_code=#{workflowDefinitionCode}
order by start_time desc limit #{size}
Expand Down Expand Up @@ -254,19 +262,17 @@
</if>
order by start_time desc limit 1
</select>

<select id="queryFirstScheduleWorkflowInstance" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where workflow_definition_code = #{workflowDefinitionCode} and schedule_time is not null
order by schedule_time
limit 1
</select>

<select id="queryFirstStartWorkflowInstance" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where workflow_definition_code = #{workflowDefinitionCode} and start_time is not null
order by start_time
Expand All @@ -275,7 +281,7 @@

<select id="queryByWorkflowDefinitionCodeAndStatus" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where workflow_definition_code=#{workflowDefinitionCode}
<if test="states != null and states.length != 0">
Expand All @@ -286,10 +292,9 @@
</if>
order by id asc
</select>

<select id="queryByWorkflowCodeVersionStatus" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance
where workflow_definition_code=#{workflowDefinitionCode}
and workflow_definition_version = #{workflowDefinitionVersion}
Expand All @@ -303,7 +308,7 @@

<select id="queryWorkflowInstanceListV2Paging" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
SELECT
<include refid="baseSql"/>
<include refid="listSql"/>
FROM t_ds_workflow_instance
where is_sub_workflow=0
<if test="projectCode != 0">
Expand Down Expand Up @@ -357,7 +362,7 @@
<!-- There are some columns with the same names in both tables, we use a sub-query here to avoid ambiguity-->
<select id="queryByTriggerCode" resultType="org.apache.dolphinscheduler.dao.entity.WorkflowInstance">
select
<include refid="baseSql"/>
<include refid="listSql"/>
from t_ds_workflow_instance a
join
(select trigger_type, job_id, trigger_code from t_ds_trigger_relation) b
Expand Down
Loading