刘光辉
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
<?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.dmsMapper.DmsApprovedMetadataMapper">
    <resultMap id="Metadata" type="jnpf.dmsEntity.banben.DmsWenjianBanbenJiesuanModel">
        <result column="bianhao_shiyong_ren_id" property="bianhaoShiyongRenId"/>
        <result column="zhidingren_bumen_id" property="zhidingrenBumenId"/>
        <result column="shenhe_liucheng_id" property="shenheLiuchengId"/>
        <result column="shenhe_liucheng_renwu_id" property="shenheLiuchengRenwuId"/>
    </resultMap>
    <select id="selectSource" resultMap="Metadata">
        SELECT a.zhidingren_bumen_id, a.f_flow_id AS shenhe_liucheng_id,
               a.f_flow_task_id AS shenhe_liucheng_renwu_id,
               a.bianhao_shiyong_ren_id
        FROM (
            SELECT a.f_tenant_id, a.f_flow_id, a.f_flow_task_id,
                   a.bumen_id AS zhidingren_bumen_id,
                   CASE WHEN #{rowId,jdbcType=VARCHAR} IS NULL THEN n.shiyong_ren_id END AS bianhao_shiyong_ren_id
            FROM dms_wenjian_xinzeng_shenhe a
            LEFT JOIN dms_wenjian_bianhao n ON n.f_tenant_id = a.f_tenant_id AND n.f_id = a.wenjian_bianhao_id
            WHERE #{auditType} = 'xinzeng_shenhe' AND a.f_tenant_id = #{tenantId}
              AND a.f_id = #{auditId} AND a.f_flow_state = 2 AND a.f_delete_mark IS NULL
            UNION ALL
            SELECT a.f_tenant_id, a.f_flow_id, a.f_flow_task_id,
                   a.tiyi_bumen_id AS zhidingren_bumen_id, NULL AS bianhao_shiyong_ren_id
            FROM dms_wenjian_xiuding_shenhe a
            WHERE #{auditType} = 'xiuding_shenhe' AND a.f_tenant_id = #{tenantId}
              AND a.f_id = #{auditId} AND a.f_flow_state = 2 AND a.f_delete_mark IS NULL
            UNION ALL
            SELECT a.f_tenant_id, a.f_flow_id, a.f_flow_task_id,
                   a.bumen_id AS zhidingren_bumen_id, NULL AS bianhao_shiyong_ren_id
            FROM dms_wailai_wenjian_xinzeng_shenhe a
            WHERE #{auditType} = 'wailai_wenjian_xinzeng_shenhe' AND a.f_tenant_id = #{tenantId}
              AND a.f_id = #{auditId} AND a.f_flow_state = 2 AND a.f_delete_mark IS NULL
        ) a
    </select>
</mapper>