提交 63982c60 编写于 作者: J Joram Barrez

Cmmn: add deployment id query option for tasks

上级 dc523532
......@@ -23,6 +23,8 @@ import org.flowable.cmmn.engine.runtime.CaseInstance;
import org.flowable.cmmn.engine.runtime.CaseInstanceQuery;
import org.flowable.engine.common.impl.interceptor.CommandContext;
import org.flowable.engine.common.impl.persistence.entity.data.DataManager;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.flowable.task.service.impl.persistence.entity.TaskEntityManager;
import org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntity;
import org.flowable.variable.service.impl.persistence.entity.VariableInstanceEntityManager;
import org.flowable.variable.service.type.VariableScopeType;
......@@ -76,14 +78,21 @@ public class CaseInstanceEntityManagerImpl extends AbstractCmmnEntityManager<Cas
CommandContext commandContext = CommandContextUtil.getCommandContext();
// Variables
CommandContextUtil.getVariableServiceConfiguration(commandContext).getVariableInstanceEntityManager();
VariableInstanceEntityManager variableInstanceEntityManager = getVariableInstanceEntityManager();
VariableInstanceEntityManager variableInstanceEntityManager
= CommandContextUtil.getVariableServiceConfiguration(commandContext).getVariableInstanceEntityManager();
List<VariableInstanceEntity> variableInstanceEntities = variableInstanceEntityManager
.findVariableInstanceByScopeIdAndScopeType(caseInstanceId, VariableScopeType.CMMN);
for (VariableInstanceEntity variableInstanceEntity : variableInstanceEntities) {
variableInstanceEntityManager.delete(variableInstanceEntity);
}
// Tasks
TaskEntityManager taskEntityManager = CommandContextUtil.getTaskServiceConfiguration(commandContext).getTaskEntityManager();
List<TaskEntity> taskEntities = taskEntityManager.findTasksByScopeIdAndScopeType(caseInstanceId, VariableScopeType.CMMN);
for (TaskEntity taskEntity : taskEntities) {
taskEntityManager.delete(taskEntity);
}
// Sentry part instances
List<SentryPartInstanceEntity> sentryPartInstances = caseInstanceEntity.getSatisfiedSentryPartInstances();
for (SentryPartInstanceEntity sentryPartInstanceEntity : sentryPartInstances) {
......
......@@ -84,6 +84,13 @@ public class FlowableCmmnTestCase {
}
}
protected void deployOneHumanTaskCaseModel() {
deploymentId = cmmnRepositoryService.createDeployment()
.addClasspathResource("org/flowable/cmmn/test/one-human-task-model.cmmn")
.deploy()
.getId();
}
protected void deployOneTaskCaseModel() {
deploymentId = cmmnRepositoryService.createDeployment()
.addClasspathResource("org/flowable/cmmn/test/one-task-model.cmmn")
......
/* Licensed 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.
*/
package org.flowable.cmmn.test.task;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import org.flowable.cmmn.engine.repository.CaseDefinition;
import org.flowable.cmmn.engine.repository.CmmnDeployment;
import org.flowable.cmmn.engine.runtime.CaseInstance;
import org.flowable.cmmn.engine.runtime.PlanItemInstance;
import org.flowable.cmmn.engine.test.FlowableCmmnTestCase;
import org.junit.Before;
import org.junit.Test;
/**
* @author Joram Barrez
*/
public class CmmnTaskQueryTest extends FlowableCmmnTestCase {
private static final int NR_CASE_INSTANCES = 5;
@Before
public void createCaseInstance() {
deployOneHumanTaskCaseModel();
for (int i=0; i<NR_CASE_INSTANCES; i++) {
cmmnRuntimeService.createCaseInstanceBuilder().caseDefinitionKey("oneTaskCase").variable("index", i).start();
}
}
@Test
public void testNoParams() {
assertEquals(NR_CASE_INSTANCES, cmmnTaskService.createTaskQuery().count());
assertEquals(NR_CASE_INSTANCES, cmmnTaskService.createTaskQuery().list().size());
}
@Test
public void testQueryByCaseInstanceId() {
List<CaseInstance> caseInstances = cmmnRuntimeService.createCaseInstanceQuery().list();
assertEquals(5, caseInstances.size());
for (CaseInstance caseInstance : caseInstances) {
assertEquals(1, cmmnTaskService.createTaskQuery().caseInstanceId(caseInstance.getId()).list().size());
}
}
@Test
public void testQueryByPlanItemInstanceId() {
List<CaseInstance> caseInstances = cmmnRuntimeService.createCaseInstanceQuery().list();
assertEquals(5, caseInstances.size());
for (CaseInstance caseInstance : caseInstances) {
List<PlanItemInstance> planItemInstances = cmmnRuntimeService.createPlanItemInstanceQuery().planItemInstanceStateActive().caseInstanceId(caseInstance.getId()).list();
assertEquals(1, planItemInstances.size());
assertNotNull(cmmnTaskService.createTaskQuery().planItemInstanceId(planItemInstances.get(0).getId()));
assertNotNull(cmmnTaskService.createTaskQuery()
.caseInstanceId(caseInstance.getId())
.planItemInstanceId(planItemInstances.get(0).getId()));
assertNotNull(cmmnTaskService.createTaskQuery()
.caseInstanceId(caseInstance.getId())
.caseDefinitionId(caseInstance.getCaseDefinitionId())
.planItemInstanceId(planItemInstances.get(0).getId()));
}
}
@Test
public void testQuertByCaseDefinitionId() {
CaseDefinition caseDefinition = cmmnRepositoryService.createCaseDefinitionQuery().singleResult();
assertNotNull(caseDefinition);
assertEquals(NR_CASE_INSTANCES, cmmnTaskService.createTaskQuery().caseDefinitionId(caseDefinition.getId()).list().size());
}
@Test
public void testQueryByCmmnDeploymentId() {
CmmnDeployment deployment = cmmnRepositoryService.createDeploymentQuery().singleResult();
assertNotNull(deployment);
assertEquals(NR_CASE_INSTANCES, cmmnTaskService.createTaskQuery().cmmnDeploymentId(deployment.getId()).list().size());
}
@Test
public void testQueryByAssignee() {
assertEquals(NR_CASE_INSTANCES, cmmnTaskService.createTaskQuery().taskAssignee("johnDoe").list().size());
}
@Test
public void testQueryByVariableValueEquals() {
for (int i=0; i<NR_CASE_INSTANCES; i++) {
assertNotNull(cmmnTaskService.createTaskQuery().taskVariableValueEquals(i));
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL"
xmlns:dc="http://www.omg.org/spec/CMMN/20151109/DC"
xmlns:di="http://www.omg.org/spec/CMMN/20151109/DI"
xmlns:cmmndi="http://www.omg.org/spec/CMMN/20151109/CMMNDI"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:flowable="http://flowable.org/cmmn"
targetNamespace="http://flowable.org/cmmn">
<case id="oneTaskCase">
<casePlanModel id="myPlanModel" name="My CasePlanModel">
<planItem id="planItem1" name="The task" definitionRef="theTask" />
<humanTask id="theTask" name="The Task" flowable:assignee="johnDoe" />
</casePlanModel>
</case>
</definitions>
......@@ -347,6 +347,16 @@ public interface TaskInfoQuery<T extends TaskInfoQuery<?, ?>, V extends TaskInfo
* Only select tasks which are part of a process instance which has the given deployment id.
*/
T deploymentIdIn(List<String> deploymentIds);
/**
* Only select tasks which are related to a case instance for to the given deployment id.
*/
T cmmnDeploymentId(String cmmnDeploymentId);
/**
* Only select tasks which are related to a case instances for the given deployment id.
*/
T cmmnDeploymentIdIn(List<String> cmmnDeploymentIds);
/**
* Only select tasks which have a local task variable with the given name set to the given value.
......
......@@ -23,6 +23,7 @@ import org.flowable.engine.common.impl.interceptor.CommandContext;
import org.flowable.engine.common.impl.interceptor.CommandExecutor;
import org.flowable.idm.api.Group;
import org.flowable.idm.api.IdmIdentityService;
import org.flowable.task.service.TaskQuery;
import org.flowable.task.service.TaskServiceConfiguration;
import org.flowable.task.service.history.HistoricTaskInstance;
import org.flowable.task.service.history.HistoricTaskInstanceQuery;
......@@ -50,6 +51,8 @@ public class HistoricTaskInstanceQueryImpl extends AbstractVariableQueryImpl<His
protected List<String> processCategoryNotInList;
protected String deploymentId;
protected List<String> deploymentIds;
protected String cmmnDeploymentId;
protected List<String> cmmnDeploymentIds;
protected String processInstanceId;
protected List<String> processInstanceIds;
protected String processInstanceBusinessKey;
......@@ -437,6 +440,26 @@ public class HistoricTaskInstanceQueryImpl extends AbstractVariableQueryImpl<His
}
return this;
}
@Override
public HistoricTaskInstanceQuery cmmnDeploymentId(String cmmnDeploymentId) {
if (inOrStatement) {
currentOrQueryObject.cmmnDeploymentId = cmmnDeploymentId;
} else {
this.cmmnDeploymentId = cmmnDeploymentId;
}
return this;
}
@Override
public HistoricTaskInstanceQuery cmmnDeploymentIdIn(List<String> cmmnDeploymentIds) {
if (inOrStatement) {
currentOrQueryObject.cmmnDeploymentIds = cmmnDeploymentIds;
} else {
this.cmmnDeploymentIds = cmmnDeploymentIds;
}
return this;
}
@Override
public HistoricTaskInstanceQuery taskId(String taskId) {
......@@ -1536,6 +1559,14 @@ public class HistoricTaskInstanceQueryImpl extends AbstractVariableQueryImpl<His
public List<String> getDeploymentIds() {
return deploymentIds;
}
public String getCmmnDeploymentId() {
return cmmnDeploymentId;
}
public List<String> getCmmnDeploymentIds() {
return cmmnDeploymentIds;
}
public String getProcessInstanceBusinessKeyLike() {
return processInstanceBusinessKeyLike;
......
......@@ -96,6 +96,8 @@ public class TaskQueryImpl extends AbstractVariableQueryImpl<TaskQuery, Task> im
protected List<String> processCategoryNotInList;
protected String deploymentId;
protected List<String> deploymentIds;
protected String cmmnDeploymentId;
protected List<String> cmmnDeploymentIds;
protected String processInstanceBusinessKey;
protected String processInstanceBusinessKeyLike;
protected String processInstanceBusinessKeyLikeIgnoreCase;
......@@ -1163,6 +1165,26 @@ public class TaskQueryImpl extends AbstractVariableQueryImpl<TaskQuery, Task> im
}
return this;
}
@Override
public TaskQuery cmmnDeploymentId(String cmmnDeploymentId) {
if (orActive) {
currentOrQueryObject.cmmnDeploymentId = cmmnDeploymentId;
} else {
this.cmmnDeploymentId = cmmnDeploymentId;
}
return this;
}
@Override
public TaskQuery cmmnDeploymentIdIn(List<String> cmmnDeploymentIds) {
if (orActive) {
currentOrQueryObject.cmmnDeploymentIds = cmmnDeploymentIds;
} else {
this.cmmnDeploymentIds = cmmnDeploymentIds;
}
return this;
}
public TaskQuery dueDate(Date dueDate) {
if (orActive) {
......@@ -1701,6 +1723,14 @@ public class TaskQueryImpl extends AbstractVariableQueryImpl<TaskQuery, Task> im
public List<String> getDeploymentIds() {
return deploymentIds;
}
public String getCmmnDeploymentId() {
return cmmnDeploymentId;
}
public List<String> getCmmnDeploymentIds() {
return cmmnDeploymentIds;
}
public String getProcessInstanceBusinessKeyLike() {
return processInstanceBusinessKeyLike;
......
......@@ -55,7 +55,7 @@ public class TaskServiceImpl extends ServiceImpl implements TaskService {
@Override
public List<TaskEntity> findTasksBySubScopeIdScopeType(String subScopeId, String scopeType) {
return getTaskEntityManager().findTasksBySubScopeIdScopeType(subScopeId, scopeType);
return getTaskEntityManager().findTasksBySubScopeIdAndScopeType(subScopeId, scopeType);
}
@Override
......
......@@ -29,7 +29,9 @@ public interface TaskEntityManager extends EntityManager<TaskEntity> {
List<TaskEntity> findTasksByProcessInstanceId(String processInstanceId);
List<TaskEntity> findTasksBySubScopeIdScopeType(String subScopeId, String scopeType);
List<TaskEntity> findTasksByScopeIdAndScopeType(String scopeId, String scopeType);
List<TaskEntity> findTasksBySubScopeIdAndScopeType(String subScopeId, String scopeType);
List<Task> findTasksByQueryCriteria(TaskQueryImpl taskQuery);
......
......@@ -91,8 +91,13 @@ public class TaskEntityManagerImpl extends AbstractEntityManager<TaskEntity> imp
}
@Override
public List<TaskEntity> findTasksBySubScopeIdScopeType(String subScopeId, String scopeType) {
return taskDataManager.findTasksBySubScopeIdScopeType(subScopeId, scopeType);
public List<TaskEntity> findTasksByScopeIdAndScopeType(String scopeId, String scopeType) {
return taskDataManager.findTasksByScopeIdAndScopeType(scopeId, scopeType);
}
@Override
public List<TaskEntity> findTasksBySubScopeIdAndScopeType(String subScopeId, String scopeType) {
return taskDataManager.findTasksBySubScopeIdAndScopeType(subScopeId, scopeType);
}
@Override
......
......@@ -29,7 +29,9 @@ public interface TaskDataManager extends DataManager<TaskEntity> {
List<TaskEntity> findTasksByProcessInstanceId(String processInstanceId);
List<TaskEntity> findTasksBySubScopeIdScopeType(String subScopeId, String scopeType);
List<TaskEntity> findTasksByScopeIdAndScopeType(String scopeId, String scopeType);
List<TaskEntity> findTasksBySubScopeIdAndScopeType(String subScopeId, String scopeType);
List<Task> findTasksByQueryCriteria(TaskQueryImpl taskQuery);
......
......@@ -25,6 +25,7 @@ import org.flowable.task.service.impl.persistence.entity.TaskEntity;
import org.flowable.task.service.impl.persistence.entity.TaskEntityImpl;
import org.flowable.task.service.impl.persistence.entity.data.TaskDataManager;
import org.flowable.task.service.impl.persistence.entity.data.impl.cachematcher.TasksByExecutionIdMatcher;
import org.flowable.task.service.impl.persistence.entity.data.impl.cachematcher.TasksByScopeIdAndScopeTypeMatcher;
import org.flowable.task.service.impl.persistence.entity.data.impl.cachematcher.TasksBySubScopeIdAndScopeTypeMatcher;
import org.flowable.task.service.impl.util.CommandContextUtil;
......@@ -35,7 +36,9 @@ public class MybatisTaskDataManager extends AbstractDataManager<TaskEntity> impl
protected CachedEntityMatcher<TaskEntity> tasksByExecutionIdMatcher = new TasksByExecutionIdMatcher();
protected CachedEntityMatcher<TaskEntity> tasksBySubScopeIdAndScopeType = new TasksBySubScopeIdAndScopeTypeMatcher();
protected CachedEntityMatcher<TaskEntity> tasksBySubScopeIdAndScopeTypeMatcher = new TasksBySubScopeIdAndScopeTypeMatcher();
protected CachedEntityMatcher<TaskEntity> tasksByScopeIdAndScopeTypeMatcher = new TasksByScopeIdAndScopeTypeMatcher();
@Override
public Class<? extends TaskEntity> getManagedEntityClass() {
......@@ -59,11 +62,19 @@ public class MybatisTaskDataManager extends AbstractDataManager<TaskEntity> impl
}
@Override
public List<TaskEntity> findTasksBySubScopeIdScopeType(String subScopeId, String scopeType) {
public List<TaskEntity> findTasksByScopeIdAndScopeType(String scopeId, String scopeType) {
Map<String, String> params = new HashMap<>();
params.put("scopeId", scopeId);
params.put("scopeType", scopeType);
return getList("selectTasksByScopeIdAndScopeType", params, tasksByScopeIdAndScopeTypeMatcher, true);
}
@Override
public List<TaskEntity> findTasksBySubScopeIdAndScopeType(String subScopeId, String scopeType) {
Map<String, String> params = new HashMap<>();
params.put("subScopeId", subScopeId);
params.put("scopeType", scopeType);
return getList("selectTasksBySubScopeIdAndScopeType", params, tasksBySubScopeIdAndScopeType, true);
return getList("selectTasksBySubScopeIdAndScopeType", params, tasksBySubScopeIdAndScopeTypeMatcher, true);
}
@Override
......
/* Licensed 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.
*/
package org.flowable.task.service.impl.persistence.entity.data.impl.cachematcher;
import java.util.Map;
import org.flowable.engine.common.impl.db.CachedEntityMatcherAdapter;
import org.flowable.task.service.impl.persistence.entity.TaskEntity;
/**
* @author Joram Barrez
*/
public class TasksByScopeIdAndScopeTypeMatcher extends CachedEntityMatcherAdapter<TaskEntity> {
@SuppressWarnings("unchecked")
@Override
public boolean isRetained(TaskEntity taskEntity, Object parameter) {
String scopeId = ((Map<String, String>) parameter).get("scopeId");
String scopeType = ((Map<String, String>) parameter).get("scopeType");
return taskEntity.getScopeId() != null && taskEntity.getScopeId().equals(scopeId)
&& taskEntity.getScopeType() != null && taskEntity.getScopeType().equals(scopeType);
}
}
\ No newline at end of file
......@@ -510,6 +510,9 @@
<if test="deploymentId != null || (deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0)">
left outer join ${prefix}ACT_RE_PROCDEF DEPLOY_P ON RES.PROC_DEF_ID_ = DEPLOY_P.ID_
</if>
<if test="cmmnDeploymentId != null || (cmmnDeploymentIds != null &amp;&amp; cmmnDeploymentIds.size() &gt; 0)">
left outer join ${prefix}ACT_CMMN_CASEDEF DEPLOY_C ON RES.SCOPE_DEFINITION_ID_ = DEPLOY_C.ID_
</if>
<foreach collection="queryVariableValues" index="index" item="var">
<choose>
<when test="var.local">
......@@ -533,6 +536,9 @@
<if test="orQueryObject.deploymentId != null || (orQueryObject.deploymentIds != null &amp;&amp; orQueryObject.deploymentIds.size() &gt; 0)">
left outer join ${prefix}ACT_RE_PROCDEF DEPLOY_P_OR${orIndex} ON RES.PROC_DEF_ID_ = DEPLOY_P_OR${orIndex}.ID_
</if>
<if test="orQueryObject.cmmnDeploymentId != null || (orQueryObject.cmmnDeploymentIds != null &amp;&amp; orQueryObject.cmmnDeploymentId.size() &gt; 0)">
left outer join ${prefix}ACT_CMMN_CASEDEF DEPLOY_C_OR${orIndex} ON RES.SCOPE_DEFINITION_ID_ = DEPLOY_C_OR${orIndex}.ID_
</if>
<if test="orQueryObject.queryVariableValues.size() &gt; 0">
<if test="orQueryObject.hasLocalQueryVariableValue()">
left outer join ${prefix}ACT_HI_VARINST A_L_OR${orIndex} on RES.ID_ = A_L_OR${orIndex}.TASK_ID_
......@@ -584,16 +590,42 @@
#{processCategory}
</foreach>
</if>
<if test="deploymentId != null">
<if test="deploymentId != null &amp;&amp; cmmnDeploymentId == null">
and DEPLOY_P.DEPLOYMENT_ID_ = #{deploymentId}
</if>
<if test="deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0">
<if test="deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0 &amp;&amp; cmmnDeploymentIds == null">
and DEPLOY_P.DEPLOYMENT_ID_ IN
<foreach item="deployment" index="index" collection="deploymentIds"
open="(" separator="," close=")">
#{deployment}
</foreach>
</if>
<if test="cmmnDeploymentId != null &amp;&amp; deploymentId == null">
and DEPLOY_C.DEPLOYMENT_ID_ = #{cmmnDeploymentId}
</if>
<if test="cmmnDeploymentIds != null &amp;&amp; cmmnDeploymentIds.size() &gt; 0 &amp;&amp; deploymentIds == null">
and DEPLOY_C.DEPLOYMENT_ID_ IN
<foreach item="deployment" index="index" collection="cmmnDeploymentIds"
open="(" separator="," close=")">
#{deployment}
</foreach>
</if>
<if test="deploymentId != null &amp;&amp; cmmnDeploymentId != null">
and (DEPLOY_P.DEPLOYMENT_ID_ = #{deploymentId} or DEPLOY_C.DEPLOYMENT_ID = #{cmmnDeploymentId})
</if>
<if test="cmmnDeploymentIds != null &amp;&amp; cmmnDeploymentIds.size() &gt; 0 &amp;&amp; deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0">
and (
DEPLOY_P.DEPLOYMENT_ID_ IN
<foreach item="deployment" index="index" collection="deploymentIds" open="(" separator="," close=")">
#{deployment}
</foreach>
or
DEPLOY_C.DEPLOYMENT_ID_ IN
<foreach item="cmmnDeployment" index="index" collection="cmmnDeploymentIds" open="(" separator="," close=")">
#{cmmnDeployment}
</foreach>
)
</if>
<if test="processInstanceId != null">
and RES.PROC_INST_ID_ = #{processInstanceId}
</if>
......@@ -908,6 +940,16 @@
#{deployment}
</foreach>
</if>
<if test="orQueryObject.cmmnDeploymentId != null">
or DEPLOY_C_OR${orIndex}.DEPLOYMENT_ID_ = #{orQueryObject.cmmnDeploymentId}
</if>
<if test="orQueryObject.cmmnDeploymentIds != null &amp;&amp; orQueryObject.cmmnDeploymentIds.size() &gt; 0">
or DEPLOY_C_OR${orIndex}.DEPLOYMENT_ID_ IN
<foreach item="deployment" index="index" collection="orQueryObject.cmmnDeploymentIds"
open="(" separator="," close=")">
#{deployment}
</foreach>
</if>
<if test="orQueryObject.processInstanceId != null">
or RES.PROC_INST_ID_ = #{orQueryObject.processInstanceId}
</if>
......
......@@ -370,6 +370,12 @@
where T.SUB_SCOPE_ID_ = #{parameter.subScopeId, jdbcType=VARCHAR} and T.SCOPE_TYPE_ = #{parameter.scopeType, jdbcType=VARCHAR}
</select>
<select id="selectTasksByScopeIdAndScopeType" parameterType="org.flowable.engine.common.impl.db.ListQueryParameterObject" resultMap="taskResultMap">
select T.*
from ${prefix}ACT_RU_TASK T
where T.SCOPE_ID_ = #{parameter.scopeId, jdbcType=VARCHAR} and T.SCOPE_TYPE_ = #{parameter.scopeType, jdbcType=VARCHAR}
</select>
<!-- Using distinct here because a task can appear multiple times in a resultset when -->
<select id="selectTaskByQueryCriteria" parameterType="org.flowable.task.service.impl.TaskQueryImpl" resultMap="taskResultMap">
<if test="firstResult != null and firstResult &gt;= 0">${limitBefore}</if>
......@@ -530,6 +536,9 @@
<if test="orQueryObject.deploymentId != null || (orQueryObject.deploymentIds != null &amp;&amp; orQueryObject.deploymentIds.size() &gt; 0)">
left outer join ${prefix}ACT_RE_PROCDEF DEPLOY_P_OR${orIndex} ON RES.PROC_DEF_ID_ = DEPLOY_P_OR${orIndex}.ID_
</if>
<if test="orQueryObject.cmmnDeploymentId != null || (orQueryObject.cmmnDeploymentIds != null &amp;&amp; orQueryObject.cmmnDeploymentId.size() &gt; 0)">
left outer join ${prefix}ACT_CMMN_CASEDEF DEPLOY_C_OR${orIndex} ON RES.SCOPE_DEFINITION_ID_ = DEPLOY_C_OR${orIndex}.ID_
</if>
</foreach>
<if test="processDefinitionKey != null || processDefinitionKeyLike != null || processDefinitionKeyLikeIgnoreCase != null || processDefinitionName != null || processDefinitionNameLike != null || (processCategoryInList != null &amp;&amp; processCategoryInList.size() &gt; 0) || (processCategoryNotInList != null &amp;&amp; processCategoryNotInList.size() &gt; 0) || (processDefinitionKeys != null &amp;&amp; processDefinitionKeys.size() &gt; 0)">
......@@ -541,6 +550,9 @@
<if test="deploymentId != null || (deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0)">
left outer join ${prefix}ACT_RE_PROCDEF DEPLOY_P ON RES.PROC_DEF_ID_ = DEPLOY_P.ID_
</if>
<if test="cmmnDeploymentId != null || (cmmnDeploymentIds != null &amp;&amp; cmmnDeploymentIds.size() &gt; 0)">
left outer join ${prefix}ACT_CMMN_CASEDEF DEPLOY_C ON RES.SCOPE_DEFINITION_ID_ = DEPLOY_C.ID_
</if>
<where>
<if test="taskId != null">
RES.ID_ = #{taskId}
......@@ -707,16 +719,42 @@
#{processCategory}
</foreach>
</if>
<if test="deploymentId != null">
<if test="deploymentId != null &amp;&amp; cmmnDeploymentId == null">
and DEPLOY_P.DEPLOYMENT_ID_ = #{deploymentId}
</if>
<if test="deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0">
<if test="deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0 &amp;&amp; cmmnDeploymentIds == null">
and DEPLOY_P.DEPLOYMENT_ID_ IN
<foreach item="deployment" index="index" collection="deploymentIds"
open="(" separator="," close=")">
#{deployment}
</foreach>
</if>
<if test="cmmnDeploymentId != null &amp;&amp; deploymentId == null">
and DEPLOY_C.DEPLOYMENT_ID_ = #{cmmnDeploymentId}
</if>
<if test="cmmnDeploymentIds != null &amp;&amp; cmmnDeploymentIds.size() &gt; 0 &amp;&amp; deploymentIds == null">
and DEPLOY_C.DEPLOYMENT_ID_ IN
<foreach item="deployment" index="index" collection="cmmnDeploymentIds"
open="(" separator="," close=")">
#{deployment}
</foreach>
</if>
<if test="deploymentId != null &amp;&amp; cmmnDeploymentId != null">
and (DEPLOY_P.DEPLOYMENT_ID_ = #{deploymentId} or DEPLOY_C.DEPLOYMENT_ID = #{cmmnDeploymentId})
</if>
<if test="cmmnDeploymentIds != null &amp;&amp; cmmnDeploymentIds.size() &gt; 0 &amp;&amp; deploymentIds != null &amp;&amp; deploymentIds.size() &gt; 0">
and (
DEPLOY_P.DEPLOYMENT_ID_ IN
<foreach item="deployment" index="index" collection="deploymentIds" open="(" separator="," close=")">
#{deployment}
</foreach>
or
DEPLOY_C.DEPLOYMENT_ID_ IN
<foreach item="cmmnDeployment" index="index" collection="cmmnDeploymentIds" open="(" separator="," close=")">
#{cmmnDeployment}
</foreach>
)
</if>
<if test="dueDate != null">
and RES.DUE_DATE_ = #{dueDate}
</if>
......@@ -1053,6 +1091,16 @@
#{deployment}
</foreach>
</if>
<if test="orQueryObject.cmmnDeploymentId != null">
or DEPLOY_C_OR${orIndex}.DEPLOYMENT_ID_ = #{orQueryObject.cmmnDeploymentId}
</if>
<if test="orQueryObject.cmmnDeploymentIds != null &amp;&amp; orQueryObject.cmmnDeploymentIds.size() &gt; 0">
or DEPLOY_C_OR${orIndex}.DEPLOYMENT_ID_ IN
<foreach item="deployment" index="index" collection="orQueryObject.cmmnDeploymentIds"
open="(" separator="," close=")">
#{deployment}
</foreach>
</if>
<if test="orQueryObject.dueDate != null">
or RES.DUE_DATE_ = #{orQueryObject.dueDate}
</if>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册