|  |  | 
 |  |  |         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="pageDone2" resultType="com.zt.modules.workflow.model.WfRunTask"> | 
 |  |  |         select *, | 
 |  |  |                case | 
 |  |  |                    when STEP_MARKER = 'zl' then '处长审核' | 
 |  |  |                    when STEP_MARKER = 'cz' then '助理编报' | 
 |  |  |                    else '处长审核' end as finishStepName, | 
 |  |  |                case | 
 |  |  |                    when STEP_MARKER = 'zl' then '处长' | 
 |  |  |                    when STEP_MARKER = 'cz' then '助理' | 
 |  |  |                    else '处长' end   as finishUserName | 
 |  |  |         from ( | 
 |  |  |                  SELECT 0                                                   as bizGroupId, | 
 |  |  |                         CONCAT(p.Name, '-', a.YEAR, '-', c.Dict_label)      AS topic, | 
 |  |  |                         case | 
 |  |  |                             when a.CURRENT_STATE = 1 then '助理修改计划' | 
 |  |  |                             when a.CURRENT_STATE = 5 then '处长审批计划' | 
 |  |  |                             else '完成' end                                   AS step_name, | 
 |  |  |                         case when a.CURRENT_STATE = 1 then '驳回' else '' end AS statusName, | 
 |  |  |                         a.id, | 
 |  |  |                         '90'                                                as STEP_ID, | 
 |  |  |                         case | 
 |  |  |                             when a.CURRENT_STATE = 1 then 'zl' | 
 |  |  |                             when a.CURRENT_STATE = 5 then 'cz' | 
 |  |  |                             else 'wc' end                                   as STEP_MARKER, | 
 |  |  |                         a.id                                                as bizId, | 
 |  |  |                         'yearPlan2'                                         as FLOW_CODE, | 
 |  |  |                         u.nick_name                                         as APPLY_USER, | 
 |  |  |                         2                                                   as code, | 
 |  |  |                         '年度修理计划'                                            as title, | 
 |  |  |                         '年度修理计划'                                            as remark, | 
 |  |  |                         a.UPDATE_DATE                                       AS RECEIVE_TIME, | 
 |  |  |                         case | 
 |  |  |                             when a.CURRENT_STATE = 1 then '助理' | 
 |  |  |                             when a.CURRENT_STATE = 5 then '处长' | 
 |  |  |                             else '' end                                     AS receiveName, | 
 |  |  |                         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.UPDATER | 
 |  |  |                  WHERE a.is_delete = 0 | 
 |  |  |                    and ( | 
 |  |  |                          (CURRENT_STATE in (1, 10) | 
 |  |  |                              and EXISTS(SELECT 1 | 
 |  |  |                                         FROM sys_role s1, | 
 |  |  |                                              sys_role_user s2 | 
 |  |  |                                         WHERE s2.IS_DELETE = 0 | 
 |  |  |                                           and s1.ID = s2.role_id | 
 |  |  |                                           AND s2.USER_id = #{userId} | 
 |  |  |                                           AND s1.CODE = 'czbm') | 
 |  |  |                              ) | 
 |  |  |                          or ( | 
 |  |  |                                  CURRENT_STATE in (5, 10) | 
 |  |  |                                  and EXISTS(SELECT 1 | 
 |  |  |                                             FROM sys_role s1, | 
 |  |  |                                                  sys_role_user s2 | 
 |  |  |                                             WHERE s2.IS_DELETE = 0 | 
 |  |  |                                               and s1.ID = s2.role_id | 
 |  |  |                                               AND s2.USER_id = #{userId} | 
 |  |  |                                               AND s1.CODE = 'zlbm') | 
 |  |  |                              ) | 
 |  |  |                          or ( CURRENT_STATE in (1, 5, 10) | 
 |  |  |                             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 in ('all', 'xtglybm')) | 
 |  |  |                              ) | 
 |  |  |                      ) | 
 |  |  |              ) as c | 
 |  |  |         order by c.RECEIVE_TIME desc | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  | <!-- | 
 |  |  |     <select id="page3" resultType="com.zt.modules.workflow.model.WfRunTask"> | 
 |  |  |         select | 
 |  |  |             a.stepRouterId, | 
 |  |  |             a.project_id as bizGroupId, | 
 |  |  |             b.MODEL_NAME AS topic, | 
 |  |  |             '日计划'  as title, | 
 |  |  |             plan_date as remark, | 
 |  |  |             step_name, | 
 |  |  |             a.id, | 
 |  |  |             '0' STEP_ID, | 
 |  |  |             a.STEP_MARKER, | 
 |  |  |             'rjhFlow' as FLOW_CODE, | 
 |  |  |             c.user_name as APPLY_USER, | 
 |  |  |             '' as code, | 
 |  |  |             a.create_date AS RECEIVE_TIME, | 
 |  |  |             DateDiff(CURRENT_DATE,a.create_date) as idleDays | 
 |  |  |         from | 
 |  |  |             ( | 
 |  |  |                 SELECT | 
 |  |  |                     *,'rjh_hz' as STEP_MARKER,'总厂汇总' as STEP_Name,'1648318473140449281' as stepRouterId | 
 |  |  |                 FROM | 
 |  |  |                     wx_daily_plan | 
 |  |  |                 WHERE | 
 |  |  |                     IS_DELETE =0 | 
 |  |  |                   and FLOW_Status = 'rjh_hz' | 
 |  |  |                   AND EXISTS ( | 
 |  |  |                         SELECT | 
 |  |  |                             1 | 
 |  |  |                         FROM | 
 |  |  |                             sys_role s1, | 
 |  |  |                             sys_role_user s2 | 
 |  |  |                         WHERE | 
 |  |  |                             s1.ID = s2.role_id | 
 |  |  |                           AND s2.USER_id = #{userId} | 
 |  |  |                           AND s1.CODE = 'zcbm' | 
 |  |  |                     ) | 
 |  |  |                 union | 
 |  |  |                 SELECT | 
 |  |  |                     *,'rjh_sh' as STEP_MARKER,'部门长审核' as STEP_Name,'1648318806923161601' as stepRouterId | 
 |  |  |                 FROM | 
 |  |  |                     wx_daily_plan | 
 |  |  |                 WHERE | 
 |  |  |                     IS_DELETE =0 | 
 |  |  |                   and FLOW_Status = 'rjh_sh' | 
 |  |  |                   AND EXISTS ( | 
 |  |  |                         SELECT | 
 |  |  |                             1 | 
 |  |  |                         FROM | 
 |  |  |                             sys_role s1, | 
 |  |  |                             sys_role_user s2 | 
 |  |  |                         WHERE | 
 |  |  |                             s1.ID = s2.role_id | 
 |  |  |                           AND s2.USER_id = #{userId} | 
 |  |  |                           AND s1.CODE = 'ywzbm' | 
 |  |  |                     ) | 
 |  |  |                 union | 
 |  |  |                 SELECT | 
 |  |  |                     *,'rjh_cjfk' as STEP_MARKER,'厂家反馈情况' as STEP_MARKER,'1648319132719919106' as stepRouterId | 
 |  |  |                 FROM | 
 |  |  |                     wx_daily_plan | 
 |  |  |                 WHERE | 
 |  |  |                     IS_DELETE =0 | 
 |  |  |                   and FLOW_Status = 'rjh_fk' | 
 |  |  |                   AND cjfk_Status = 0 | 
 |  |  |                   AND MAINTAIN_UNIT = #{deptId} | 
 |  |  |                   AND EXISTS ( | 
 |  |  |                         SELECT | 
 |  |  |                             1 | 
 |  |  |                         FROM | 
 |  |  |                             sys_role s1, | 
 |  |  |                             sys_role_user s2 | 
 |  |  |                         WHERE | 
 |  |  |                             s1.ID = s2.role_id | 
 |  |  |                           AND s2.USER_id = #{userId} | 
 |  |  |                           AND s1.CODE = 'cjbm' | 
 |  |  |                     ) | 
 |  |  |                 union | 
 |  |  |                 SELECT | 
 |  |  |                     *,'rjh_tyfk' as STEP_MARKER,'艇员反馈助修情况' as STEP_Name,'1648318988234534914' as stepRouterId | 
 |  |  |                 FROM | 
 |  |  |                     wx_daily_plan | 
 |  |  |                 WHERE | 
 |  |  |                     IS_DELETE =0 | 
 |  |  |                   and FLOW_Status = 'rjh_fk' | 
 |  |  |                   AND tyfk_Status = 0 | 
 |  |  |                   AND REPAIR_PERSONNEL = #{userId} | 
 |  |  |                   AND EXISTS ( | 
 |  |  |                         SELECT | 
 |  |  |                             1 | 
 |  |  |                         FROM | 
 |  |  |                             sys_role s1, | 
 |  |  |                             sys_role_user s2 | 
 |  |  |                         WHERE | 
 |  |  |                             s1.ID = s2.role_id | 
 |  |  |                           AND s2.USER_id = #{userId} | 
 |  |  |                           AND s1.CODE = 'tybm' | 
 |  |  |                     ) | 
 |  |  |                 GROUP BY | 
 |  |  |                     project_id, | 
 |  |  |                     plan_date | 
 |  |  |             ) a | 
 |  |  |                 left join wx_project b on a.project_id = b.id | 
 |  |  |                 left join sys_user c on a.SUBMIT_PERSONNEL = c.user_id | 
 |  |  |     </select> | 
 |  |  | --> | 
 |  |  |  | 
 |  |  |     <select id="page3" resultType="com.zt.modules.workflow.model.WfRunTask"> | 
 |  |  |         select | 
 |  |  |             a.stepRouterId, | 
 |  |  |             a.project_id as bizGroupId, | 
 |  |  |             b.MODEL_NAME AS topic, | 
 |  |  |             a.title, | 
 |  |  |             a.remark, | 
 |  |  |             step_name, | 
 |  |  |             a.id, | 
 |  |  |             '0' STEP_ID, | 
 |  |  |             a.STEP_MARKER, | 
 |  |  |             a.FLOW_CODE, | 
 |  |  |             c.user_name as APPLY_USER, | 
 |  |  |             '' as code, | 
 |  |  |             a.create_date AS RECEIVE_TIME, | 
 |  |  |             DateDiff(CURRENT_DATE,a.create_date) as idleDays | 
 |  |  |         from | 
 |  |  |             ( | 
 |  |  |                 SELECT | 
 |  |  |                     id,project_id,create_date,SUBMIT_PERSONNEL, | 
 |  |  |                     '月计划'  as title, | 
 |  |  |                     concat('月计划 (', select_date, ')')  as remark, | 
 |  |  |                     'monthPlanFlow' as FLOW_CODE, | 
 |  |  |                     'yjh_hz' as STEP_MARKER,'总厂汇总' as STEP_Name,'1660911405324423170' as stepRouterId | 
 |  |  |                 FROM | 
 |  |  |                     wx_weekly_month_plan | 
 |  |  |                 WHERE | 
 |  |  |                     IS_DELETE = 0 | 
 |  |  |                   and PLAN_TYPE = 1 | 
 |  |  |                   and FLOW_Status = 'yjh_hz' | 
 |  |  |                   AND EXISTS ( | 
 |  |  |                         SELECT | 
 |  |  |                             1 | 
 |  |  |                         FROM | 
 |  |  |                             sys_role s1, | 
 |  |  |                             sys_role_user s2 | 
 |  |  |                         WHERE | 
 |  |  |                             s1.ID = s2.role_id | 
 |  |  |                           AND s1.IS_DELETE=0 | 
 |  |  |                           AND s2.IS_DELETE=0 | 
 |  |  |                           AND s2.USER_id = #{userId} | 
 |  |  |                           AND s1.CODE = 'zcbm' | 
 |  |  |                     ) | 
 |  |  |                 GROUP BY | 
 |  |  |                     project_id, select_date | 
 |  |  |                 union | 
 |  |  |                 SELECT | 
 |  |  |                     id,project_id,create_date,SUBMIT_PERSONNEL, | 
 |  |  |                     '周计划'  as title, | 
 |  |  |                     concat('周计划 (', select_date, ')')  as remark, | 
 |  |  |                     'weekPlanFlow' as FLOW_CODE, | 
 |  |  |                     'zjh_hz' as STEP_MARKER,'总厂汇总' as STEP_Name,'1660904721482895361' as stepRouterId | 
 |  |  |                 FROM | 
 |  |  |                     wx_weekly_month_plan | 
 |  |  |                 WHERE | 
 |  |  |                     IS_DELETE = 0 | 
 |  |  |                   and PLAN_TYPE = 0 | 
 |  |  |                   and FLOW_Status = 'zjh_hz' | 
 |  |  |                   AND EXISTS ( | 
 |  |  |                         SELECT | 
 |  |  |                             1 | 
 |  |  |                         FROM | 
 |  |  |                             sys_role s1, | 
 |  |  |                             sys_role_user s2 | 
 |  |  |                         WHERE | 
 |  |  |                             s1.ID = s2.role_id | 
 |  |  |                           AND s1.IS_DELETE=0 | 
 |  |  |                           AND s2.IS_DELETE=0 | 
 |  |  |                           AND s2.USER_id = #{userId} | 
 |  |  |                           AND s1.CODE = 'zcbm' | 
 |  |  |                     ) | 
 |  |  |                 GROUP BY | 
 |  |  |                     project_id, select_date | 
 |  |  |                 union | 
 |  |  |                 SELECT | 
 |  |  |                     id,project_id,create_date,SUBMIT_PERSONNEL, | 
 |  |  |                     '日计划'  as title, | 
 |  |  |                     concat('日计划 (', plan_date, ')')  as remark, | 
 |  |  |                     'rjhFlow' as FLOW_CODE, | 
 |  |  |                     'rjh_hz' as STEP_MARKER,'总厂汇总' as STEP_Name,'1648318473140449281' as stepRouterId | 
 |  |  |                 FROM | 
 |  |  |                     wx_daily_plan | 
 |  |  |                 WHERE | 
 |  |  |                     IS_DELETE = 0 | 
 |  |  |                   and FLOW_Status = 'rjh_hz' | 
 |  |  |                   AND EXISTS ( | 
 |  |  |                         SELECT | 
 |  |  |                             1 | 
 |  |  |                         FROM | 
 |  |  |                             sys_role s1, | 
 |  |  |                             sys_role_user s2 | 
 |  |  |                         WHERE | 
 |  |  |                             s1.ID = s2.role_id | 
 |  |  |                           AND s1.IS_DELETE=0 | 
 |  |  |                           AND s2.IS_DELETE=0 | 
 |  |  |                           AND s2.USER_id = #{userId} | 
 |  |  |                           AND s1.CODE = 'zcbm' | 
 |  |  |                     ) | 
 |  |  |                 GROUP BY | 
 |  |  |                     project_id, plan_date | 
 |  |  |             ) a | 
 |  |  |                 left join wx_project b on a.project_id = b.id | 
 |  |  |                 left join sys_user c on a.SUBMIT_PERSONNEL = c.user_id | 
 |  |  |     </select> | 
 |  |  |  | 
 |  |  |     <select id="getRowByProjectId" resultType="com.zt.modules.workflow.model.WfRunTask"> | 
 |  |  |         SELECT | 
 |  |  |             a.id, |