SELECT
a.id,
a.WORKFLOWNAME,
t.TYPENAME,
SUBCOMPANYNAME
FROM
( SELECT id, WORKFLOWNAME, WORKFLOWTYPE, SUBCOMPANYID FROM workflow_base WHERE ISVALID = 1 AND WORKFLOWTYPE NOT IN (1,171,89,105,223)) AS a
LEFT JOIN hrmsubcompany c ON a.SUBCOMPANYID = c.id
LEFT JOIN workflow_type t ON t.id = a.WORKFLOWTYPE
SELECT DISTINCT a.REQUESTID, wr.REQUESTNAME AS 流程标题, b.LASTNAME AS 操作人, wb.WORKFLOWNAME AS 流程名称, wn.NODENAME AS 节点名称, wr.createdate, a.logtype, case a.logtype when 0 then '批准' when 1 then '保存' when 2 then '提交' when 3 then '退回' when 4 then '重新打开 ' when 5 then '激活' when 6 then '转发' when 7 then '批注' when 8 then '意见征询' when 9 then '意见征询回复 ' when 'a' then '意见征询' when 'b' then '强制归档 ' when 'e' then '转办' when 'i' then '干预' when 'j' then '转办反馈' when 's' then '督办' when 't' then '抄送' end as 操作 FROM ( SELECT REQUESTID, operator, OPERATEDATE, WORKFLOWID, NODEID,logtype FROM workflow_requestlog WHERE operator IN ( 348566 ) ) a LEFT JOIN hrmresource b ON b.ID = a.operator LEFT JOIN workflow_base wb ON wb.id = a.WORKFLOWID LEFT JOIN workflow_nodebase wn ON wn.ID = a.NODEID LEFT JOIN workflow_requestbase wr ON wr.REQUESTID = a.REQUESTID where wr.createdate BETWEEN '2023-07-01' and '2023-07-10' and wn.nodename not like '%直接上级%' ORDER BY wb.WORKFLOWNAME limit 1000;