diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/DataStatsScreencollDao.xml b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/DataStatsScreencollDao.xml
index fe9f283dd..dd3bf7f93 100644
--- a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/DataStatsScreencollDao.xml
+++ b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/DataStatsScreencollDao.xml
@@ -66,6 +66,9 @@
WHERE
d.DEL_FLAG = '0'
and d.type_key='grid_party'
+ and d.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
) t
GROUP BY
t.orgId
@@ -142,6 +145,9 @@
co.DEL_FLAG = '0'
and gr.DEL_FLAG = '0'
and co.type_key='community_party'
+ and co.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
) t
GROUP BY
t.orgId
@@ -220,6 +226,9 @@
and co.DEL_FLAG = '0'
and gr.DEL_FLAG = '0'
and st.type_key='street_party'
+ and st.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
) t
GROUP BY
t.orgId
@@ -375,6 +384,9 @@
and ei.DEL_FLAG=0
and ei.ITEM_STATE=0
and i.DEL_FLAG=0
+ and d.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
order by ei.CREATED_TIME desc,i.id
@@ -398,6 +410,9 @@
where eg.DEL_FLAG=0 and eg.STATE=10
group by eg.GRID_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0 and gr.type_key='grid_party'
+ and gr.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
union all
@@ -424,6 +439,89 @@
where gr.del_flag=0
and co.del_flag=0
and co.type_key='community_party'
+ and co.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
+ group by co.id
+
+ union all
+
+ select st.id as orgId,
+ st.name as orgName,
+ st.pid as parentId,
+ 'department' as orgType,
+ sum(IFNULL(dg.createGroupTotal,0)) AS createGroupTotal,
+ sum(IFNULL(dg.groupUserTotal,0)) AS groupUserTotal
+ from esua_epdc_admin.sys_dept st
+ left join esua_epdc_admin.sys_dept co on st.id=co.pid
+ left join esua_epdc_admin.sys_dept gr on co.id=gr.pid
+ left join
+ (select eg.GRID_ID,
+ count(eg.id) as createGroupTotal,
+ sum(group_user.userCount) as groupUserTotal
+ from esua_epdc_group.epdc_group eg
+ left join (select GROUP_ID,
+ count(STATE = 10 OR NULL) AS userCount
+ from esua_epdc_group.epdc_user_group eu
+ where eu.DEL_FLAG=0
+ group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
+ where eg.DEL_FLAG=0 and eg.STATE=10
+ group by eg.GRID_ID)dg on dg.GRID_ID=gr.id
+ where gr.del_flag=0
+ and co.del_flag=0
+ and st.del_flag=0
+ and st.type_key='street_party'select gr.id as orgId,
+ gr.name as orgName,
+ gr.pid as parentId,
+ 'grid' as orgType,
+ IFNULL(dg.createGroupTotal,0) AS createGroupTotal,
+ IFNULL(dg.groupUserTotal,0) AS groupUserTotal
+ from esua_epdc_admin.sys_dept gr
+ left join
+ (select eg.GRID_ID,
+ count(eg.id) as createGroupTotal,
+ sum(group_user.userCount) as groupUserTotal
+ from esua_epdc_group.epdc_group eg
+ left join (select GROUP_ID,
+ count(STATE = 10 OR NULL) AS userCount
+ from esua_epdc_group.epdc_user_group eu
+ where eu.DEL_FLAG=0
+ group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
+ where eg.DEL_FLAG=0 and eg.STATE=10
+ group by eg.GRID_ID)dg on dg.GRID_ID=gr.id
+ where gr.del_flag=0 and gr.type_key='grid_party'
+ and gr.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
+
+ union all
+
+ select co.id as orgId,
+ co.name as orgName,
+ co.pid as parentId,
+ 'department' as orgType,
+ sum(IFNULL(dg.createGroupTotal,0)) AS createGroupTotal,
+ sum(IFNULL(dg.groupUserTotal,0)) AS groupUserTotal
+ from esua_epdc_admin.sys_dept co
+ left join esua_epdc_admin.sys_dept gr on co.id=gr.pid
+ left join
+ (select eg.GRID_ID,
+ count(eg.id) as createGroupTotal,
+ sum(group_user.userCount) as groupUserTotal
+ from esua_epdc_group.epdc_group eg
+ left join (select GROUP_ID,
+ count(STATE = 10 OR NULL) AS userCount
+ from esua_epdc_group.epdc_user_group eu
+ where eu.DEL_FLAG=0
+ group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
+ where eg.DEL_FLAG=0 and eg.STATE=10
+ group by eg.GRID_ID)dg on dg.GRID_ID=gr.id
+ where gr.del_flag=0
+ and co.del_flag=0
+ and co.type_key='community_party'
+ and co.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
group by co.id
union all
@@ -453,6 +551,44 @@
and co.del_flag=0
and st.del_flag=0
and st.type_key='street_party'
+ and st.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
+ group by st.id
+
+ union all
+
+ select city.id as orgId,
+ city.name as orgName,
+ city.pid as parentId,
+ 'department' as orgType,
+ sum(IFNULL(dg.createGroupTotal,0)) AS createGroupTotal,
+ sum(IFNULL(dg.groupUserTotal,0)) AS groupUserTotal
+ from esua_epdc_admin.sys_dept city
+ left join esua_epdc_admin.sys_dept st on city.id=st.pid
+ left join esua_epdc_admin.sys_dept co on st.id=co.pid
+ left join esua_epdc_admin.sys_dept gr on co.id=gr.pid
+ left join
+ (select eg.GRID_ID,
+ count(eg.id) as createGroupTotal,
+ sum(group_user.userCount) as groupUserTotal
+ from esua_epdc_group.epdc_group eg
+ left join (select GROUP_ID,
+ count(STATE = 10 OR NULL) AS userCount
+ from esua_epdc_group.epdc_user_group eu
+ where eu.DEL_FLAG=0
+ group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
+ where eg.DEL_FLAG=0 and eg.STATE=10
+ group by eg.GRID_ID)dg on dg.GRID_ID=gr.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
+ and st.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+ '1191535697380884481','1192004624745586689','1230704850994528257',
+ '1201319745506598913','1201687651826360321','1201689212329746433')
group by st.id
union all
@@ -496,310 +632,319 @@
IFNULL(t.topicTotal,0) AS topicTotal,
IFNULL(t.shiftProjectTotal,0) AS shiftProjectTotal,
IFNULL(t.resolvedProjectTotal,0) AS resolvedProjectTotal
- FROM esua_epdc_admin.sys_dept gr
- left join
- (select total.GRID_ID,
- sum(total.userTotal) as userTotal,
- sum(total.issueTotal) as issueTotal,
- sum(total.topicTotal) as topicTotal,
- sum(total.shiftProjectTotal) as shiftProjectTotal,
- sum(total.resolvedProjectTotal) as resolvedProjectTotal
- 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,
- 0 as issueTotal,
- 0 as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- 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,
- count(id) as issueTotal,
- 0 as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- from esua_epdc_events.epdc_issue
- where DEL_FLAG=0
- group by GRID_ID
-
- UNION ALL
-
- select GRID_ID,
- 0 as userTotal,
- 0 as issueTotal,
- count(id) as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- from esua_epdc_group.epdc_topic
- where DEL_FLAG=0
- group by GRID_ID
-
- UNION ALL
-
- select GRID_ID,
- 0 as userTotal,
- 0 as issueTotal,
- 0 as topicTotal,
- count(id) as shiftProjectTotal,
- count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
- 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.issueTotal,0)) AS issueTotal,
- SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
- SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
- SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
- 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.issueTotal) as issueTotal,
- sum(total.topicTotal) as topicTotal,
- sum(total.shiftProjectTotal) as shiftProjectTotal,
- sum(total.resolvedProjectTotal) as resolvedProjectTotal
- 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,
- 0 as issueTotal,
- 0 as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- 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,
- count(id) as issueTotal,
- 0 as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- from esua_epdc_events.epdc_issue
- where DEL_FLAG=0
- group by GRID_ID
-
- UNION ALL
-
- select GRID_ID,
- 0 as userTotal,
- 0 as issueTotal,
- count(id) as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- from esua_epdc_group.epdc_topic
- where DEL_FLAG=0
- group by GRID_ID
-
- UNION ALL
-
- select GRID_ID,
- 0 as userTotal,
- 0 as issueTotal,
- 0 as topicTotal,
- count(id) as shiftProjectTotal,
- count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
- 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.issueTotal,0)) AS issueTotal,
- SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
- SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
- SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
- 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.issueTotal) as issueTotal,
- sum(total.topicTotal) as topicTotal,
- sum(total.shiftProjectTotal) as shiftProjectTotal,
- sum(total.resolvedProjectTotal) as resolvedProjectTotal
- 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,
- 0 as issueTotal,
- 0 as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- 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,
- count(id) as issueTotal,
- 0 as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- from esua_epdc_events.epdc_issue
- where DEL_FLAG=0
- group by GRID_ID
-
- UNION ALL
-
- select GRID_ID,
- 0 as userTotal,
- 0 as issueTotal,
- count(id) as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- from esua_epdc_group.epdc_topic
- where DEL_FLAG=0
- group by GRID_ID
-
- UNION ALL
-
- select GRID_ID,
- 0 as userTotal,
- 0 as issueTotal,
- 0 as topicTotal,
- count(id) as shiftProjectTotal,
- count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
- 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.issueTotal,0)) AS issueTotal,
- SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
- SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
- SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
- 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.issueTotal) as issueTotal,
- sum(total.topicTotal) as topicTotal,
- sum(total.shiftProjectTotal) as shiftProjectTotal,
- sum(total.resolvedProjectTotal) as resolvedProjectTotal
- 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,
- 0 as issueTotal,
- 0 as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- 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,
- count(id) as issueTotal,
- 0 as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- from esua_epdc_events.epdc_issue
- where DEL_FLAG=0
- group by GRID_ID
-
- UNION ALL
-
- select GRID_ID,
- 0 as userTotal,
- 0 as issueTotal,
- count(id) as topicTotal,
- 0 as shiftProjectTotal,
- 0 as resolvedProjectTotal
- from esua_epdc_group.epdc_topic
- where DEL_FLAG=0
- group by GRID_ID
-
- UNION ALL
-
- select GRID_ID,
- 0 as userTotal,
- 0 as issueTotal,
- 0 as topicTotal,
- count(id) as shiftProjectTotal,
- count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
- 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
+ FROM esua_epdc_admin.sys_dept gr
+ left join
+ (select total.GRID_ID,
+ sum(total.userTotal) as userTotal,
+ sum(total.issueTotal) as issueTotal,
+ sum(total.topicTotal) as topicTotal,
+ sum(total.shiftProjectTotal) as shiftProjectTotal,
+ sum(total.resolvedProjectTotal) as resolvedProjectTotal
+ 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,
+ 0 as issueTotal,
+ 0 as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ 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,
+ count(id) as issueTotal,
+ 0 as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ from esua_epdc_events.epdc_issue
+ where DEL_FLAG=0
+ group by GRID_ID
+
+ UNION ALL
+
+ select GRID_ID,
+ 0 as userTotal,
+ 0 as issueTotal,
+ count(id) as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ from esua_epdc_group.epdc_topic
+ where DEL_FLAG=0
+ group by GRID_ID
+
+ UNION ALL
+
+ select GRID_ID,
+ 0 as userTotal,
+ 0 as issueTotal,
+ 0 as topicTotal,
+ count(id) as shiftProjectTotal,
+ count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
+ 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'
+ and gr.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
+
+
+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.issueTotal,0)) AS issueTotal,
+ SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
+ SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
+ SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
+ 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.issueTotal) as issueTotal,
+ sum(total.topicTotal) as topicTotal,
+ sum(total.shiftProjectTotal) as shiftProjectTotal,
+ sum(total.resolvedProjectTotal) as resolvedProjectTotal
+ 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,
+ 0 as issueTotal,
+ 0 as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ 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,
+ count(id) as issueTotal,
+ 0 as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ from esua_epdc_events.epdc_issue
+ where DEL_FLAG=0
+ group by GRID_ID
+
+ UNION ALL
+
+ select GRID_ID,
+ 0 as userTotal,
+ 0 as issueTotal,
+ count(id) as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ from esua_epdc_group.epdc_topic
+ where DEL_FLAG=0
+ group by GRID_ID
+
+ UNION ALL
+
+ select GRID_ID,
+ 0 as userTotal,
+ 0 as issueTotal,
+ 0 as topicTotal,
+ count(id) as shiftProjectTotal,
+ count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
+ 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'
+ and co.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
+ 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.issueTotal,0)) AS issueTotal,
+ SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
+ SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
+ SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
+ 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.issueTotal) as issueTotal,
+ sum(total.topicTotal) as topicTotal,
+ sum(total.shiftProjectTotal) as shiftProjectTotal,
+ sum(total.resolvedProjectTotal) as resolvedProjectTotal
+ 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,
+ 0 as issueTotal,
+ 0 as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ 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,
+ count(id) as issueTotal,
+ 0 as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ from esua_epdc_events.epdc_issue
+ where DEL_FLAG=0
+ group by GRID_ID
+
+ UNION ALL
+
+ select GRID_ID,
+ 0 as userTotal,
+ 0 as issueTotal,
+ count(id) as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ from esua_epdc_group.epdc_topic
+ where DEL_FLAG=0
+ group by GRID_ID
+
+ UNION ALL
+
+ select GRID_ID,
+ 0 as userTotal,
+ 0 as issueTotal,
+ 0 as topicTotal,
+ count(id) as shiftProjectTotal,
+ count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
+ 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'
+ and st.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
+ 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.issueTotal,0)) AS issueTotal,
+ SUM(IFNULL(t.topicTotal,0)) AS topicTotal,
+ SUM(IFNULL(t.shiftProjectTotal,0)) AS shiftProjectTotal,
+ SUM(IFNULL(t.resolvedProjectTotal,0)) AS resolvedProjectTotal
+ 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.issueTotal) as issueTotal,
+ sum(total.topicTotal) as topicTotal,
+ sum(total.shiftProjectTotal) as shiftProjectTotal,
+ sum(total.resolvedProjectTotal) as resolvedProjectTotal
+ 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,
+ 0 as issueTotal,
+ 0 as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ 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,
+ count(id) as issueTotal,
+ 0 as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ from esua_epdc_events.epdc_issue
+ where DEL_FLAG=0
+ group by GRID_ID
+
+ UNION ALL
+
+ select GRID_ID,
+ 0 as userTotal,
+ 0 as issueTotal,
+ count(id) as topicTotal,
+ 0 as shiftProjectTotal,
+ 0 as resolvedProjectTotal
+ from esua_epdc_group.epdc_topic
+ where DEL_FLAG=0
+ group by GRID_ID
+
+ UNION ALL
+
+ select GRID_ID,
+ 0 as userTotal,
+ 0 as issueTotal,
+ 0 as topicTotal,
+ count(id) as shiftProjectTotal,
+ count(ITEM_STATE = 10 OR NULL) as resolvedProjectTotal
+ 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 gr.id as orgId,
@@ -812,384 +957,393 @@
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
+ 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
+ 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
+ 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'
+ and gr.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
+
+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
+ 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 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'
+ and co.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
+ 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'
+ and st.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
+ 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 d.id as orgId,
@@ -1218,6 +1372,9 @@
WHERE d.DEL_FLAG=0
and ed.DEL_FLAG=0
and d.type_key='grid_party'
+ and d.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
group by ed.DEPT_ID,ed.DAILY_TYPE,ed.MEET_TYPE
union all -- 社区
@@ -1262,6 +1419,9 @@ union all -- 社区
and co.DEL_FLAG=0
and ed.DEL_FLAG=0
and co.type_key='community_party'
+ and co.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
group by co.id,ed.DAILY_TYPE,ed.MEET_TYPE
union all
@@ -1291,6 +1451,9 @@ union all -- 社区
WHERE d.DEL_FLAG=0
and ed.DEL_FLAG=0
and d.type_key='community_party'
+ and d.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
group by ed.DEPT_ID,ed.DAILY_TYPE,ed.MEET_TYPE)community
group by community.orgId,community.DAILY_TYPE,community.meetCategoryId
@@ -1338,6 +1501,9 @@ union all -- 街道
and ed.DEL_FLAG=0
and st.DEL_FLAG=0
and st.type_key='street_party'
+ and st.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
group by st.id,ed.DAILY_TYPE,ed.MEET_TYPE
union all
@@ -1368,6 +1534,9 @@ union all -- 街道
WHERE d.DEL_FLAG=0
and ed.DEL_FLAG=0
and d.type_key='street_party'
+ and d.id not in ('1191534129122230274','1191534416067149825','1191535301279203329','1191535501527859202',
+'1191535697380884481','1192004624745586689','1230704850994528257',
+'1201319745506598913','1201687651826360321','1201689212329746433')
group by ed.DEPT_ID,ed.DAILY_TYPE,ed.MEET_TYPE)street
group by street.orgId,street.DAILY_TYPE,street.meetCategoryId