|
|
|
@ -757,4 +757,394 @@ |
|
|
|
and city.type_key='district_party' and city.party_code='shibei' |
|
|
|
GROUP BY city.id |
|
|
|
</select> |
|
|
|
<select id="usertotaldata" resultType="com.elink.esua.epdc.dto.screen.result.UsertotaldataResultDTO"> |
|
|
|
SELECT gr.id as orgId, |
|
|
|
gr.name as orgName, |
|
|
|
gr.pid as parentId, |
|
|
|
'grid' as orgType, |
|
|
|
IFNULL(t.userTotal,0) AS userTotal, |
|
|
|
IFNULL(t.partyTotal,0) AS partyTotal, |
|
|
|
IFNULL(t.groupTotal,0) AS groupTotal, |
|
|
|
IFNULL(t.issueTotal,0) AS issueTotal, |
|
|
|
IFNULL(t.topicTotal,0) AS topicTotal, |
|
|
|
IFNULL(t.projectTotal,0) AS projectTotal |
|
|
|
FROM esua_epdc_admin.sys_dept gr |
|
|
|
left join |
|
|
|
(select total.GRID_ID, |
|
|
|
sum(total.userTotal) as userTotal, |
|
|
|
sum(total.partyTotal) as partyTotal, |
|
|
|
sum(total.groupTotal) as groupTotal, |
|
|
|
sum(total.issueTotal) as issueTotal, |
|
|
|
sum(total.topicTotal) as topicTotal, |
|
|
|
sum(total.projectTotal) as projectTotal |
|
|
|
from |
|
|
|
(select ifnull(if(eu.DEPT_ID = 0, NULL, eu.DEPT_ID), ( |
|
|
|
SELECT GRID_ID FROM esua_epdc_user.epdc_user_grid_relation |
|
|
|
WHERE DEL_FLAG = '0' AND USER_ID = eu.ID |
|
|
|
ORDER BY |
|
|
|
CREATED_TIME,id |
|
|
|
LIMIT 1 ) |
|
|
|
) AS GRID_ID, |
|
|
|
count(eu.id) as userTotal, |
|
|
|
count(eu.PARTY_FLAG = '1' OR NULL ) AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_user.epdc_user eu |
|
|
|
where eu.DEL_FLAG=0 |
|
|
|
group by eu.DEPT_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
count(id) as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_group.epdc_group |
|
|
|
where DEL_FLAG=0 and STATE=10 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
union all |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
count(id) as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_events.epdc_issue |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
count(id) as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_group.epdc_topic |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
count(id) as projectTotal |
|
|
|
from esua_epdc_events.epdc_item |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID)total |
|
|
|
group by total.GRID_ID)t on gr.id=t.GRID_ID |
|
|
|
where gr.del_flag=0 |
|
|
|
and gr.type_key='grid_party' |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
SELECT co.id as orgId, |
|
|
|
co.name as orgName, |
|
|
|
co.pid as parentId, |
|
|
|
'department' as orgType, |
|
|
|
SUM(IFNULL(t.userTotal,0)) AS userTotal, |
|
|
|
SUM(IFNULL(t.partyTotal,0)) AS partyTotal, |
|
|
|
SUM(IFNULL(t.groupTotal,0)) AS groupTotal, |
|
|
|
SUM(IFNULL(t.issueTotal,0)) AS issueTotal, |
|
|
|
SUM(IFNULL(t.topicTotal,0)) AS topicTotal, |
|
|
|
SUM(IFNULL(t.projectTotal,0)) AS projectTotal |
|
|
|
FROM esua_epdc_admin.sys_dept co |
|
|
|
LEFT JOIN esua_epdc_admin.sys_dept gr on co.id=gr.pid |
|
|
|
left join |
|
|
|
(select total.GRID_ID, |
|
|
|
sum(total.userTotal) as userTotal, |
|
|
|
sum(total.partyTotal) as partyTotal, |
|
|
|
sum(total.groupTotal) as groupTotal, |
|
|
|
sum(total.issueTotal) as issueTotal, |
|
|
|
sum(total.topicTotal) as topicTotal, |
|
|
|
sum(total.projectTotal) as projectTotal |
|
|
|
from |
|
|
|
(select ifnull(if(eu.DEPT_ID = 0, NULL, eu.DEPT_ID), ( |
|
|
|
SELECT GRID_ID FROM esua_epdc_user.epdc_user_grid_relation |
|
|
|
WHERE DEL_FLAG = '0' AND USER_ID = eu.ID |
|
|
|
ORDER BY |
|
|
|
CREATED_TIME,id |
|
|
|
LIMIT 1 ) |
|
|
|
) AS GRID_ID, |
|
|
|
count(eu.id) as userTotal, |
|
|
|
count(eu.PARTY_FLAG = '1' OR NULL ) AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_user.epdc_user eu |
|
|
|
where eu.DEL_FLAG=0 |
|
|
|
group by eu.DEPT_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
count(id) as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_group.epdc_group |
|
|
|
where DEL_FLAG=0 and STATE=10 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
union all |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
count(id) as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_events.epdc_issue |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
count(id) as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_group.epdc_topic |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
count(id) as projectTotal |
|
|
|
from esua_epdc_events.epdc_item |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID)total |
|
|
|
group by total.GRID_ID)t on gr.id=t.GRID_ID |
|
|
|
where gr.del_flag=0 |
|
|
|
and co.del_flag=0 |
|
|
|
and co.type_key='community_party' |
|
|
|
GROUP BY co.id |
|
|
|
|
|
|
|
union all |
|
|
|
|
|
|
|
SELECT st.id as orgId, |
|
|
|
st.name as orgName, |
|
|
|
st.pid as parentId, |
|
|
|
'department' as orgType, |
|
|
|
SUM(IFNULL(t.userTotal,0)) AS userTotal, |
|
|
|
SUM(IFNULL(t.partyTotal,0)) AS partyTotal, |
|
|
|
SUM(IFNULL(t.groupTotal,0)) AS groupTotal, |
|
|
|
SUM(IFNULL(t.issueTotal,0)) AS issueTotal, |
|
|
|
SUM(IFNULL(t.topicTotal,0)) AS topicTotal, |
|
|
|
SUM(IFNULL(t.projectTotal,0)) AS projectTotal |
|
|
|
FROM esua_epdc_admin.sys_dept st |
|
|
|
left join esua_epdc_admin.sys_dept co on co.pid=st.id |
|
|
|
LEFT JOIN esua_epdc_admin.sys_dept gr on co.id=gr.pid |
|
|
|
left join |
|
|
|
(select total.GRID_ID, |
|
|
|
sum(total.userTotal) as userTotal, |
|
|
|
sum(total.partyTotal) as partyTotal, |
|
|
|
sum(total.groupTotal) as groupTotal, |
|
|
|
sum(total.issueTotal) as issueTotal, |
|
|
|
sum(total.topicTotal) as topicTotal, |
|
|
|
sum(total.projectTotal) as projectTotal |
|
|
|
from |
|
|
|
(select ifnull(if(eu.DEPT_ID = 0, NULL, eu.DEPT_ID), ( |
|
|
|
SELECT GRID_ID FROM esua_epdc_user.epdc_user_grid_relation |
|
|
|
WHERE DEL_FLAG = '0' AND USER_ID = eu.ID |
|
|
|
ORDER BY |
|
|
|
CREATED_TIME,id |
|
|
|
LIMIT 1 ) |
|
|
|
) AS GRID_ID, |
|
|
|
count(eu.id) as userTotal, |
|
|
|
count(eu.PARTY_FLAG = '1' OR NULL ) AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_user.epdc_user eu |
|
|
|
where eu.DEL_FLAG=0 |
|
|
|
group by eu.DEPT_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
count(id) as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_group.epdc_group |
|
|
|
where DEL_FLAG=0 and STATE=10 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
union all |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
count(id) as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_events.epdc_issue |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
count(id) as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_group.epdc_topic |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
count(id) as projectTotal |
|
|
|
from esua_epdc_events.epdc_item |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID)total |
|
|
|
group by total.GRID_ID)t on gr.id=t.GRID_ID |
|
|
|
where gr.del_flag=0 |
|
|
|
and co.del_flag=0 |
|
|
|
and st.del_flag=0 |
|
|
|
and st.type_key='street_party' |
|
|
|
GROUP BY st.id |
|
|
|
|
|
|
|
union all |
|
|
|
|
|
|
|
SELECT city.id as orgId, |
|
|
|
city.name as orgName, |
|
|
|
city.pid as parentId, |
|
|
|
'department' as orgType, |
|
|
|
SUM(IFNULL(t.userTotal,0)) AS userTotal, |
|
|
|
SUM(IFNULL(t.partyTotal,0)) AS partyTotal, |
|
|
|
SUM(IFNULL(t.groupTotal,0)) AS groupTotal, |
|
|
|
SUM(IFNULL(t.issueTotal,0)) AS issueTotal, |
|
|
|
SUM(IFNULL(t.topicTotal,0)) AS topicTotal, |
|
|
|
SUM(IFNULL(t.projectTotal,0)) AS projectTotal |
|
|
|
FROM esua_epdc_admin.sys_dept city |
|
|
|
left join esua_epdc_admin.sys_dept st on st.pid=city.id |
|
|
|
left join esua_epdc_admin.sys_dept co on co.pid=st.id |
|
|
|
LEFT JOIN esua_epdc_admin.sys_dept gr on co.id=gr.pid |
|
|
|
left join |
|
|
|
(select total.GRID_ID, |
|
|
|
sum(total.userTotal) as userTotal, |
|
|
|
sum(total.partyTotal) as partyTotal, |
|
|
|
sum(total.groupTotal) as groupTotal, |
|
|
|
sum(total.issueTotal) as issueTotal, |
|
|
|
sum(total.topicTotal) as topicTotal, |
|
|
|
sum(total.projectTotal) as projectTotal |
|
|
|
from |
|
|
|
(select ifnull(if(eu.DEPT_ID = 0, NULL, eu.DEPT_ID), ( |
|
|
|
SELECT GRID_ID FROM esua_epdc_user.epdc_user_grid_relation |
|
|
|
WHERE DEL_FLAG = '0' AND USER_ID = eu.ID |
|
|
|
ORDER BY |
|
|
|
CREATED_TIME,id |
|
|
|
LIMIT 1 ) |
|
|
|
) AS GRID_ID, |
|
|
|
count(eu.id) as userTotal, |
|
|
|
count(eu.PARTY_FLAG = '1' OR NULL ) AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_user.epdc_user eu |
|
|
|
where eu.DEL_FLAG=0 |
|
|
|
group by eu.DEPT_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
count(id) as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_group.epdc_group |
|
|
|
where DEL_FLAG=0 and STATE=10 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
union all |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
count(id) as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_events.epdc_issue |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
count(id) as topicTotal, |
|
|
|
0 as projectTotal |
|
|
|
from esua_epdc_group.epdc_topic |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID |
|
|
|
|
|
|
|
UNION ALL |
|
|
|
|
|
|
|
select GRID_ID, |
|
|
|
0 as userTotal, |
|
|
|
0 AS partyTotal, |
|
|
|
0 as groupTotal, |
|
|
|
0 as issueTotal, |
|
|
|
0 as topicTotal, |
|
|
|
count(id) as projectTotal |
|
|
|
from esua_epdc_events.epdc_item |
|
|
|
where DEL_FLAG=0 |
|
|
|
group by GRID_ID)total |
|
|
|
group by total.GRID_ID)t on gr.id=t.GRID_ID |
|
|
|
where gr.del_flag=0 |
|
|
|
and co.del_flag=0 |
|
|
|
and st.del_flag=0 |
|
|
|
and city.DEL_FLAG=0 |
|
|
|
and city.type_key='district_party' and city.party_code='shibei' |
|
|
|
GROUP BY city.id |
|
|
|
</select> |
|
|
|
</mapper> |
|
|
|
|