|
@ -899,6 +899,16 @@ |
|
|
|
|
|
|
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="communityCount" resultType="java.lang.Integer"> |
|
|
|
|
|
|
|
|
|
|
|
select count(1) |
|
|
|
|
|
from customer_agency agency |
|
|
|
|
|
where agency.DEL_FLAG = 0 |
|
|
|
|
|
and agency.LEVEL = 'community' |
|
|
|
|
|
and agency.PIDS like concat(#{pids},'%') |
|
|
|
|
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="agencyGridCount" resultType="java.lang.Integer"> |
|
|
<select id="agencyGridCount" resultType="java.lang.Integer"> |
|
|
|
|
|
|
|
|
select count(*) |
|
|
select count(*) |
|
@ -1112,102 +1122,102 @@ |
|
|
select t.ID |
|
|
select t.ID |
|
|
from (select ca.ID |
|
|
from (select ca.ID |
|
|
, ca.CREATED_TIME created_time |
|
|
, ca.CREATED_TIME created_time |
|
|
, count(csa.ID) community_count |
|
|
, count(ca.ID) community_count |
|
|
from customer_agency ca |
|
|
from customer_agency ca |
|
|
inner join customer_staff_agency csa on (ca.ID = csa.AGENCY_ID and csa.DEL_FLAG = 0) |
|
|
<!--inner join customer_staff_agency csa on (ca.ID = csa.AGENCY_ID and csa.DEL_FLAG = 0)--> |
|
|
where ca.DEL_FLAG = 0 |
|
|
where ca.DEL_FLAG = 0 |
|
|
and ca.CUSTOMER_ID=#{customerId} |
|
|
and ca.CUSTOMER_ID=#{customerId} |
|
|
and ca.LEVEL = 'community' |
|
|
and ca.LEVEL = 'community' |
|
|
<if test="endDate != null"> |
|
|
<if test="endDate != null"> |
|
|
and csa.CREATED_TIME <![CDATA[<]]> #{endDate} |
|
|
and ca.CREATED_TIME <![CDATA[<]]> #{endDate} |
|
|
</if> |
|
|
|
|
|
and (ca.ID = #{agencyId} or ca.PIDS like CONCAT(#{agencyOrgIdPath}, '%')) |
|
|
|
|
|
group by ca.ID, ca.CREATED_TIME |
|
|
|
|
|
having community_count > 0 |
|
|
|
|
|
order by created_time desc) t |
|
|
|
|
|
</select> |
|
|
|
|
|
<select id="getCurrentUserCommunityInfo" |
|
|
|
|
|
resultType="com.epmet.dto.result.CurrentUserCommunityInfoResultDTO"> |
|
|
|
|
|
select |
|
|
|
|
|
ID AS orgId, |
|
|
|
|
|
ORGANIZATION_NAME AS orgName |
|
|
|
|
|
from customer_agency |
|
|
|
|
|
where DEL_FLAG = 0 |
|
|
|
|
|
and LEVEL = 'community' |
|
|
|
|
|
AND CUSTOMER_ID = #{customerId} |
|
|
|
|
|
<if test="staffAgencyId != null and staffAgencyId != ''"> |
|
|
|
|
|
AND (PIDS like concat('%',#{staffAgencyId},'%') or ID = #{staffAgencyId}) |
|
|
|
|
|
</if> |
|
|
</if> |
|
|
|
|
|
and (ca.ID = #{agencyId} or ca.PIDS like CONCAT(#{agencyOrgIdPath}, '%')) |
|
|
|
|
|
group by ca.ID, ca.CREATED_TIME |
|
|
|
|
|
having community_count > 0 |
|
|
|
|
|
order by created_time desc) t |
|
|
|
|
|
</select> |
|
|
|
|
|
<select id="getCurrentUserCommunityInfo" |
|
|
|
|
|
resultType="com.epmet.dto.result.CurrentUserCommunityInfoResultDTO"> |
|
|
|
|
|
select |
|
|
|
|
|
ID AS orgId, |
|
|
|
|
|
ORGANIZATION_NAME AS orgName |
|
|
|
|
|
from customer_agency |
|
|
|
|
|
where DEL_FLAG = 0 |
|
|
|
|
|
and LEVEL = 'community' |
|
|
|
|
|
AND CUSTOMER_ID = #{customerId} |
|
|
|
|
|
<if test="staffAgencyId != null and staffAgencyId != ''"> |
|
|
|
|
|
AND (PIDS like concat('%',#{staffAgencyId},'%') or ID = #{staffAgencyId}) |
|
|
|
|
|
</if> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="selectAgencyTree" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
ca.ID as id, |
|
|
|
|
|
ca.ORGANIZATION_NAME as label, |
|
|
|
|
|
ca.LONGITUDE as longitude, |
|
|
|
|
|
ca.LATITUDE as latitude, |
|
|
|
|
|
ca.`LEVEL` as level, |
|
|
|
|
|
ca.PID as pId, |
|
|
|
|
|
'agency' AS orgType |
|
|
|
|
|
FROM |
|
|
|
|
|
customer_agency ca |
|
|
|
|
|
WHERE |
|
|
|
|
|
ca.ID = #{agencyId} |
|
|
|
|
|
AND ca.DEL_FLAG = '0' |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="selectNextOrg" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO"> |
|
|
</select> |
|
|
(SELECT ca.ID as id, |
|
|
|
|
|
|
|
|
<select id="selectAgencyTree" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
ca.ID as id, |
|
|
|
|
|
ca.ORGANIZATION_NAME as label, |
|
|
ca.ORGANIZATION_NAME as label, |
|
|
ca.LONGITUDE as longitude, |
|
|
ca.LONGITUDE as longitude, |
|
|
ca.LATITUDE as latitude, |
|
|
ca.LATITUDE as latitude, |
|
|
ca.`LEVEL` as level, |
|
|
ca.`LEVEL` as level, |
|
|
ca.PID as pId, |
|
|
ca.PID as pId, |
|
|
'agency' AS orgType |
|
|
'agency' AS orgType |
|
|
FROM |
|
|
FROM customer_agency ca |
|
|
customer_agency ca |
|
|
WHERE ca.PID = #{agencyId} |
|
|
WHERE |
|
|
AND ca.DEL_FLAG = '0' |
|
|
ca.ID = #{agencyId} |
|
|
ORDER BY CAST(ca.organization_name AS SIGNED), CONVERT(ca.organization_name using gbk)) |
|
|
AND ca.DEL_FLAG = '0' |
|
|
union all |
|
|
</select> |
|
|
(SELECT cg.id, |
|
|
|
|
|
cg.GRID_NAME AS label, |
|
|
<select id="selectNextOrg" parameterType="java.lang.String" resultType="com.epmet.dto.BuildingTreeLevelDTO"> |
|
|
cg.LONGITUDE, |
|
|
(SELECT ca.ID as id, |
|
|
cg.LATITUDE, |
|
|
ca.ORGANIZATION_NAME as label, |
|
|
'grid' AS LEVEL, |
|
|
ca.LONGITUDE as longitude, |
|
|
cg.PID, |
|
|
ca.LATITUDE as latitude, |
|
|
'grid' AS orgType |
|
|
ca.`LEVEL` as level, |
|
|
FROM customer_grid cg |
|
|
ca.PID as pId, |
|
|
WHERE cg.DEL_FLAG = '0' |
|
|
'agency' AS orgType |
|
|
AND cg.PID = #{agencyId} |
|
|
FROM customer_agency ca |
|
|
ORDER BY cg.sort, CAST(cg.GRID_NAME AS SIGNED), CONVERT(cg.GRID_NAME using gbk)) |
|
|
WHERE ca.PID = #{agencyId} |
|
|
</select> |
|
|
AND ca.DEL_FLAG = '0' |
|
|
|
|
|
ORDER BY CAST(ca.organization_name AS SIGNED), CONVERT(ca.organization_name using gbk)) |
|
|
<select id="selectTotalNext" parameterType="java.lang.String" resultType="java.lang.Integer"> |
|
|
union all |
|
|
SELECT |
|
|
(SELECT cg.id, |
|
|
sum( t.total ) |
|
|
cg.GRID_NAME AS label, |
|
|
FROM |
|
|
cg.LONGITUDE, |
|
|
( |
|
|
cg.LATITUDE, |
|
|
SELECT |
|
|
'grid' AS LEVEL, |
|
|
count( a.id ) AS total |
|
|
cg.PID, |
|
|
FROM |
|
|
'grid' AS orgType |
|
|
customer_agency a |
|
|
FROM customer_grid cg |
|
|
WHERE |
|
|
WHERE cg.DEL_FLAG = '0' |
|
|
a.PID = #{agencyId} |
|
|
AND cg.PID = #{agencyId} |
|
|
AND a.DEL_FLAG = '0' |
|
|
ORDER BY cg.sort, CAST(cg.GRID_NAME AS SIGNED), CONVERT(cg.GRID_NAME using gbk)) |
|
|
UNION all |
|
|
</select> |
|
|
SELECT |
|
|
|
|
|
count( g.id ) AS total |
|
|
<select id="selectTotalNext" parameterType="java.lang.String" resultType="java.lang.Integer"> |
|
|
FROM |
|
|
SELECT |
|
|
customer_grid g |
|
|
sum( t.total ) |
|
|
WHERE |
|
|
FROM |
|
|
g.PID = #{agencyId} |
|
|
( |
|
|
AND g.DEL_FLAG = '0' |
|
|
SELECT |
|
|
) t |
|
|
count( a.id ) AS total |
|
|
</select> |
|
|
FROM |
|
|
|
|
|
customer_agency a |
|
|
<!-- 获取当前客户下所有的社区组织,只返回id,orgIdPath,agencyName --> |
|
|
WHERE |
|
|
|
|
|
a.PID = #{agencyId} |
|
|
|
|
|
AND a.DEL_FLAG = '0' |
|
|
|
|
|
UNION all |
|
|
|
|
|
SELECT |
|
|
|
|
|
count( g.id ) AS total |
|
|
|
|
|
FROM |
|
|
|
|
|
customer_grid g |
|
|
|
|
|
WHERE |
|
|
|
|
|
g.PID = #{agencyId} |
|
|
|
|
|
AND g.DEL_FLAG = '0' |
|
|
|
|
|
) t |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 获取当前客户下所有的社区组织,只返回id,orgIdPath,agencyName --> |
|
|
|
|
|
<select id="getAllCommunity" parameterType="java.lang.String" resultType="com.epmet.dto.result.AgencyResultDTO"> |
|
|
<select id="getAllCommunity" parameterType="java.lang.String" resultType="com.epmet.dto.result.AgencyResultDTO"> |
|
|
SELECT |
|
|
SELECT |
|
|
ca.id agencyId, |
|
|
ca.id agencyId, |
|
|