Skip to content

Commit

Permalink
Merge 848f48f into 49d04de
Browse files Browse the repository at this point in the history
  • Loading branch information
EricGao888 committed Mar 21, 2024
2 parents 49d04de + 848f48f commit dfaf872
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 54 deletions.
Expand Up @@ -199,22 +199,6 @@ ProcessInstance queryLastSchedulerProcess(@Param("processDefinitionCode") Long d
@Param("endTime") Date endTime,
@Param("testFlag") int testFlag);

/**
* query last running process instance
*
* @param definitionCode definitionCode
* @param startTime startTime
* @param endTime endTime
* @param testFlag testFlag
* @param stateArray stateArray
* @return process instance
*/
ProcessInstance queryLastRunningProcess(@Param("processDefinitionCode") Long definitionCode,
@Param("startTime") Date startTime,
@Param("endTime") Date endTime,
@Param("testFlag") int testFlag,
@Param("states") int[] stateArray);

/**
* query last manual process instance
*
Expand Down
Expand Up @@ -206,23 +206,6 @@
</if>
order by end_time desc limit 1
</select>
<select id="queryLastRunningProcess" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select
<include refid="baseSql"/>
from t_ds_process_instance
where process_definition_code=#{processDefinitionCode} and test_flag=#{testFlag}
<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 ((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 t1.*
from
Expand Down
Expand Up @@ -269,27 +269,6 @@ public void testQueryLastSchedulerProcess() {
processInstanceMapper.deleteById(processInstance.getId());
}

/**
* test query last running process instance
*/
@Test
public void testQueryLastRunningProcess() {
ProcessInstance processInstance = insertOne();
processInstance.setState(WorkflowExecutionStatus.RUNNING_EXECUTION);
processInstanceMapper.updateById(processInstance);

int[] stateArray = new int[]{
WorkflowExecutionStatus.RUNNING_EXECUTION.ordinal(),
WorkflowExecutionStatus.SUBMITTED_SUCCESS.ordinal()};

ProcessInstance processInstance1 = processInstanceMapper
.queryLastRunningProcess(processInstance.getProcessDefinitionCode(), null, null,
processInstance.getTestFlag(), stateArray);

Assertions.assertNotEquals(null, processInstance1);
processInstanceMapper.deleteById(processInstance.getId());
}

/**
* test query last manual process instance
*/
Expand Down

0 comments on commit dfaf872

Please sign in to comment.