根據數據權限查詢前端
1 SELECT * FROM ( 2 SELECT ROWNUM AS ROWNO, AA.* FROM ( 3 SELECT DISTINCT A.OBJECTID InstanceID 4 , A.PRIORITY Priority 5 , INSTANCENAME InstanceName 6 , A.WORKFLOWCODE WorkflowCode 7 , C.WORKFLOWNAME WorkflowName 8 , A.ORIGINATOR Originator 9 , A.ORIGINATORNAME OriginatorName 10 , A.CREATEDTIME CreatedTime 11 , A.ORGUNIT 12 , D.DISPLAYNAME ApproverLink 13 , D.PARTICIPANTNAME Approver 14 , A.STATE InstanceState 15 , A.PLANFINISHTIME PlanFinishTime 16 , A.FINISHTIME FinishedTime 17 , A.EXCEPTIONAL Exceptional 18 FROM H3.OT_INSTANCECONTEXT A 19 JOIN H3.OT_USER B ON A.ORIGINATOR = B.OBJECTID 20 JOIN H3.OT_WORKFLOWCLAUSE C ON A.WORKFLOWCODE = C.WORKFLOWCODE 21 LEFT JOIN H3.OT_WORKITEM D ON A.OBJECTID = D.INSTANCEID 22 WHERE A.CREATEDTIME > to_date('2018-07-01 00:00:00','yyyy-mm-dd hh24:mi:ss') 23 AND A.CREATEDTIME < to_date('2019-12-01 00:00:00','yyyy-mm-dd hh24:mi:ss') 24 AND A.STATE = 2 25 AND A.WORKFLOWCODE IN ('ITService','test') 29 AND (B.CODE = 'xxx' 30 OR (EXISTS 31 ( 32 SELECT 1 FROM H3.OT_BIZOBJECTACL Z JOIN H3.OT_USER X ON Z.USERID=X.OBJECTID 33 WHERE SCHEMACODE = A.WORKFLOWCODE AND (Z.ADMINISTRATOR=1 OR Z.CREATEBIZOBJECT=1 OR Z.VIEWDATA=1 ) 34 AND Z.ORGSCOPETYPE = 2 AND X.CODE = 'xxx' -- 模型權限 全組織 35 ) 36 OR EXISTS 37 ( 38 -- 前端提交的 流程模板權限的組織範圍 39 SELECT OBJECTID --, NAME 40 FROM H3.OT_ORGANIZATIONUNIT 41 WHERE A.ORGUNIT IN OBJECTID 42 START WITH OBJECTID IN 43 ( 44 SELECT ORGSCOPE 45 FROM H3.OT_BIZOBJECTACL Z JOIN H3.OT_USER X ON Z.USERID=X.OBJECTID 46 WHERE SCHEMACODE = A.WORKFLOWCODE AND (Z.ADMINISTRATOR=1 OR Z.CREATEBIZOBJECT=1 OR Z.VIEWDATA=1 ) 47 AND Z.ORGSCOPETYPE = 0 AND X.CODE = 'xxx' -- 模型權限 特定範圍 48 ) 49 CONNECT BY PRIOR OBJECTID = PARENTID 50 ) 51 ) 52 ) 53 AND (A.ORIGINATOR = 'b11b0075-cd3f-4953-a3e4-331671f87ca7' -- 前端組織範圍選擇具體的人 54 OR A.ORGUNIT IN 55 ( 56 -- 前端提交的 只查看此組織範圍 57 SELECT OBJECTID --, NAME 58 FROM H3.OT_ORGANIZATIONUNIT 59 START WITH OBJECTID IN ( '5b95c20d-ad64-453f-badd-4d12c8327ead' ) 60 CONNECT BY PRIOR OBJECTID = PARENTID 61 ) 62 ) 63 ORDER BY A.CREATEDTIME DESC 64 ) AA 65 WHERE ROWNUM <= 10 66 ) BB 67 WHERE ROWNO >= 1