SELECT
oa.*,
t.ID_ taskId
FROM
xxx oa
INNER JOIN act_ru_execution e ON oa.complaint_id = e.BUSINESS_KEY_
INNER JOIN act_re_procdef p ON e.PROC_DEF_ID_ = p.ID_
INNER JOIN act_ru_task t ON t.PROC_INST_ID_ = e.PROC_INST_ID_
INNER JOIN act_ru_identitylink i ON I.TASK_ID_ = t.ID_
WHERE
e.PARENT_ID_ IS NULL
AND e.BUSINESS_KEY_ IS NOT NULL
AND t.TENANT_ID_ = '1'
AND (
t.ASSIGNEE_ = 'admin'
OR (
t.ASSIGNEE_ IS NULL
AND I.TYPE_ = 'candidate'
AND ( I.USER_ID_ = 'admin' )))
其中TENANT_ID_ 可选代表租户
admin替换成要查询的人