SELECT
( CASE requestlevel WHEN 0 THEN 0 WHEN 1 THEN 1 WHEN 2 THEN 2 ELSE - 1 END ) AS requestlevelorder,
requestid,
requestmark,
createdate,
createtime,
creater,
creatertype,
workflowid,
requestname,
requestnamenew,
STATUS,
requestlevel,
currentnodeid,
viewtype,
userid,
receivedate,
receivetime,
isremark,
nodeid,
agentorbyagentid,
agenttype,
isprocessed,
systype,
workflowtype,
isbereject,
takisremark,
requestnamehtmlnew,
viewDate,
viewTime,
lastFeedBackDate,
lastFeedBackTime,
needwfback,
lastFeedBackOperator
FROM
(
SELECT
requestid,
requestmark,
createdate,
createtime,
creater,
creatertype,
workflowid,
requestname,
requestnamenew,
STATUS,
requestlevel,
currentnodeid,
viewtype,
userid,
receivedate,
receivetime,
isremark,
nodeid,
agentorbyagentid,
agenttype,
isprocessed,
systype,
workflowtype,
isbereject,
takisremark,
requestnamehtmlnew,
viewDate,
viewTime,
lastFeedBackDate,
lastFeedBackTime,
needwfback,
lastFeedBackOperator
FROM
(
SELECT
t1.requestid,
t1.requestmark,
t1.createdate,
t1.createtime,
t1.creater,
t1.creatertype,
t1.workflowid,
t1.requestname,
t1.requestnamenew,
t1.STATUS,
t1.requestlevel,
t1.currentnodeid,
t2.viewtype,
t2.userid,
t2.receivedate,
t2.receivetime,
t2.isremark,
t2.nodeid,
t2.agentorbyagentid,
t2.agenttype,
t2.isprocessed,
t1.seclevel,
'0' AS systype,
t2.workflowtype,
t2.isbereject,
t2.takisremark,
t1.requestnamehtmlnew,
t2.viewDate,
t2.viewTime,
t1.lastFeedBackDate,
t1.lastFeedBackTime,
t2.needwfback,
t1.lastFeedBackOperator
FROM
workflow_requestbase t1,
workflow_currentoperator t2,
workflow_base t3
WHERE
t1.requestid = t2.requestid
AND t1.workflowid = t3.id
AND t2.userid IN ( 1 )
AND t2.usertype = 0
AND (
isnull( t1.currentstatus,- 1 ) = - 1
OR ( isnull( t1.currentstatus,- 1 ) = 0 AND t1.creater IN ( 1 ) )
)
AND ( t1.deleted <> 1 OR t1.deleted IS NULL OR t1.deleted = '' )
AND (
( t2.isremark = '0' AND ( t2.takisremark IS NULL OR t2.takisremark = 0 ) )
OR t2.isremark IN ( '1', '5', '8', '9', '7', '11' )
)
AND t2.islasttimes = 1
AND ( isprocessing = '' OR isprocessing IS NULL )
AND t3.isvalid IN ( '1', '3' ) UNION
(
SELECT DISTINCT
requestid,
'' AS requestmark,
createdate,
createtime,
creatorid AS creater,
0 AS creatertype,
workflowid,
requestname,
requestname AS requestnamenew,
'' AS STATUS,
requestlevel,- 1 AS currentnodeid,
viewtype,
userid,
receivedate,
receivetime,
isremark,
0 AS nodeid,
- 1 AS agentorbyagentid,
'0' AS agenttype,
'0' AS isprocessed,
'4' AS secLevel,
'1' AS systype,
sysid AS workflowtype,
'' AS isbereject,
0 AS takisremark,
'' AS requestnamehtmlnew,
'' AS viewDate,
'' AS viewTime,
'' AS lastFeedBackDate,
'' AS lastFeedBackTime,
'' AS needwfback,
0 AS lastFeedBackOperator
FROM
ofs_todo_data
WHERE
1 = 1
AND userid IN ( 1 )
AND islasttimes = 1
AND isremark IN ( 0, 8, 9 )
AND ofs_todo_data.pcurl IS NOT NULL
AND ofs_todo_data.pcurl <> ''
)
) t1
) t1
ORDER BY
receivedate DESC,
receivetime DESC
标签:takisremark,isremark,userid,流程,t2,t1,获取,待办,requestid
From: https://www.cnblogs.com/20200109-zwh/p/17918944.html