刘光辉
4 小时以前 06f314545ac3514d7ce28939920866ae8188d31c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="jnpf.flowable.mapper.FilePermissionRuntimeMapper">
    <resultMap id="runtime" type="jnpf.flowable.model.filepermission.FilePermissionNativeState">
        <id column="f_id" property="taskId"/>
        <result column="f_flow_id" property="flowId"/>
        <result column="f_creator_user_id" property="creatorId"/>
        <result column="f_status" property="status"/>
        <result column="f_flow_type" property="flowType"/>
        <result column="f_current_node_code" property="currentNodeCode"/>
        <collection property="members" ofType="jnpf.flowable.model.filepermission.FilePermissionNativeState$Member" notNullColumn="member_id">
            <id column="member_id" property="id"/>
            <id column="member_kind" property="kind"/>
            <result column="node_code" property="nodeCode"/>
            <result column="user_id" property="userId"/>
            <result column="member_status" property="status"/>
            <result column="completion" property="completion"/>
            <result column="handle_status" property="handleStatus"/>
            <result column="handle_type" property="handleType"/>
            <result column="start_handle_time" property="startHandleTime"/>
        </collection>
    </resultMap>
    <select id="find" resultMap="runtime">
        SELECT t.f_id, t.f_flow_id, t.f_creator_user_id, t.f_status, t.f_flow_type, t.f_current_node_code,
               m.member_id, m.member_kind, m.node_code, m.user_id, m.member_status,
               m.completion, m.handle_status, m.handle_type, m.start_handle_time
        FROM workflow_task t
        LEFT JOIN (
            SELECT f_task_id, f_id AS member_id, 'operator' AS member_kind, f_node_code AS node_code,
                   f_handle_id AS user_id, f_status AS member_status, f_completion AS completion,
                   f_handle_status AS handle_status, CAST(NULL AS INTEGER) AS handle_type,
                   f_start_handle_time AS start_handle_time
            FROM workflow_operator WHERE f_task_id = #{taskId} AND f_delete_mark IS NULL
            UNION ALL
            SELECT f_task_id, f_id, 'record', f_node_code, f_handle_id, f_status,
                   NULL, NULL, f_handle_type, CAST(NULL AS TIMESTAMP)
            FROM workflow_record WHERE f_task_id = #{taskId} AND f_delete_mark IS NULL
            UNION ALL
            SELECT f_task_id, f_id, 'circulate', f_node_code, f_user_id, NULL, NULL, NULL, NULL,
                   CAST(NULL AS TIMESTAMP)
            FROM workflow_circulate WHERE f_task_id = #{taskId} AND f_delete_mark IS NULL
        ) m ON m.f_task_id = t.f_id
        WHERE t.f_id = #{taskId} AND t.f_delete_mark IS NULL
        ORDER BY m.member_kind, m.member_id
    </select>
</mapper>