update 调整工作流任务,流程定义等查询

This commit is contained in:
songgaoshuai 2024-11-19 13:42:02 +08:00
parent 22db22db48
commit 8b0871f718
4 changed files with 28 additions and 24 deletions

View File

@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.constant.SystemConstants;
import org.dromara.common.core.enums.BusinessStatusEnum;
import org.dromara.common.core.utils.StreamUtils;
import org.dromara.common.core.utils.StringUtils;
@ -38,7 +37,6 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -70,7 +68,6 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
public TableDataInfo<FlowInstanceVo> getPageByRunning(Instance instance, PageQuery pageQuery) {
QueryWrapper<FlowInstanceBo> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("t.flow_status", BusinessStatusEnum.WAITING.getStatus());
queryWrapper.eq("t.del_flag", SystemConstants.NORMAL);
Page<FlowInstanceVo> page = flwInstanceMapper.page(pageQuery.build(), queryWrapper);
TableDataInfo<FlowInstanceVo> build = TableDataInfo.build();
build.setRows(BeanUtil.copyToList(page.getRecords(), FlowInstanceVo.class));

View File

@ -6,8 +6,15 @@
<select id="page" resultType="org.dromara.warm.flow.orm.entity.FlowDefinition">
select *
from (select a.* from flow_definition a
inner join (select flow_code,max(version) version from flow_definition group by flow_code) b
on (a.flow_code = b.flow_code and a.version = b.version)) t
join (
select flow_code,
coalesce(
max(case when is_publish = 1 then version end),
max(version)
) as version
from flow_definition group by flow_code
) b
on (a.flow_code = b.flow_code and a.version = b.version) where a.del_flag = '0') t
${ew.getCustomSqlSegment}
</select>

View File

@ -23,8 +23,7 @@
<result property="ext" column="ext"/>
</resultMap>
<select id="page" resultMap="FlowInstanceResult">
select *
from (SELECT a.id,
select * from (select a.id,
a.create_time,
a.update_time,
a.tenant_id,
@ -42,8 +41,8 @@
b.flow_name,
b.flow_code,
b.version
FROM flow_instance a
LEFT JOIN flow_definition b ON a.definition_id = b.id) t
from flow_instance a
left join flow_definition b on a.definition_id = b.id where a.del_flag = '0') t
${ew.getCustomSqlSegment}
</select>

View File

@ -45,10 +45,11 @@
<result property="flowName" column="flow_name"/>
<result property="flowCode" column="flow_code"/>
<result property="delFlag" column="del_flag"/>
<result property="formPath" column="form_path"/>
</resultMap>
<select id="getTaskWaitByPage" resultMap="FlowTaskResult">
select*from (
SELECT
select
distinct t.id,
t.node_code,
t.node_name,
@ -66,10 +67,10 @@
d.form_path,
uu.processed_by,
uu.type
FROM flow_task AS t
LEFT JOIN flow_user uu ON uu.associated = t.id
LEFT JOIN flow_definition d on t.definition_id = d.id
LEFT JOIN flow_instance i on t.instance_id = i.id where t.node_type = 1 and t.del_flag = '0' and uu.del_flag = '0') t
from flow_task as t
left join flow_user uu on uu.associated = t.id
left join flow_definition d on t.definition_id = d.id
left join flow_instance i on t.instance_id = i.id where t.node_type = 1 and t.del_flag = '0' and uu.del_flag = '0') t
${ew.getCustomSqlSegment}
</select>
@ -94,19 +95,19 @@
a.update_time,
a.tenant_id,
b.business_id,
c.form_path fromPath,
c.form_path,
c.flow_name,
c.flow_code
from flow_his_task a
LEFT JOIN flow_instance b on a.instance_id = b.id
LEFT JOIN flow_definition c on a.definition_id = c.id where
a.del_flag ='0' and b.del_flag = '0' and c.del_flag = '0' and a.node_type not in ('0')
left join flow_instance b on a.instance_id = b.id
left join flow_definition c on a.definition_id = c.id where
a.del_flag ='0' and b.del_flag = '0' and c.del_flag = '0' and a.node_type in ('1','3','4')
) t ${ew.getCustomSqlSegment}
</select>
<select id="getTaskCopyByPage" resultMap="FlowTaskResult">
select * from (
SELECT
select
b.id ,
b.flow_status,
b.business_id,
@ -115,11 +116,11 @@
b.node_code,
d.flow_name,
d.flow_code
FROM
`flow_user` a
LEFT JOIN flow_instance b ON a.associated = b.id
LEFT JOIN flow_definition d on b.definition_id=d.id
WHERE
from
flow_user a
left join flow_instance b on a.associated = b.id
left join flow_definition d on b.definition_id=d.id
where
a.type = 4 and a.del_flag = '0' and b.del_flag = '0'
) t ${ew.getCustomSqlSegment}
</select>