204 lines
14 KiB
XML
204 lines
14 KiB
XML
<?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">
|
|
|
|
<select id="selectAllFlowTaskByParams" parameterType="FlowTaskEntity" resultType="FlowTaskEntity">
|
|
SELECT * FROM vw_flow_all fa
|
|
<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>
|
|
<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="category != null and category != ''"> and fa.category = #{category}</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>
|
|
<!-- 查询条件-项目部门 -->
|
|
<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>
|
|
<if test='activeTags == "await"'> and fa.finishTime is null</if>
|
|
<if test='activeTags == "finished"'> and fa.finishTime is not null</if>
|
|
</where>
|
|
order by fa.createTime desc
|
|
</select>
|
|
|
|
<!--查询工作流任务-->
|
|
<select id="findFlowTaskByProcInsId" parameterType="string" resultType="FlowTaskEntity">
|
|
select * from vw_flow_all where procInsId = #{procInsId}
|
|
</select>
|
|
|
|
<!--查询工作流操作日志-->
|
|
<select id="selectCommentByProcInsId" parameterType="string" resultType="Map">
|
|
select * from vw_flow_comment where procInstId = #{procInstId} order by commentId IS NULL DESC,commentId DESC
|
|
</select>
|
|
|
|
<!--查询工作流操作日志-->
|
|
<select id="selectCommentByBusinessKey" parameterType="string" resultType="Map">
|
|
select * from vw_flow_comment where procInstId = #{procInstId} order by commentId IS NULL DESC,commentId DESC
|
|
</select>
|
|
|
|
<select id="selectLastCommentByProcInsId" parameterType="string" resultType="Map">
|
|
select * from vw_flow_comment where procInstId = #{procInstId} order by commentId IS NULL DESC,commentId DESC limit 1
|
|
</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="FlowTaskEntity" resultType="Map">
|
|
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>
|
|
<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>
|
|
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>
|
|
<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>
|
|
where
|
|
fa.taskName != '申请人提交'
|
|
<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="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="category != null and category != ''"> and fa.category = #{category}</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>
|
|
<!-- 查询条件-项目部门 -->
|
|
<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>
|
|
<if test='activeTags == "depts"'> and fa.category = '1'</if>
|
|
<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>
|
|
</if>
|
|
<if test="assigneeId != null and roleIds != null and roleIds.size()>0">
|
|
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>
|
|
)
|
|
)
|
|
)
|
|
)
|
|
</if>
|
|
order by fa.createTime desc
|
|
</select>
|
|
|
|
<!--查询我的驳回任务-->
|
|
<select id="selectMyRejectedFlowTask" parameterType="FlowTaskEntity" resultType="Map">
|
|
select fa.* from vw_flow_await fa
|
|
<where>
|
|
<if test="businessKey != null and businessKey != ''"> and fa.businessKey = #{businessKey}</if>
|
|
<if test="startProId != null and startProId != ''"> and fa.startProId = #{startProId}</if>
|
|
AND fa.ASSIGNEE_ = #{assigneeId}
|
|
</where>
|
|
</select>
|
|
|
|
<!--根据条件查询我的代办分组数量统计-->
|
|
<select id="findAwaitCountGroupByCategory" parameterType="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="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>
|
|
<!-- 查询条件-项目部门 -->
|
|
<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>
|
|
)
|
|
)
|
|
)
|
|
)
|
|
group by fa.category
|
|
</select>
|
|
|
|
<!--查询我的已办任务-->
|
|
<select id="selectMyFinishedFlowTask" parameterType="FlowTaskEntity" resultType="Map">
|
|
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>
|
|
<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>
|
|
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>
|
|
<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>
|
|
where
|
|
fa.ASSIGNEE_=#{assigneeId}
|
|
<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="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="category != null and category != ''"> and fa.category = #{category}</if>
|
|
<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>
|
|
<if test='activeTags == "depts"'> and fa.category = '1'</if>
|
|
<if test='activeTags == "users"'> and fa.category in ('2','3','4','5','6','8')</if>
|
|
<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>
|
|
order by fa.endTime desc
|
|
</select>
|
|
|
|
<!--查询我的已办任务-->
|
|
<select id="selectMySubdeptsGroups" resultType="Map">
|
|
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
|
|
</select>
|
|
|
|
<select id="selectMyAwaitSspTask" resultType="Map">
|
|
select '106' as category, id 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, id from smz_ssp_problemmodify
|
|
<where>
|
|
infoType=0
|
|
<if test="proId != null"> and projectId=#{proId}</if>
|
|
<if test="userId != null"> and recheckSend=#{userId} and checkState=1</if>
|
|
</where>
|
|
UNION ALL
|
|
select '108' as category, id 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, id from smz_ssp_problemmodify
|
|
<where>
|
|
infoType=1
|
|
<if test="proId != null"> and projectId=#{proId}</if>
|
|
<if test="userId != null"> and recheckSend=#{userId} and checkState=1</if>
|
|
</where>
|
|
</select>
|
|
|
|
</mapper> |