SELECT * FROM
vw_flow_all fa
and fa.taskName like concat('%', #{taskName}, '%')
and fa.procDefName like concat('%', #{procDefName}, '%')
and fa.procDefKey = #{procDefKey}
and fa.businessKey = #{businessKey}
and fa.startDeptName like concat('%', #{startDeptName}, '%')
and fa.startUserName like concat('%', #{startUserName}, '%')
and fa.businessKeyName like concat('%', #{businessKeyName}, '%')
and fa.category = #{category}
and fa.createTime between #{params.beginDate} and #{params.endDate}
and fa.businessDeptId = #{projectDeptId}
and fa.businessDeptId = #{nowDept}
and fa.businessKey in (select DISTINCT projectId from sur_project_unit_info where unitId=#{nowDept} and del_flag=0)
and fa.startUserId = #{nowUser}
and fa.finishTime is null
and fa.finishTime is not null
order by fa.createTime desc
select vf.* as startUserPhone from vw_flow_all vf
where vf.procInsId = #{procInsId}
select hv.NAME_ as `name`,hv.TEXT_ as text from act_hi_varinst hv where hv.PROC_INST_ID_ = #{procInstId}
select fa.* from vw_flow_await fa
where
1=1
and fa.procDefName like concat('%', #{procDefName}, '%')
and fa.businessKey = #{businessKey}
and fa.businessKeyName like concat('%', #{businessKeyName}, '%')
and fa.category = #{category}
and fa.createTime between #{params.beginDate} and #{params.endDate}
and fa.businessDeptId = #{projectDeptId}
and fa.businessDeptId = #{nowDept}
and fa.businessKey in (select DISTINCT projectId from sur_project_unit_info where unitId=#{nowDept} and del_flag=0)
and fa.businessKey in (select DISTINCT project_id from sur_project_userinfo where user_id=#{nowUser} and is_del=0)
AND (fa.ASSIGNEE_ = #{nowUser}
OR (
fa.ASSIGNEE_ IS NULL
AND (
fa.USER_ID_ = #{nowUser}
OR (
fa.GROUP_ID_ IN
#{roleId}
)
)
)
)
order by fa.createTime desc
select fa.category,count(1) as total from vw_flow_await fa
where
1=1
and fa.procDefName like concat('%', #{procDefName}, '%')
and fa.businessKey = #{businessKey}
and fa.businessKeyName like concat('%', #{businessKeyName}, '%')
and fa.createTime between #{params.beginDate} and #{params.endDate}
and fa.businessDeptId = #{projectDeptId}
and fa.businessDeptId = #{nowDept}
and fa.businessKey in (select DISTINCT projectId from sur_project_unit_info where unitId=#{nowDept} and del_flag=0)
and fa.businessKey in (select DISTINCT project_id from sur_project_userinfo where user_id=#{nowUser} and is_del=0)
AND (fa.ASSIGNEE_ = #{nowUser}
OR (
fa.ASSIGNEE_ IS NULL
AND (
fa.USER_ID_ = #{nowUser}
OR (
fa.GROUP_ID_ IN
#{roleId}
)
)
)
)
group by fa.category
select fa.* from vw_flow_finished fa
where
fa.ASSIGNEE_=#{nowUser}
and fa.procDefName like concat('%', #{procDefName}, '%')
and fa.businessKey = #{businessKey}
and fa.businessKeyName like concat('%', #{businessKeyName}, '%')
and fa.category = #{category}
and fa.endTime between #{params.beginDate} and #{params.endDate}
order by fa.endTime desc
SELECT a.dict_label taskName,b.cnt assigneeId,c.cnt procDefVersion FROM
( SELECT * FROM sys_dict_data WHERE dict_type = 'sys_process_category') a
LEFT JOIN (SELECT category,COUNT(1) cnt FROM vw_flow_all WHERE finishTime IS NOT NULL
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
GROUP BY category) b ON a.dict_value=b.category
LEFT JOIN (SELECT category,COUNT(1) cnt FROM vw_flow_all WHERE finishTime IS NULL and taskName!='提交申请'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
GROUP BY category) c ON a.dict_value=c.category
SELECT cat taskName, COUNT(1) assigneeId FROM (
SELECT *,'总包单位' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '总包%'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'监理单位' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '监理%'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'设计单位' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '设计%'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'甲方代表' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '甲方%'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'子公司' cat FROM vw_flow_all WHERE finishTime IS NULL AND taskName LIKE '工程%'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
) a
GROUP BY cat
SELECT cat taskName, COUNT(1) assigneeId FROM (
SELECT *,'总包单位' cat FROM vw_flow_all WHERE taskName LIKE '总包%' AND taskName!='提交申请' and finishTime IS not NULL
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'监理单位' cat FROM vw_flow_all WHERE taskName LIKE '监理%' AND taskName!='提交申请' and finishTime IS not NULL
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'设计单位' cat FROM vw_flow_all WHERE taskName LIKE '设计%' AND taskName!='提交申请' and finishTime IS not NULL
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'甲方代表' cat FROM vw_flow_all WHERE taskName LIKE '甲方%' AND taskName!='提交申请' and finishTime IS not NULL
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'子公司' cat FROM vw_flow_all WHERE taskName LIKE '工程%' AND taskName!='提交申请' and finishTime IS not NULL
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
) a
GROUP BY cat
SELECT cat taskName, COUNT(1) assigneeId FROM (
SELECT *,'总包单位' cat FROM vw_flow_all WHERE taskName LIKE '总包%' AND taskName!='提交申请'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'监理单位' cat FROM vw_flow_all WHERE taskName LIKE '监理%' AND taskName!='提交申请'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'设计单位' cat FROM vw_flow_all WHERE taskName LIKE '设计%' AND taskName!='提交申请'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'甲方代表' cat FROM vw_flow_all WHERE taskName LIKE '甲方%' AND taskName!='提交申请'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
UNION
SELECT *,'子公司' cat FROM vw_flow_all WHERE taskName LIKE '工程%' AND taskName!='提交申请'
and businessDeptId=#{projectDeptId}
and businessKey=#{businessKey}
and businessType = #{proType}
and businessKey in
#{item}
) a
GROUP BY cat
SELECT * FROM vw_flow_all
and category = #{category}
and businessDeptId=#{deptId}
and businessType = #{proType}
and businessKey=#{projectId}
and businessKey in
#{item}
SELECT * FROM vw_flow_all WHERE finishTime IS NULL
AND taskName LIKE '总包%'
AND taskName LIKE '监理%'
AND taskName LIKE '设计%'
AND taskName LIKE '甲方%'
AND taskName LIKE '工程%'
and businessDeptId=#{deptId}
and businessType = #{proType}
and businessKey=#{projectId}
and businessKey in
#{item}
SELECT * FROM vw_flow_all
AND taskName!='提交申请'
AND finishTime IS NULL AND taskName!='提交申请'
AND finishTime IS NOT NULL
and businessDeptId=#{deptId}
and businessKey=#{projectId}
and businessType = #{proType}
and businessKey in
#{item}
SELECT a.businessKey,a.cnt duration ,b.projectName businessKeyName FROM (
SELECT businessKey,COUNT(1) cnt FROM vw_flow_all WHERE taskName!='提交申请'
and businessDeptId=#{deptId}
and businessType = #{proType}
GROUP BY businessKey ) a,sur_project b WHERE a.businessKey=b.id
ORDER BY a.cnt DESC
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
and fa.businessType = #{proType}
and fa.procDefKey = #{procDefKey}
and fa.businessKey = #{businessKey}
and fa.businessDeptId = #{projectDeptId}
order by fa.createTime desc
select * from sur_project where id = #{proId}
select x.dict_label taskName,y.taskId from (
select dict_value,dict_label
from sys_dict_data where dict_type='flow_sub_dept_type'
) x left join (
SELECT d.dict_value, d.dict_label,count(1) taskId FROM
vw_flow_all a
LEFT JOIN act_hi_varinst b ON a.procInsId=b.PROC_INST_ID_ AND b.NAME_='subDeptType'
LEFT JOIN act_hi_varinst c ON a.procInsId=c.PROC_INST_ID_ AND c.NAME_='subDeptName'
LEFT JOIN sys_dict_data D ON b.TEXT_=d.dict_value and d.dict_type='flow_sub_dept_type'
left join sur_project sp on a.businesskey=sp.id
where a.procDefKey='flow_fbzzsp_fbszzsp'
AND (A.finishTime is null OR (A.finishTime is not null and A.taskComType =1))
and sp.progressVisible=0 and sp.isDel=0
and a.businessDeptId=#{deptId}
and a.businessKey=#{projectId}
and a.businessKey in
#{item}
and sp.projectType = #{proType}
group by d.dict_value,d.dict_label
) y on x.dict_value=y.dict_value
SELECT a.procInsId,a.deployId,a.createTime,a.finishTime,a.businessKey,a.businessKeyName,a.startDeptName,b.TEXT_ as taskId, c.TEXT_ as deptName,d.dict_label taskName FROM
vw_flow_all a
LEFT JOIN act_hi_varinst b ON a.procInsId=b.PROC_INST_ID_ AND b.NAME_='subDeptType'
LEFT JOIN act_hi_varinst c ON a.procInsId=c.PROC_INST_ID_ AND c.NAME_='subDeptName'
LEFT JOIN sys_dict_data D ON b.TEXT_=d.dict_value and d.dict_type='flow_sub_dept_type'
left join sur_project sp on a.businesskey=sp.id
where a.procDefKey='flow_fbzzsp_fbszzsp'
AND (A.finishTime is null OR (A.finishTime is not null and A.taskComType =1))
and sp.progressVisible=0 and sp.isDel=0
and a.businessDeptId=#{deptId}
and a.businessKey=#{projectId}
and a.businessKey in
#{item}
and sp.projectType = #{proType}
SELECT
rp.id_ as id,
rp.deployment_id_ as deploymentId,
rd.name_ as name,
rd.category_ as category,
rp.key_ as flowKey,
rp.version_ as version,
rp.suspension_state_ as suspensionState,
rd.deploy_time_ as deploymentTime,
rpd.DEPT_ID_ as deptId,
sd.dept_name as deptName,
rpd.PROJ_ID_ as projectId,
spi.project_name as projectName
FROM
act_re_procdef rp
LEFT JOIN act_re_deployment rd ON rp.deployment_id_ = rd.id_
left join act_re_procdef_dept rpd on rp.id_ = rpd.PROCDEF_ID_
left join sys_dept sd on sd.dept_id = rpd.DEPT_ID_
left join pro_project_info spi on spi.id = rpd.PROJ_ID_
rp.SUSPENSION_STATE_ = 1
and rpd.DEPT_ID_ = #{deptId}
and sd.dept_name like concat('%', #{deptName}, '%')
and rpd.PROJ_ID_ = #{projectId}
and spi.project_name like concat('%', #{projectName}, '%')
and rd.name_ like concat('%', #{name}, '%')
and rd.category_ = #{category}
and rd.key_ = #{flowKey}
order by rpd.SORT_
SELECT * FROM (
SELECT
rp.id_ as id,
rp.deployment_id_ as deploymentId,
rd.name_ as name,
rd.category_ as category,
sdd.dict_label as categoryName,
rp.key_ as flowKey,
rp.version_ as version,
rp.suspension_state_ as suspensionState,
rd.deploy_time_ as deploymentTime,
ROW_NUMBER () OVER (
PARTITION BY rp.key_
ORDER BY
rp.version_ DESC
) AS rn
FROM
act_re_procdef rp
LEFT JOIN act_re_deployment rd ON rp.deployment_id_ = rd.id_
left join sys_dict_data sdd on sdd.dict_type='sys_process_category' and sdd.dict_value = rd.category_
left join act_re_procdef_role rpr on rp.key_ = rpr.PROCDEF_KEY_
left join sys_user_role sur on sur.role_id = rpr.ROLE_ID_
left join sys_user su on su.user_id = sur.user_id
rp.SUSPENSION_STATE_ = 1 and su.user_name = #{username}
and rd.name_ like concat('%', #{name}, '%')
and rd.category_ = #{category}
order by rd.deploy_time_ desc
) v WHERE v.rn = 1
delete from act_re_procdef_role where ROLE_ID_ = #{roleId}
insert into act_re_procdef_role( PROCDEF_KEY_, ROLE_ID_) values
( #{item.key}, #{item.roleId})
update act_re_procdef_role set SORT_=#{sort} where PROCDEF_KEY_=#{key} and ROLE_ID_=#{roleId}
insert into act_re_procdef_dept
PROCDEF_ID_,
TYPE_,
DEPT_ID_,
PROJ_ID_,
SORT_,
#{procdefId},
#{prtype},
#{deptId},
#{projId},
#{sort},