|
|
@ -142,4 +142,125 @@ |
|
|
|
SELECT STAFF_ID,ORG_ID,ORG_TYPE FROM staff_org_relation WHERE del_flag = '0' AND staff_id = #{staffId} |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO"> |
|
|
|
<result column="orgId" property="orgId"/> |
|
|
|
<result column="orgName" property="orgName"/> |
|
|
|
<result column="orgType" property="orgType"/> |
|
|
|
<result column="orgPids" property="orgPids"/> |
|
|
|
</resultMap> |
|
|
|
<resultMap id="NodeTreeResult" type="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO" |
|
|
|
extends="BaseResultMap"> |
|
|
|
<collection property="subOrgList" column="orgId" ofType="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO" |
|
|
|
javaType="java.util.ArrayList" select="getSubOrgList"> |
|
|
|
</collection> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<select id="getSubOrgList" resultMap="NodeTreeResult"> |
|
|
|
SELECT |
|
|
|
* |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
ID AS orgId, |
|
|
|
ORGANIZATION_NAME AS orgName, |
|
|
|
'agency' AS orgType, |
|
|
|
CONCAT( PIDS, ID ) AS orgPids |
|
|
|
FROM |
|
|
|
customer_agency a |
|
|
|
WHERE |
|
|
|
DEL_FLAG = 0 |
|
|
|
AND PID = #{pid} UNION |
|
|
|
SELECT |
|
|
|
cd.ID AS orgId, |
|
|
|
DEPARTMENT_NAME AS orgName, |
|
|
|
'dept' AS orgType, |
|
|
|
CONCAT( PIDS, ca.ID, cd.ID ) AS orgPids |
|
|
|
FROM |
|
|
|
customer_department cd |
|
|
|
INNER JOIN customer_agency ca ON cd.AGENCY_ID = ca.ID |
|
|
|
WHERE |
|
|
|
cd.DEL_FLAG = 0 |
|
|
|
AND cd.AGENCY_ID = #{pid} UNION |
|
|
|
SELECT |
|
|
|
ID AS orgId, |
|
|
|
GRID_NAME AS orgName, |
|
|
|
'grid' AS orgType, |
|
|
|
CONCAT( PIDS, ID ) AS orgPids |
|
|
|
FROM |
|
|
|
customer_grid |
|
|
|
WHERE |
|
|
|
DEL_FLAG = 0 |
|
|
|
AND PID = #{pid} |
|
|
|
) a |
|
|
|
ORDER BY |
|
|
|
orgType, |
|
|
|
orgId |
|
|
|
</select> |
|
|
|
<select id="getOrgTree" resultMap="NodeTreeResult"> |
|
|
|
select |
|
|
|
ID AS orgId, |
|
|
|
ORGANIZATION_NAME AS orgName, |
|
|
|
'agency' AS orgName, |
|
|
|
CONCAT(PIDS,ID) AS orgPids |
|
|
|
|
|
|
|
from |
|
|
|
customer_agency |
|
|
|
where |
|
|
|
DEL_FLAG = 0 |
|
|
|
AND ID = #{agencyId} |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<resultMap id="ResiNodeTreeResult" type="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO" |
|
|
|
extends="BaseResultMap"> |
|
|
|
<collection property="subOrgList" column="orgId" ofType="com.epmet.dataaggre.dto.govorg.result.OrgTreeResultDTO" |
|
|
|
javaType="java.util.ArrayList" select="getResiSubOrgList"> |
|
|
|
</collection> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<select id="getResiSubOrgList" resultMap="ResiNodeTreeResult"> |
|
|
|
SELECT |
|
|
|
* |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT |
|
|
|
ID AS orgId, |
|
|
|
ORGANIZATION_NAME AS orgName, |
|
|
|
'agency' AS orgType, |
|
|
|
CONCAT( PIDS, ID ) AS orgPids |
|
|
|
FROM |
|
|
|
customer_agency a |
|
|
|
WHERE |
|
|
|
DEL_FLAG = 0 |
|
|
|
AND PID = #{pid} UNION |
|
|
|
SELECT |
|
|
|
ID AS orgId, |
|
|
|
GRID_NAME AS orgName, |
|
|
|
'grid' AS orgType, |
|
|
|
CONCAT( PIDS, ID ) AS orgPids |
|
|
|
FROM |
|
|
|
customer_grid |
|
|
|
WHERE |
|
|
|
DEL_FLAG = 0 |
|
|
|
AND PID = #{pid} |
|
|
|
) a |
|
|
|
ORDER BY |
|
|
|
orgType, |
|
|
|
orgId |
|
|
|
</select> |
|
|
|
<select id="getResiOrgTree" resultMap="ResiNodeTreeResult"> |
|
|
|
select |
|
|
|
ID AS orgId, |
|
|
|
ORGANIZATION_NAME AS orgName, |
|
|
|
'agency' AS orgName, |
|
|
|
CONCAT(PIDS,ID) AS orgPids |
|
|
|
|
|
|
|
from |
|
|
|
customer_agency |
|
|
|
where |
|
|
|
DEL_FLAG = 0 |
|
|
|
AND ID = #{agencyId} |
|
|
|
</select> |
|
|
|
|
|
|
|
</mapper> |
|
|
|