|  |  |  | 
|---|
|  |  |  | a.biz_group_id, | 
|---|
|  |  |  | a.opinion, | 
|---|
|  |  |  | (case when status = 1 then '被驳回' else '' end)  as statusName, | 
|---|
|  |  |  | DateDiff(CURRENT_DATE,a.RECEIVE_TIME) as idleDays, | 
|---|
|  |  |  | DateDiff(CURRENT_DATE,a.receive_time) as idleDays, | 
|---|
|  |  |  | a.topic AS taskName, | 
|---|
|  |  |  | a.step_name as taskType, | 
|---|
|  |  |  | a.biz_id as id, | 
|---|
|  |  |  | 0 as Product_id, | 
|---|
|  |  |  | 0 as MAINTAIN_LEVEL, | 
|---|
|  |  |  | 0 as YEAR, | 
|---|
|  |  |  | a.RECEIVE_NAME as apply_user, | 
|---|
|  |  |  | date_add(a.RECEIVE_TIME,interval 7 day) AS finishTime, | 
|---|
|  |  |  | a.STEP_ID as APPROVE_STEP_ID, | 
|---|
|  |  |  | a.STEP_MARKER, | 
|---|
|  |  |  | a.FLOW_CODE, | 
|---|
|  |  |  | a.APPLY_USER as taskPeople, | 
|---|
|  |  |  | a.receive_name as apply_user, | 
|---|
|  |  |  | date_add(a.receive_time,interval 7 day) AS finishTime, | 
|---|
|  |  |  | a.step_id as APPROVE_STEP_ID, | 
|---|
|  |  |  | a.step_marker, | 
|---|
|  |  |  | a.flow_code, | 
|---|
|  |  |  | a.apply_user as taskPeople, | 
|---|
|  |  |  | 2 code, | 
|---|
|  |  |  | a.title  as summary, | 
|---|
|  |  |  | b.STEP_ROUTER, | 
|---|
|  |  |  | b.STEP_ROUTER_ID | 
|---|
|  |  |  | FROM WF_RUN_TASK a | 
|---|
|  |  |  | left join WF_DEF_STEP b on a.step_id = b.id | 
|---|
|  |  |  | b.step_router, | 
|---|
|  |  |  | b.step_router_id | 
|---|
|  |  |  | FROM wf_run_task a | 
|---|
|  |  |  | left join wf_def_step b on a.step_id = b.id | 
|---|
|  |  |  | WHERE a.is_delete =0 and a.status in (0,1) | 
|---|
|  |  |  | AND a.RECEIVE_ID = #{userId} | 
|---|
|  |  |  | AND a.receive_id = #{userId} | 
|---|
|  |  |  | <if test="projectId != null and projectId != ''"> | 
|---|
|  |  |  | and a.biz_group_id = #{projectId} | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="djxlSystem != null and djxlSystem != ''"> | 
|---|
|  |  |  | and a.FLOW_ID in (select id from wf_def where system_type = #{djxlSystem}) | 
|---|
|  |  |  | and a.flow_id in (select id from wf_def where system_type = #{djxlSystem}) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | ORDER BY a.receive_time DESC | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | 
|---|
|  |  |  | a1.receive_time, | 
|---|
|  |  |  | a1.finish_time as finish_time, | 
|---|
|  |  |  | a1.status | 
|---|
|  |  |  | FROM WF_RUN_TASK a1 | 
|---|
|  |  |  | FROM wf_run_task a1 | 
|---|
|  |  |  | WHERE a1.is_delete = 0 | 
|---|
|  |  |  | and (a1.receive_id=#{userId} | 
|---|
|  |  |  | or EXISTS(SELECT 1 FROM sys_role s1,sys_role_user s2 WHERE s1.ID = s2.role_id AND s2.USER_id = #{userId} AND | 
|---|
|  |  |  | s2.is_delete=0 and s1.CODE in ('all','xtglybm'))) | 
|---|
|  |  |  | or EXISTS(SELECT 1 FROM sys_role s1,sys_role_user s2 WHERE s1.id = s2.role_id AND s2.user_id = #{userId} AND | 
|---|
|  |  |  | s2.is_delete=0 and s1.code in ('all','xtglybm'))) | 
|---|
|  |  |  | <if test="djxlSystem != null and djxlSystem != ''"> | 
|---|
|  |  |  | and a1.FLOW_ID in (select id from wf_def where system_type = #{djxlSystem}) | 
|---|
|  |  |  | and a1.flow_id in (select id from wf_def where system_type = #{djxlSystem}) | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ) a2 | 
|---|
|  |  |  | 
|---|
|  |  |  | b1.receive_time, | 
|---|
|  |  |  | b1.status | 
|---|
|  |  |  | from ${pageDone_temp1} a1, | 
|---|
|  |  |  | WF_RUN_TASK b1 | 
|---|
|  |  |  | wf_run_task b1 | 
|---|
|  |  |  | WHERE b1.is_delete = 0 | 
|---|
|  |  |  | and b1.status in(0,1,100) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | a.biz_id, | 
|---|
|  |  |  | a.flow_code, | 
|---|
|  |  |  | a.biz_group_id, | 
|---|
|  |  |  | c.STEP_READ_ROUTER_ID, | 
|---|
|  |  |  | c.step_read_router_id, | 
|---|
|  |  |  | a.sender_name, | 
|---|
|  |  |  | a.finish_time, | 
|---|
|  |  |  | b.prev_id, | 
|---|
|  |  |  | b.step_marker, | 
|---|
|  |  |  | b.step_name, | 
|---|
|  |  |  | case when c.CAN_RECALL=1 and a.id=b.prev_id and c.step_no < d.step_no and d.step_no < 100 | 
|---|
|  |  |  | case when c.can_recall=1 and a.id=b.prev_id and c.step_no < d.step_no and d.step_no < 100 | 
|---|
|  |  |  | then 1 else 0 end as canRecall, | 
|---|
|  |  |  | c.step_no as myStepNo, | 
|---|
|  |  |  | d.step_no as curStepNo, | 
|---|
|  |  |  | 
|---|
|  |  |  | a.sender_name as finishUserName | 
|---|
|  |  |  | FROM ${pageDone_temp1} a | 
|---|
|  |  |  | join ${pageDone_temp2} b on a.biz_id = b.biz_id and a.flow_code = b.flow_code | 
|---|
|  |  |  | left join WF_DEF_STEP c on a.step_id = c.id | 
|---|
|  |  |  | left join WF_DEF_STEP d on b.step_id = d.id | 
|---|
|  |  |  | left join wf_def_step c on a.step_id = c.id | 
|---|
|  |  |  | left join wf_def_step d on b.step_id = d.id | 
|---|
|  |  |  | group by a.biz_id,a.flow_code,a.step_id | 
|---|
|  |  |  | ORDER BY a.receive_time DESC | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="page2" resultType="com.zt.modules.workflow.model.WfRunTask"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | 0 as bizGroupId, | 
|---|
|  |  |  | CONCAT(p.Name, '-', a.YEAR, '-', c.Dict_label ) AS topic, | 
|---|
|  |  |  | case when a.current_state =1 then '助理修改计划' else '处长审批计划' end AS step_name, | 
|---|
|  |  |  | case when a.current_state =1 then '驳回' else '' end AS statusName, | 
|---|
|  |  |  | a.id, | 
|---|
|  |  |  | '80' STEP_ID, | 
|---|
|  |  |  | case when a.current_state =1 then 'zl' else 'cz' end AS STEP_MARKER, | 
|---|
|  |  |  | 'yearPlan' as FLOW_CODE, | 
|---|
|  |  |  | u.nick_name as APPLY_USER, | 
|---|
|  |  |  | 2 as code, | 
|---|
|  |  |  | '年度修理计划'  as title, | 
|---|
|  |  |  | '年度修理计划'  as remark, | 
|---|
|  |  |  | a.create_date AS RECEIVE_TIME, | 
|---|
|  |  |  | DateDiff(CURRENT_DATE,a.create_date) as idleDays | 
|---|
|  |  |  | FROM | 
|---|
|  |  |  | zhgl_annual_plan a | 
|---|
|  |  |  | LEFT JOIN view_zt_boat_tree p on concat(a.product_id) = p.product_id | 
|---|
|  |  |  | LEFT JOIN sys_dict_data c ON a.maintain_level = c.dict_value | 
|---|
|  |  |  | AND dict_type_id IN(SELECT id FROM sys_dict_type WHERE dict_type = 'question_level_type') | 
|---|
|  |  |  | LEFT JOIN sys_user u ON u.user_id = a.creator | 
|---|
|  |  |  | WHERE a.is_delete = 0 | 
|---|
|  |  |  | and ( | 
|---|
|  |  |  | (current_state = 1 | 
|---|
|  |  |  | and EXISTS(SELECT 1 FROM sys_role s1,sys_role_user s2 | 
|---|
|  |  |  | WHERE s1.id = s2.role_id AND s2.user_id = #{userId} AND | 
|---|
|  |  |  | s2.is_delete=0 and s1.CODE = 'zlbm') | 
|---|
|  |  |  | ) or ( | 
|---|
|  |  |  | current_state = '5' | 
|---|
|  |  |  | and EXISTS(SELECT 1 FROM sys_role s1,sys_role_user s2 | 
|---|
|  |  |  | WHERE s1.id = s2.role_id AND s2.user_id = #{userId} AND | 
|---|
|  |  |  | s2.is_delete=0 and s1.CODE = 'czbm') | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | ) | 
|---|
|  |  |  | order by a.update_date desc limit 0,1 | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="getRowByProjectId" resultType="com.zt.modules.workflow.model.WfRunTask"> | 
|---|
|  |  |  | SELECT | 
|---|
|  |  |  | 
|---|
|  |  |  | a.biz_group_id, | 
|---|
|  |  |  | a.opinion, | 
|---|
|  |  |  | (case when status = 1 then '被驳回' else '' end)  as statusName, | 
|---|
|  |  |  | DateDiff(CURRENT_DATE,a.RECEIVE_TIME) as idleDays, | 
|---|
|  |  |  | DateDiff(CURRENT_DATE,a.receive_time) as idleDays, | 
|---|
|  |  |  | a.topic AS taskName, | 
|---|
|  |  |  | a.step_name as taskType, | 
|---|
|  |  |  | a.biz_id as id, | 
|---|
|  |  |  | 0 as Product_id, | 
|---|
|  |  |  | 0 as MAINTAIN_LEVEL, | 
|---|
|  |  |  | 0 as YEAR, | 
|---|
|  |  |  | a.RECEIVE_TIME AS finishTime, | 
|---|
|  |  |  | a.STEP_ID as APPROVE_STEP_ID, | 
|---|
|  |  |  | a.STEP_MARKER, | 
|---|
|  |  |  | a.FLOW_CODE, | 
|---|
|  |  |  | a.APPLY_USER as taskPeople, | 
|---|
|  |  |  | a.receive_time AS finishTime, | 
|---|
|  |  |  | a.step_id as APPROVE_STEP_ID, | 
|---|
|  |  |  | a.step_marker, | 
|---|
|  |  |  | a.flow_code, | 
|---|
|  |  |  | a.apply_user as taskPeople, | 
|---|
|  |  |  | 2 code, | 
|---|
|  |  |  | a.title  as summary, | 
|---|
|  |  |  | b.STEP_ROUTER, | 
|---|
|  |  |  | b.STEP_ROUTER_ID | 
|---|
|  |  |  | FROM WF_RUN_TASK a | 
|---|
|  |  |  | left join WF_DEF_STEP b on a.step_id = b.id | 
|---|
|  |  |  | b.step_router, | 
|---|
|  |  |  | b.step_router_id | 
|---|
|  |  |  | FROM wf_run_task a | 
|---|
|  |  |  | left join wf_def_step b on a.step_id = b.id | 
|---|
|  |  |  | WHERE a.is_delete =0 and a.status in (0,1) | 
|---|
|  |  |  | and a.topic=(select model_name from wx_project where id=#{projectId}) | 
|---|
|  |  |  | and a.step_marker='jsfa_sc' | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <update id="oneKeyDoneCy"> | 
|---|
|  |  |  | update wf_run_task | 
|---|
|  |  |  | set status=20, UPDATER=#{userId}, UPDATE_DATE=CURRENT_TIMESTAMP | 
|---|
|  |  |  | where STEP_MARKER in('rjh_cy','zjh_cy','yjh_cy') and status=0 and RECEIVE_ID=#{userId} | 
|---|
|  |  |  | set status=20, updater=#{userId}, update_date=CURRENT_TIMESTAMP | 
|---|
|  |  |  | where step_marker in('rjh_cy','zjh_cy','yjh_cy') and status=0 and receive_id=#{userId} | 
|---|
|  |  |  | </update> | 
|---|
|  |  |  | </mapper> | 
|---|