DimensionExtendsMapper.xml 3.65 KB
Newer Older
1 2 3
<?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="pwc.taxtech.atms.dao.DimensionMapper">
neo's avatar
neo committed
4

5
    <resultMap id="OrganizationDto" type="pwc.taxtech.atms.dpo.OrganizationDto">
6
        <id column="ID" jdbcType="VARCHAR" property="id"/>
neo's avatar
neo committed
7 8 9 10 11
        <result column="DIMENSION_ID" jdbcType="VARCHAR" property="dimensionId"/>
        <result column="DIMENSION_NAME" jdbcType="VARCHAR" property="dimensionName"/>
        <result column="DIMENSION_VALUE_ID" jdbcType="VARCHAR" property="dimensionValueId"/>
        <result column="DIMENSION_VALUE_NAME" jdbcType="VARCHAR" property="dimensionValueName"/>

12
        <!-- 注意! OrganizationName 对应 name-->
neo's avatar
neo committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
        <result column="ORGANIZATION_NAME" jdbcType="VARCHAR" property="name"/>
        <result column="ATTRIBUTE_ID" jdbcType="VARCHAR" property="attributeId"/>
        <result column="BUSINESS_UNIT_ID" jdbcType="VARCHAR" property="businessUnitId"/>
        <result column="INDUSTRY_ID" jdbcType="VARCHAR" property="industryId"/>
        <result column="INDUSTRY_NAME" jdbcType="VARCHAR" property="industryName"/>
        <result column="REGION_ID" jdbcType="VARCHAR" property="regionId"/>
        <result column="REGION_NAME" jdbcType="VARCHAR" property="regionName"/>
        <result column="STRUCTURE_ID" jdbcType="VARCHAR" property="structureId"/>
        <result column="AREA_ID" jdbcType="VARCHAR" property="areaId"/>
        <result column="AREA_NAME" jdbcType="VARCHAR" property="areaName"/>
        <result column="BUSINESS_UNIT_NAME" jdbcType="VARCHAR" property="businessUnitName"/>
        <result column="CLIENT_CODE" jdbcType="VARCHAR" property="clientCode"/>
        <result column="CODE" jdbcType="VARCHAR" property="code"/>
        <result column="PARENT_ID" jdbcType="VARCHAR" property="parentId"/>
        <result column="P_LEVEL" jdbcType="INTEGER" property="pLevel"/>
28 29
    </resultMap>

neo's avatar
neo committed
30 31
    <select id="getBusinessUnitListJoinDimensionResult" parameterType="map" resultMap="OrganizationDto">
        SELECT DISTINCT
gary's avatar
gary committed
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
        ORG.id AS ID,
        D.id AS DIMENSION_ID,
        D.name AS DIMENSION_NAME,
        DV.id AS DIMENSION_VALUE_ID,
        DV.name AS DIMENSION_VALUE_NAME,
        ORG.name AS ORGANIZATION_NAME,
        D.attribute_id AS ATTRIBUTE_ID,
        BU.id AS BUSINESS_UNIT_ID,
        IND.id AS INDUSTRY_ID,
        IND.name AS INDUSTRY_NAME,
        ORG.region_id AS REGION_ID,
        REG.name AS REGION_NAME,
        OS.id AS STRUCTURE_ID,
        AREA.id AS AREA_ID,
        AREA.name AS AREA_NAME,
        BU.name AS BUSINESS_UNIT_NAME,
        ORG.client_code AS CLIENT_CODE,
        ORG.code AS CODE,
        ORG.parent_id AS PARENT_ID,
        ORG.p_level AS P_LEVEL
neo's avatar
neo committed
52
        FROM
gary's avatar
gary committed
53
        dimension D
neo's avatar
neo committed
54
        JOIN
gary's avatar
gary committed
55
        dimension_value DV
neo's avatar
neo committed
56
        ON
gary's avatar
gary committed
57 58
        D.id = DV.dimension_id
        AND DV.is_active = 1
neo's avatar
neo committed
59
        LEFT JOIN
gary's avatar
gary committed
60
        dimension_value_org DVG
neo's avatar
neo committed
61
        ON
gary's avatar
gary committed
62
        DV.id = DVG.dimension_value_id
neo's avatar
neo committed
63
        LEFT JOIN
gary's avatar
gary committed
64
        organization ORG
neo's avatar
neo committed
65
        ON
gary's avatar
gary committed
66
        ORG.id = DVG.organization_id
67
        <if test="orgIsActive != null and orgIsActive == true">
gary's avatar
gary committed
68
            AND ORG.is_active = 1
69
        </if>
neo's avatar
neo committed
70
        LEFT JOIN
gary's avatar
gary committed
71
        industry IND
neo's avatar
neo committed
72
        ON
gary's avatar
gary committed
73
        ORG.industry_id = IND.id
neo's avatar
neo committed
74
        LEFT JOIN
gary's avatar
gary committed
75
        business_unit BU
neo's avatar
neo committed
76
        ON
gary's avatar
gary committed
77
        BU.id = ORG.business_unit_id
neo's avatar
neo committed
78
        LEFT JOIN
gary's avatar
gary committed
79
        area AREA
neo's avatar
neo committed
80
        ON
gary's avatar
gary committed
81
        ORG.area_id = Area.ID
neo's avatar
neo committed
82
        LEFT JOIN
gary's avatar
gary committed
83
        organization_structure OS
neo's avatar
neo committed
84
        ON
gary's avatar
gary committed
85
        ORG.structure_id = OS.id
neo's avatar
neo committed
86
        LEFT JOIN
gary's avatar
gary committed
87
        region REG
neo's avatar
neo committed
88
        ON
gary's avatar
gary committed
89
        ORG.region_id = REG.id
neo's avatar
neo committed
90
        WHERE
gary's avatar
gary committed
91 92
        D.is_active = 1
        AND D.id = #{dimensionId}
93
    </select>
neo's avatar
neo committed
94

95
</mapper>