<?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.BusinessUnitMapper"> <resultMap id="OrganizationDto" type="pwc.taxtech.atms.dpo.OrganizationDto"> <id column="ID" jdbcType="VARCHAR" property="id"/> <result column="ORGANIZATION_NAME" jdbcType="VARCHAR" property="name"/> <result column="INDUSTRY_NAME" jdbcType="VARCHAR" property="industryName"/> <result column="BUSINESS_UNIT_NAME" jdbcType="VARCHAR" property="businessUnitName"/> <result column="BUSINESS_UNIT_ID" jdbcType="VARCHAR" property="businessUnitId"/> <result column="ORG_STRUCTURE_NAME" jdbcType="VARCHAR" property="structureName"/> <result column="INDUSTRY_ID" jdbcType="VARCHAR" property="industryId"/> <result column="REGION_ID" jdbcType="VARCHAR" property="regionId"/> <result column="REGION_NAME" jdbcType="VARCHAR" property="regionName"/> <result column="ORG_STRUCTURE_ID" jdbcType="VARCHAR" property="structureId"/> <result column="AREA_ID" jdbcType="VARCHAR" property="areaId"/> <result column="AREA_NAME" jdbcType="VARCHAR" property="areaName"/> <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"/> <result column="TAX_PAYER_NUMBER" jdbcType="VARCHAR" property="taxPayerNumber"/> <result column="IS_ACTIVE" jdbcType="SMALLINT" property="isActive"/> </resultMap> <select id="getBusinessUnitListJoinResult" resultMap="OrganizationDto"> SELECT DISTINCT ORG.id AS ID, ORG.name AS ORGANIZATION_NAME, IND.name AS INDUSTRY_NAME, BU.name AS BUSINESS_UNIT_NAME, BU.id AS BUSINESS_UNIT_ID, OS.name AS ORG_STRUCTURE_NAME, IND.id AS INDUSTRY_ID, ORG.region_id AS REGION_ID, REG.name AS REGION_NAME, OS.id AS ORG_STRUCTURE_ID, AREA.id AS AREA_ID, AREA.name AS AREA_NAME, ORG.client_code AS CLIENT_CODE, ORG.code AS CODE, ORG.parent_id AS PARENT_ID, ORG.p_level AS P_LEVEL, ORG.tax_payer_number AS TAX_PAYER_NUMBER FROM business_unit BU LEFT JOIN organization ORG ON BU.id = ORG.business_unit_id AND ORG.is_active = 1 LEFT JOIN industry IND ON ORG.industry_id = IND.id LEFT JOIN area AREA ON ORG.area_id = AREA.id LEFT JOIN organization_structure OS ON ORG.structure_id = OS.id LEFT JOIN region REG ON ORG.region_id = REG.id WHERE BU.is_active = 1 </select> </mapper>