YZProjectCloud/yanzhu-common/yanzhu-common-mapper/src/main/resources/mapper/flowable/FlowBusinessKeyMapper.xml

188 lines
13 KiB
XML
Raw Normal View History

2024-08-19 00:41:01 +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.yanzhu.flowable.mapper.FlowBusinessKeyMapper">
2024-08-22 16:28:18 +08:00
<select id="selectAllFlowTaskByParams" parameterType="FlowTaskEntity" resultType="FlowTaskEntity">
2024-12-22 19:55:21 +08:00
SELECT * FROM vw_flow_all fa
2024-08-19 00:41:01 +08:00
<where>
<if test="taskName != null and taskName != ''"> and fa.taskName like concat('%', #{taskName}, '%')</if>
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
<if test="procDefKey != null and procDefKey != ''"> and fa.procDefKey = #{procDefKey}</if>
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
2024-12-22 19:55:21 +08:00
<if test="startUserId != null and startUserId != ''"> and fa.startUserId = #{startUserId}</if>
2024-08-19 00:41:01 +08:00
<if test="startUserName != null and startUserName != ''"> and fa.startUserName like concat('%', #{startUserName}, '%')</if>
2024-12-22 19:55:21 +08:00
<if test="startDeptName != null and startDeptName != ''"> and fa.startDeptName like concat('%', #{startDeptName}, '%')</if>
2024-08-19 00:41:01 +08:00
<if test="category != null and category != ''"> and fa.category = #{category}</if>
2024-12-22 19:55:21 +08:00
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and date(fa.createTime) between #{params.beginTime} and #{params.endTime}</if>
2024-08-19 00:41:01 +08:00
<!-- 查询条件-项目部门 -->
2024-12-22 19:55:21 +08:00
<if test="startComId != null and startComId != ''"> and fa.startComId = #{startComId}</if>
<if test="startComName != null and startComName != ''"> and fa.startComName like concat('%', #{startComName}, '%')</if>
<if test="startProId != null and startProId != ''"> and fa.startProId = #{startProId}</if>
<if test="startProName != null and startProName != ''"> and fa.startProName like concat('%', #{startProName}, '%')</if>
2024-09-09 23:58:23 +08:00
<if test='activeTags == "await"'> and fa.finishTime is null</if>
<if test='activeTags == "finished"'> and fa.finishTime is not null</if>
2024-08-19 00:41:01 +08:00
</where>
order by fa.createTime desc
</select>
<!--查询工作流任务-->
2024-08-22 16:28:18 +08:00
<select id="findFlowTaskByProcInsId" parameterType="string" resultType="FlowTaskEntity">
2024-12-22 19:55:21 +08:00
select * from vw_flow_all where procInsId = #{procInsId}
2024-08-19 00:41:01 +08:00
</select>
<!--查询工作流操作日志-->
2024-12-22 19:55:21 +08:00
<select id="selectCommentByProcInsId" parameterType="string" resultType="Map">
2025-02-05 21:34:18 +08:00
select * from vw_flow_comment where procInstId = #{procInstId} order by commentId DESC
2024-08-19 00:41:01 +08:00
</select>
2024-12-22 19:55:21 +08:00
<select id="selectLastCommentByProcInsId" parameterType="string" resultType="Map">
2025-02-05 21:34:18 +08:00
select * from vw_flow_comment where procInstId = #{procInstId} order by commentId DESC limit 1
2024-08-19 00:41:01 +08:00
</select>
<!--查询工作流携带的参数-->
2024-12-22 19:55:21 +08:00
<select id="selectFormDatasByProcInsId" parameterType="string" resultType="Map">
2024-08-19 00:41:01 +08:00
select hv.NAME_ as `name`,hv.TEXT_ as text from act_hi_varinst hv where hv.PROC_INST_ID_ = #{procInstId}
</select>
<!--查询我的代办任务-->
2024-12-22 19:55:21 +08:00
<select id="selectMyAwaitFlowTask" parameterType="FlowTaskEntity" resultType="Map">
2024-12-29 21:35:34 +08:00
select fa.*
<if test='activeTags == "depts"'>, sud.business_license_path as businessImg, bus.sub_dept_name as businessMk1, sdd.dict_label as businessMk2, sud.sub_dept_code as businessMk3</if>
2025-01-22 00:20:58 +08:00
<if test='activeTags == "users"'>, bus.user_picture as businessImg, bus.card_code as businessMk1, sdd.dict_label as businessMk2, bus.sub_dept_name as businessMk3</if>
2024-12-29 21:35:34 +08:00
from vw_flow_await fa
<if test='activeTags == "depts"'> left join pro_project_info_subdepts_users bus on bus.id = fa.businessKey left join pro_project_info_subdepts sud on sud.id = bus.sub_dept_id left join sys_dict_data sdd on sdd.dict_value = bus.sub_dept_type and sdd.dict_type='sub_dept_type' </if>
2025-01-22 00:20:58 +08:00
<if test='activeTags == "users"'> left join pro_project_info_subdepts_users bus on bus.id = fa.businessKey left join sys_dict_data sdd on sdd.dict_value = bus.craft_post and sdd.dict_type='pro_craft_post'</if>
2024-08-19 00:41:01 +08:00
where
2024-12-22 19:55:21 +08:00
fa.taskName != '申请人提交'
2024-08-19 00:41:01 +08:00
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
2024-12-22 19:55:21 +08:00
<if test="startUserId != null and startUserId != ''"> and fa.startUserId = #{startUserId}</if>
<if test="startUserName != null and startUserName != ''"> and fa.startUserName like concat('%', #{startUserName}, '%')</if>
<if test="startDeptName != null and startDeptName != ''"> and fa.startDeptName like concat('%', #{startDeptName}, '%')</if>
2024-08-19 00:41:01 +08:00
<if test="category != null and category != ''"> and fa.category = #{category}</if>
2024-12-22 19:55:21 +08:00
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and date(fa.createTime) between #{params.beginTime} and #{params.endTime}</if>
2024-08-19 00:41:01 +08:00
<!-- 查询条件-项目部门 -->
2024-12-22 19:55:21 +08:00
<if test="startComId != null and startComId != ''"> and fa.startComId = #{startComId}</if>
<if test="startComName != null and startComName != ''"> and fa.startComName like concat('%', #{startComName}, '%')</if>
<if test="startProId != null and startProId != ''"> and fa.startProId = #{startProId}</if>
<if test="startProName != null and startProName != ''"> and fa.startProName like concat('%', #{startProName}, '%')</if>
2024-12-29 21:35:34 +08:00
<if test='activeTags == "depts"'> and fa.category = '1'</if>
2025-02-22 11:19:39 +08:00
<if test='activeTags == "users"'> and fa.category in ('2','3','4','5','6','8')</if>
<if test="groupIds != null and groupIds.size()>0">
and bus.sub_dept_group in
<foreach collection="groupIds" item="groupId" open="(" separator="," close=")">
#{groupId}
</foreach>
2024-12-30 00:30:39 +08:00
</if>
2024-12-22 19:55:21 +08:00
<if test="assigneeId != null and roleIds != null and roleIds.size()>0">
AND (fa.ASSIGNEE_ = #{assigneeId}
2024-08-19 00:41:01 +08:00
OR (
2024-12-22 19:55:21 +08:00
fa.ASSIGNEE_ IS NULL
AND (
fa.USER_ID_ = #{assigneeId}
OR (
fa.GROUP_ID_ IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
)
2024-08-19 00:41:01 +08:00
)
)
)
2024-12-22 19:55:21 +08:00
</if>
2024-08-19 00:41:01 +08:00
order by fa.createTime desc
</select>
<!--根据条件查询我的代办分组数量统计-->
2024-12-22 19:55:21 +08:00
<select id="findAwaitCountGroupByCategory" parameterType="FlowTaskEntity" resultType="Map">
select fa.category, count(1) as total from vw_flow_await fa where 1=1
2024-08-19 00:41:01 +08:00
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
2024-12-22 19:55:21 +08:00
<if test="startUserId != null and startUserId != ''"> and fa.startUserId = #{startUserId}</if>
<if test="startUserName != null and startUserName != ''"> and fa.startUserName like concat('%', #{startUserName}, '%')</if>
<if test="startDeptName != null and startDeptName != ''"> and fa.startDeptName like concat('%', #{startDeptName}, '%')</if>
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and date(fa.createTime) between #{params.beginTime} and #{params.endTime}</if>
2024-08-19 00:41:01 +08:00
<!-- 查询条件-项目部门 -->
2024-12-22 19:55:21 +08:00
<if test="startComId != null and startComId != ''"> and fa.startComId = #{startComId}</if>
<if test="startComName != null and startComName != ''"> and fa.startComName like concat('%', #{startComName}, '%')</if>
<if test="startProId != null and startProId != ''"> and fa.startProId = #{startProId}</if>
<if test="startProName != null and startProName != ''"> and fa.startProName like concat('%', #{startProName}, '%')</if>
AND (fa.ASSIGNEE_ = #{assigneeId}
OR (
fa.ASSIGNEE_ IS NULL
AND ( fa.USER_ID_ = #{assigneeId}
OR (
fa.GROUP_ID_ IN
<foreach collection="roleIds" item="roleId" open="(" separator="," close=")">
#{roleId}
</foreach>
)
)
)
)
2024-08-19 00:41:01 +08:00
group by fa.category
</select>
<!--查询我的已办任务-->
2024-12-22 19:55:21 +08:00
<select id="selectMyFinishedFlowTask" parameterType="FlowTaskEntity" resultType="Map">
2024-12-29 21:35:34 +08:00
select fa.*
<if test='activeTags == "depts"'>, sud.business_license_path as businessImg, bus.sub_dept_name as businessMk1, sdd.dict_label as businessMk2, sud.sub_dept_code as businessMk3</if>
2025-01-22 00:20:58 +08:00
<if test='activeTags == "users"'>, bus.user_picture as businessImg, bus.card_code as businessMk1, sdd.dict_label as businessMk2, bus.sub_dept_name as businessMk3</if>
2024-12-29 21:35:34 +08:00
from vw_flow_finished fa
<if test='activeTags == "depts"'> left join pro_project_info_subdepts_users bus on bus.id = fa.businessKey left join pro_project_info_subdepts sud on sud.id = bus.sub_dept_id left join sys_dict_data sdd on sdd.dict_value = bus.sub_dept_type and sdd.dict_type='sub_dept_type' </if>
2025-01-22 00:20:58 +08:00
<if test='activeTags == "users"'> left join pro_project_info_subdepts_users bus on bus.id = fa.businessKey left join sys_dict_data sdd on sdd.dict_value = bus.craft_post and sdd.dict_type='pro_craft_post'</if>
2024-08-19 00:41:01 +08:00
where
2024-12-22 19:55:21 +08:00
fa.ASSIGNEE_=#{assigneeId}
2024-08-19 00:41:01 +08:00
<if test="procDefName != null and procDefName != ''"> and fa.procDefName like concat('%', #{procDefName}, '%')</if>
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
2024-12-22 19:55:21 +08:00
<if test="startUserId != null and startUserId != ''"> and fa.startUserId = #{startUserId}</if>
<if test="startUserName != null and startUserName != ''"> and fa.startUserName like concat('%', #{startUserName}, '%')</if>
<if test="startDeptName != null and startDeptName != ''"> and fa.startDeptName like concat('%', #{startDeptName}, '%')</if>
2024-08-19 00:41:01 +08:00
<if test="category != null and category != ''"> and fa.category = #{category}</if>
2024-12-22 19:55:21 +08:00
<if test="startComId != null and startComId != ''"> and fa.startComId = #{startComId}</if>
<if test="startComName != null and startComName != ''"> and fa.startComName like concat('%', #{startComName}, '%')</if>
<if test="startProId != null and startProId != ''"> and fa.startProId = #{startProId}</if>
<if test="startProName != null and startProName != ''"> and fa.startProName like concat('%', #{startProName}, '%')</if>
2024-12-29 21:35:34 +08:00
<if test='activeTags == "depts"'> and fa.category = '1'</if>
2025-02-22 11:19:39 +08:00
<if test='activeTags == "users"'> and fa.category in ('2','3','4','5','6','8')</if>
2024-12-22 19:55:21 +08:00
<if test="params.beginTime != null and params.beginTime != '' and params.endTime != null and params.endTime != ''"> and fa.endTime between #{params.beginTime} and #{params.endTime}</if>
2024-08-19 00:41:01 +08:00
order by fa.endTime desc
</select>
2024-12-30 00:30:39 +08:00
<!--查询我的已办任务-->
<select id="selectMySubdeptsGroups" resultType="Map">
2025-03-05 23:22:11 +08:00
select id, sub_dept_name, sub_dept_group, user_post from pro_project_info_subdepts_users where project_id = #{proId} and user_id = #{userId} and approve_status <![CDATA[ >= ]]> 100 and is_del=0 and sub_dept_group is not null
2024-12-30 00:30:39 +08:00
</select>
2025-03-08 16:14:02 +08:00
<select id="selectMyAwaitSspTask" resultType="Map">
select '106' as category, count(1) as total from smz_ssp_problemmodify
<where>
infoType=0
<if test="proId != null"> and projectId=#{proId}</if>
<if test="userId != null"> and lordSent=#{userId} and checkState in (0,3)</if>
</where>
union all
select '107' as category, count(1) as total from smz_ssp_problemmodify
<where>
infoType=0
<if test="proId != null"> and projectId=#{proId}</if>
<if test="userId != null"> and lordSent=#{userId} and checkState in (0,3)</if>
</where>
select '108' as category, count(1) as total from smz_ssp_problemmodify
<where>
infoType=1
<if test="proId != null"> and projectId=#{proId}</if>
<if test="userId != null"> and lordSent=#{userId} and checkState in (0,3)</if>
</where>
union all
select '109' as category, count(1) as total from smz_ssp_problemmodify
<where>
infoType=1
<if test="proId != null"> and projectId=#{proId}</if>
<if test="userId != null"> and lordSent=#{userId} and checkState in (0,3)</if>
</where>
</select>
2024-08-19 00:41:01 +08:00
</mapper>