jhprjv2/ruoyi-system/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml

506 lines
28 KiB
XML
Raw Normal View History

2023-09-09 01:36:45 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.FlowBusinessKeyMapper">
2024-03-17 16:59:49 +08:00
<!-- fa.procInsId,-->
<!-- fa.deployId,-->
<!-- fa.createTime,-->
<!-- fa.finishTime,-->
<!-- fa.duration,-->
<!-- fa.procDefKey,-->
<!-- fa.procDefName,-->
<!-- fa.procDefVersion,-->
<!-- fa.category,-->
<!-- fa.businessKey,-->
<!-- fa.businessDeptId,-->
<!-- fa.businessKeyName,-->
<!-- fa.startUserId,-->
<!-- fa.startUserName,-->
<!-- fa.startDeptName,-->
<!-- fa.taskId,-->
<!-- fa.taskName,-->
<!-- fa.assigneeId,-->
<!-- fa.assigneeName,-->
<!-- fa.assigneeDeptName-->
2024-04-05 19:25:29 +08:00
<select id="selectAllFlowTaskByParams" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
2024-03-17 16:59:49 +08:00
SELECT * FROM
2023-09-09 01:36:45 +08:00
vw_flow_all fa
<where>
2023-09-12 01:52:22 +08:00
<if test="taskName != null and taskName != ''"> and fa.taskName like concat('%', #{taskName}, '%')</if>
2023-09-09 01:36:45 +08:00
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
2023-09-09 23:00:24 +08:00
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
2023-09-10 21:58:04 +08:00
<if test="startDeptName != null and startDeptName != ''"> and fa.startDeptName like concat('%', #{startDeptName}, '%')</if>
<if test="startUserName != null and startUserName != ''"> and fa.startUserName like concat('%', #{startUserName}, '%')</if>
2023-09-09 01:36:45 +08:00
<if test="businessKeyName != null and businessKeyName != ''"> and fa.businessKeyName like concat('%', #{businessKeyName}, '%')</if>
<if test="category != null and category != ''"> and fa.category = #{category}</if>
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and fa.createTime between #{params.beginDate} and #{params.endDate}</if>
<!-- 查询条件-项目部门 -->
2023-09-12 01:52:22 +08:00
<if test="projectDeptId != null "> and fa.businessDeptId = #{projectDeptId}</if>
2023-09-09 01:36:45 +08:00
<!--子部门数据-->
2023-09-12 01:52:22 +08:00
<if test='nowRole == "4"'> and fa.businessDeptId = #{nowDept}</if>
2023-09-09 01:36:45 +08:00
<!--监理单位/总包公司/分包单位查询当前关联数据-->
2023-09-09 22:33:35 +08:00
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fa.businessKey in (select DISTINCT projectId from sur_project_unit_info where unitId=#{nowDept} and del_flag=0)</if>
2023-09-09 01:36:45 +08:00
<!--普通用户查询项目人员-->
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> and fa.startUserId = #{nowUser}</if>
<if test='activeName == "await"'> and fa.finishTime is null</if>
<if test='activeName == "finished"'> and fa.finishTime is not null</if>
</where>
order by fa.createTime desc
</select>
2024-04-05 19:25:29 +08:00
<!--查询工作流任务-->
<select id="findFlowTaskByProcInsId" parameterType="string" resultType="com.ruoyi.system.domain.FlowTaskEntity">
select vf.* as startUserPhone from vw_flow_all vf
where vf.procInsId = #{procInsId}
</select>
2023-09-09 22:33:35 +08:00
<!--查询工作流操作日志-->
<select id="selectCommentByProcInsId" parameterType="string" resultType="map">
select * from vw_flow_comment where procInstId = #{procInstId} order by startTime DESC
</select>
<!--查询工作流携带的参数-->
<select id="selectFormDatasByProcInsId" parameterType="string" resultType="map">
select hv.NAME_ as `name`,hv.TEXT_ as text from act_hi_varinst hv where hv.PROC_INST_ID_ = #{procInstId}
</select>
<!--查询我的代办任务-->
<select id="selectMyAwaitFlowTask" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="map">
select fa.* from vw_flow_await fa
where
1=1
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
2023-09-17 02:06:22 +08:00
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
2023-09-09 22:33:35 +08:00
<if test="businessKeyName != null and businessKeyName != ''"> and fa.businessKeyName like concat('%', #{businessKeyName}, '%')</if>
<if test="category != null and category != ''"> and fa.category = #{category}</if>
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and fa.createTime between #{params.beginDate} and #{params.endDate}</if>
<!-- 查询条件-项目部门 -->
2023-09-12 01:52:22 +08:00
<if test="projectDeptId != null "> and fa.businessDeptId = #{projectDeptId}</if>
2023-09-09 22:33:35 +08:00
<!--子部门数据-->
2023-09-12 01:52:22 +08:00
<if test='nowRole == "4"'> and fa.businessDeptId = #{nowDept}</if>
2023-09-09 22:33:35 +08:00
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fa.businessKey in (select DISTINCT projectId from sur_project_unit_info where unitId=#{nowDept} and del_flag=0)</if>
<!--普通用户查询项目人员-->
2023-09-10 18:30:35 +08:00
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> and fa.businessKey in (select DISTINCT project_id from sur_project_userinfo where user_id=#{nowUser} and is_del=0)</if>
2023-09-09 22:33:35 +08:00
AND (fa.ASSIGNEE_ = #{nowUser}
OR (
fa.ASSIGNEE_ IS NULL
AND (
fa.USER_ID_ = #{nowUser}
OR (
fa.GROUP_ID_ IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
)
)
)
)
order by fa.createTime desc
</select>
2024-03-17 16:59:49 +08:00
<!--根据条件查询我的代办分组数量统计-->
<select id="findAwaitCountGroupByCategory" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="map">
select fa.category,count(1) as total from vw_flow_await fa
where
1=1
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
<if test="businessKeyName != null and businessKeyName != ''"> and fa.businessKeyName like concat('%', #{businessKeyName}, '%')</if>
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and fa.createTime between #{params.beginDate} and #{params.endDate}</if>
<!-- 查询条件-项目部门 -->
<if test="projectDeptId != null "> and fa.businessDeptId = #{projectDeptId}</if>
<!--子部门数据-->
<if test='nowRole == "4"'> and fa.businessDeptId = #{nowDept}</if>
<!--监理单位/总包公司/分包单位查询当前关联数据-->
<if test='nowRole == "5" or nowRole == "6" or nowRole == "7"'> and fa.businessKey in (select DISTINCT projectId from sur_project_unit_info where unitId=#{nowDept} and del_flag=0)</if>
<!--普通用户查询项目人员-->
<if test='nowRole == "15" or nowRole == "16" or nowRole == "17" or nowRole == "99"'> and fa.businessKey in (select DISTINCT project_id from sur_project_userinfo where user_id=#{nowUser} and is_del=0)</if>
AND (fa.ASSIGNEE_ = #{nowUser}
OR (
fa.ASSIGNEE_ IS NULL
AND (
fa.USER_ID_ = #{nowUser}
OR (
fa.GROUP_ID_ IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
)
)
)
)
group by fa.category
</select>
2023-09-09 22:33:35 +08:00
<!--查询我的已办任务-->
<select id="selectMyFinishedFlowTask" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="map">
select fa.* from vw_flow_finished fa
where
fa.ASSIGNEE_=#{nowUser}
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
<if test="businessKeyName != null and businessKeyName != ''"> and fa.businessKeyName like concat('%', #{businessKeyName}, '%')</if>
<if test="category != null and category != ''"> and fa.category = #{category}</if>
<if test="params.beginDate != null and params.beginDate != '' and params.endDate != null and params.endDate != ''"> and fa.endTime between #{params.beginDate} and #{params.endDate}</if>
order by fa.endTime desc
</select>
2023-12-13 02:35:55 +08:00
2023-09-22 00:32:08 +08:00
<select id="groupByCategory" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT a.dict_label taskName,b.cnt assigneeId,c.cnt procDefVersion FROM
( SELECT * FROM sys_dict_data WHERE dict_type = 'sys_process_category') a
2024-04-06 22:51:28 +08:00
LEFT JOIN (SELECT category,COUNT(1) cnt FROM vw_flow_all WHERE finishTime IS NOT NULL and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-09-22 00:32:08 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
GROUP BY category) b ON a.dict_value=b.category
2024-04-06 22:51:28 +08:00
LEFT JOIN (SELECT category,COUNT(1) cnt FROM vw_flow_all WHERE finishTime IS NULL and businessVisible=0 and taskName!='提交申请'
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-09-22 00:32:08 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
GROUP BY category) c ON a.dict_value=c.category
2023-09-22 00:32:08 +08:00
</select>
2024-04-06 01:31:05 +08:00
2023-09-22 00:32:08 +08:00
<select id="groupByUnit" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT cat taskName, COUNT(1) assigneeId FROM (
2024-04-06 22:51:28 +08:00
SELECT *,'总包单位' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '总包%' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-09-22 00:32:08 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
2023-09-22 00:32:08 +08:00
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'监理单位' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '监理%' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-09-22 00:32:08 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
2023-09-22 00:32:08 +08:00
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'设计单位' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '设计%' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-09-22 00:32:08 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
2023-09-22 00:32:08 +08:00
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'甲方代表' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '甲方%' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-09-22 00:32:08 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
2023-09-22 00:32:08 +08:00
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'子公司' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '工程%' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-09-22 00:32:08 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
2023-09-24 18:35:52 +08:00
) a
2023-09-22 00:32:08 +08:00
GROUP BY cat
</select>
2024-04-06 01:31:05 +08:00
2023-10-22 23:45:32 +08:00
<select id="groupByUnitFinish" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT cat taskName, COUNT(1) assigneeId FROM (
2024-04-06 22:51:28 +08:00
SELECT *,'总包单位' cat FROM vw_flow_all WHERE taskName LIKE '总包%' AND taskName!='提交申请' and finishTime IS not NULL and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'监理单位' cat FROM vw_flow_all WHERE taskName LIKE '监理%' AND taskName!='提交申请' and finishTime IS not NULL and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'设计单位' cat FROM vw_flow_all WHERE taskName LIKE '设计%' AND taskName!='提交申请' and finishTime IS not NULL and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'甲方代表' cat FROM vw_flow_all WHERE taskName LIKE '甲方%' AND taskName!='提交申请' and finishTime IS not NULL and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'子公司' cat FROM vw_flow_all WHERE taskName LIKE '工程%' AND taskName!='提交申请' and finishTime IS not NULL and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) a
GROUP BY cat
</select>
2024-04-06 01:31:05 +08:00
2023-10-22 23:45:32 +08:00
<select id="groupByUnitTotal" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT cat taskName, COUNT(1) assigneeId FROM (
2024-04-06 22:51:28 +08:00
SELECT *,'总包单位' cat FROM vw_flow_all WHERE taskName LIKE '总包%' AND taskName!='提交申请' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'监理单位' cat FROM vw_flow_all WHERE taskName LIKE '监理%' AND taskName!='提交申请' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'设计单位' cat FROM vw_flow_all WHERE taskName LIKE '设计%' AND taskName!='提交申请' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'甲方代表' cat FROM vw_flow_all WHERE taskName LIKE '甲方%' AND taskName!='提交申请' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
UNION
2024-04-06 22:51:28 +08:00
SELECT *,'子公司' cat FROM vw_flow_all WHERE taskName LIKE '工程%' AND taskName!='提交申请' and businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="projectDeptId !=null and projectDeptId!=''">and businessDeptId=#{projectDeptId}</if>
2023-10-22 23:45:32 +08:00
<if test="businessKey !=null and businessKey!=''">and businessKey=#{businessKey}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
) a
GROUP BY cat
</select>
2024-04-06 01:31:05 +08:00
<select id="listByCategory" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
2023-12-28 23:34:54 +08:00
SELECT * FROM vw_flow_all
<where>
2024-04-06 22:51:28 +08:00
businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="category != null and category != ''"> and category = #{category}</if>
<if test="deptId !=null and deptId>0">and businessDeptId=#{deptId}</if>
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
<if test="projectId !=null and projectId>0">and businessKey=#{projectId}</if>
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
2023-12-28 23:34:54 +08:00
</where>
</select>
2024-04-06 01:31:05 +08:00
<select id="listByUnit" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
2024-04-06 22:51:28 +08:00
SELECT * FROM vw_flow_all WHERE finishTime IS NULL and businessVisible=0
2023-10-01 19:45:32 +08:00
<if test="taskId!=null">
<if test="taskId==1"> AND taskName LIKE '总包%' </if>
<if test="taskId==2"> AND taskName LIKE '监理%' </if>
<if test="taskId==3"> AND taskName LIKE '设计%' </if>
<if test="taskId==4"> AND taskName LIKE '甲方%' </if>
<if test="taskId==5"> AND taskName LIKE '工程%' </if>
</if>
<if test="deptId !=null and deptId>0">and businessDeptId=#{deptId}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-01 19:45:32 +08:00
<if test="projectId !=null and projectId>0">and businessKey=#{projectId}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
2023-10-01 19:45:32 +08:00
</select>
2024-04-06 01:31:05 +08:00
2023-10-01 19:45:32 +08:00
<select id="listByState" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT * FROM vw_flow_all
<where>
2024-04-06 22:51:28 +08:00
businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="taskId!=null">
<if test="taskId==1"> AND taskName!='提交申请' </if>
<if test="taskId==2"> AND finishTime IS NULL AND taskName!='提交申请' </if>
<if test="taskId==3"> AND finishTime IS NOT NULL </if>
</if>
<if test="deptId !=null and deptId>0">and businessDeptId=#{deptId}</if>
<if test="projectId !=null and projectId>0">and businessKey=#{projectId}</if>
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-11 23:24:45 +08:00
<if test="prjIds !=null and prjIds.size()>0">
and businessKey in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
2023-10-01 19:45:32 +08:00
</where>
</select>
2023-10-22 23:45:32 +08:00
2023-11-10 22:01:29 +08:00
<select id="groupByProject" resultType="com.ruoyi.system.domain.FlowTaskEntity" parameterType="long">
2023-10-22 23:45:32 +08:00
SELECT a.businessKey,a.cnt duration ,b.projectName businessKeyName FROM (
2024-04-06 22:51:28 +08:00
SELECT businessKey,COUNT(1) cnt FROM vw_flow_all WHERE taskName!='提交申请' and businessVisible=0
2023-11-10 22:01:29 +08:00
<if test="deptId !=null and deptId>0">and businessDeptId=#{deptId}</if>
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and businessType = #{proType}</if>
2023-10-22 23:45:32 +08:00
GROUP BY businessKey ) a,sur_project b WHERE a.businessKey=b.id
ORDER BY a.cnt DESC
</select>
2023-12-13 02:35:55 +08:00
<select id="findSafetyWorkList" parameterType="com.ruoyi.system.domain.FlowTaskEntity" resultType="com.ruoyi.system.domain.FlowTaskEntity">
SELECT
fa.procInsId,
fa.deployId,
fa.createTime,
fa.finishTime,
fa.duration,
fa.procDefKey,
fa.procDefName,
fa.procDefVersion,
fa.category,
fa.businessKey,
fa.businessDeptId,
fa.businessKeyName,
fa.startUserId,
fa.startUserName,
fa.startDeptName,
fa.taskId,
fa.taskName,
fa.assigneeId,
fa.assigneeName,
fa.assigneeDeptName
FROM
vw_flow_all fa
<where>
2024-04-06 22:51:28 +08:00
businessVisible=0
2024-04-06 01:31:05 +08:00
<if test="proType != null and proType != ''"> and fa.businessType = #{proType}</if>
2023-12-13 02:35:55 +08:00
<if test="procDefKey != null and procDefKey != ''"> and fa.procDefKey = #{procDefKey}</if>
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
<!-- 查询条件-项目部门 -->
2023-12-25 00:53:30 +08:00
<if test="projectDeptId != null and projectDeptId != ''"> and fa.businessDeptId = #{projectDeptId}</if>
2023-12-13 02:35:55 +08:00
</where>
order by fa.createTime desc
</select>
2024-04-05 19:25:29 +08:00
<select id="selectSurProjectById" parameterType="Long" resultType="Map">
select * from sur_project where id = #{proId}
</select>
<select id="findFlowTaskUsers" resultType="com.ruoyi.common.core.domain.entity.SysUser">
select su.* from sys_user su
left join sur_project_userinfo spu on spu.user_id = su.user_id
left join sys_user_role sur on sur.user_id = su.user_id
where spu.project_id = #{businessKey}
<if test="candidateUsers !=null and candidateUsers.size()>0">
and su.user_id in
<foreach collection="candidateUsers" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="candidateGroups !=null and candidateGroups.size()>0">
and sur.role_id in
<foreach collection="candidateGroups" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="findFlowTaskDeptUsers" resultType="com.ruoyi.common.core.domain.entity.SysUser">
select su.* from sys_user su
left join sys_dept sd on sd.dept_id = su.dept_id
left join sys_user_role sur on sur.user_id = su.user_id
where 1=1
<if test="candidateUsers !=null and candidateUsers.size()>0">
and su.user_id in
<foreach collection="candidateUsers" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
<if test="candidateGroups !=null and candidateGroups.size()>0">
and sur.role_id in
<foreach collection="candidateGroups" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
and EXISTS
(SELECT 1 FROM sur_project sp WHERE sp.id=#{businessKey} and (FIND_IN_SET(sp.deptId,sd.ancestors) or sp.deptId=sd.dept_id));
</select>
2023-09-09 01:36:45 +08:00
</mapper>