drop table ${tableName} drop table if exists ${pageDone_temp1}; create table ${pageDone_temp1} as SELECT * FROM ( SELECT a1.id, a1.title, a1.topic, a1.remark, a1.biz_id, a1.biz_group_id, a1.flow_code, a1.step_id, a1.step_marker, /*a.step_name as step_name_my,*/ a1.receive_name as sender_name, a1.receive_time, a1.finish_time as finish_time, a1.status 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'))) and a1.FLOW_ID in (select id from wf_def where system_type = #{djxlSystem}) ) a2 where status in (20,10) group by a2.biz_id,a2.flow_code,a2.step_id; drop table if exists ${pageDone_temp2}; create table ${pageDone_temp2} as select * from (select b1.prev_id, b1.group_id, b1.biz_id, b1.flow_code, b1.step_id, b1.step_marker, b1.step_name, b1.receive_name, b1.receive_time, b1.status from ${pageDone_temp1} a1, WF_RUN_TASK b1 WHERE b1.is_delete = 0 and b1.status in(0,1,100) and a1.biz_id = b1.biz_id and a1.flow_code = b1.flow_code order by b1.receive_time DESC ) b2 group by biz_id,flow_code,step_id; 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}