Browse Source

[大屏数据采集 - 党建情况] - 接口sql修改 魏凯 2021-02-25

feature/syp_points
weikai 5 years ago
parent
commit
c2d5c639dc
  1. 166
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/ScreenPublicDataDao.xml

166
esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/ScreenPublicDataDao.xml

@ -119,16 +119,16 @@
UNION ALL
select GRID_ID,
select DEPT_ID as GRID_ID,
0 as userTotal,
0 AS partyTotal,
count(id) as groupTotal,
0 as issueTotal,
0 as topicTotal,
0 as projectTotal, 0 as companyTotal
from esua_epdc_group.epdc_group
from esua_epdc_party_group.epdc_party_group
where DEL_FLAG=0 and STATE=10
group by GRID_ID
group by DEPT_ID
union all
@ -163,7 +163,7 @@
0 as issueTotal,
count(id) as topicTotal,
0 as projectTotal, 0 as companyTotal
from esua_epdc_group.epdc_topic
from esua_epdc_party_group.epdc_party_topic
where DEL_FLAG=0
group by GRID_ID
@ -251,16 +251,16 @@ UNION ALL
UNION ALL
select GRID_ID,
select DEPT_ID as GRID_ID,
0 as userTotal,
0 AS partyTotal,
count(id) as groupTotal,
0 as issueTotal,
0 as topicTotal,
0 as projectTotal, 0 as companyTotal
from esua_epdc_group.epdc_group
from esua_epdc_party_group.epdc_party_group
where DEL_FLAG=0 and STATE=10
group by GRID_ID
group by DEPT_ID
union all
@ -295,7 +295,7 @@ UNION ALL
0 as issueTotal,
count(id) as topicTotal,
0 as projectTotal, 0 as companyTotal
from esua_epdc_group.epdc_topic
from esua_epdc_party_group.epdc_party_topic
where DEL_FLAG=0
group by GRID_ID
@ -385,16 +385,16 @@ union all
UNION ALL
select GRID_ID,
select DEPT_ID as GRID_ID,
0 as userTotal,
0 AS partyTotal,
count(id) as groupTotal,
0 as issueTotal,
0 as topicTotal,
0 as projectTotal, 0 as companyTotal
from esua_epdc_group.epdc_group
from esua_epdc_party_group.epdc_party_group
where DEL_FLAG=0 and STATE=10
group by GRID_ID
group by DEPT_ID
union all
@ -429,7 +429,7 @@ union all
0 as issueTotal,
count(id) as topicTotal,
0 as projectTotal, 0 as companyTotal
from esua_epdc_group.epdc_topic
from esua_epdc_party_group.epdc_party_topic
where DEL_FLAG=0
group by GRID_ID
@ -521,16 +521,16 @@ union all
UNION ALL
select GRID_ID,
select DEPT_ID as GRID_ID,
0 as userTotal,
0 AS partyTotal,
count(id) as groupTotal,
0 as issueTotal,
0 as topicTotal,
0 as projectTotal, 0 as companyTotal
from esua_epdc_group.epdc_group
from esua_epdc_party_group.epdc_party_group
where DEL_FLAG=0 and STATE=10
group by GRID_ID
group by DEPT_ID
union all
@ -565,7 +565,7 @@ union all
0 as issueTotal,
count(id) as topicTotal,
0 as projectTotal, 0 as companyTotal
from esua_epdc_group.epdc_topic
from esua_epdc_party_group.epdc_party_topic
where DEL_FLAG=0
group by GRID_ID
@ -602,7 +602,6 @@ union all
WHERE t.`del_flag`= 0)
and city.type_key='district_party' and city.party_code='shibei'
GROUP BY city.id
</select>
<!-- 001 -->
<select id="cpcbasedata" resultType="com.elink.esua.epdc.dto.screen.result.CpcbasedataResultDTO">
@ -1327,17 +1326,17 @@ select gr.id as orgId,
gr.area_code AS areaCode
from esua_epdc_admin.sys_dept gr
left join
(select eg.GRID_ID,
(select eg.DEPT_ID as 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,
from esua_epdc_party_group.epdc_party_group eg
left join (select PARTY_GROUP_ID,
count(STATE = 10 OR NULL) AS userCount
from esua_epdc_group.epdc_user_group eu
from esua_epdc_party_group.epdc_party_user_group eu
where eu.DEL_FLAG=0
group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
group by PARTY_GROUP_ID)group_user on group_user.PARTY_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
group by eg.DEPT_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0
AND gr.`id` NOT IN( SELECT t.`dept_id`
FROM `esua_epdc_admin`.`sys_dept_config` t
@ -1357,17 +1356,17 @@ select gr.id as orgId,
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,
(select eg.DEPT_ID as 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,
from esua_epdc_party_group.epdc_party_group eg
left join (select PARTY_GROUP_ID,
count(STATE = 10 OR NULL) AS userCount
from esua_epdc_group.epdc_user_group eu
from esua_epdc_party_group.epdc_party_user_group eu
where eu.DEL_FLAG=0
group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
group by PARTY_GROUP_ID)group_user on group_user.PARTY_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
group by eg.DEPT_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0
and co.del_flag=0
AND co.`id` NOT IN( SELECT t.`dept_id`
@ -1390,17 +1389,17 @@ select gr.id as orgId,
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,
(select eg.DEPT_ID as 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,
from esua_epdc_party_group.epdc_party_group eg
left join (select PARTY_GROUP_ID,
count(STATE = 10 OR NULL) AS userCount
from esua_epdc_group.epdc_user_group eu
from esua_epdc_party_group.epdc_party_user_group eu
where eu.DEL_FLAG=0
group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
group by PARTY_GROUP_ID)group_user on group_user.PARTY_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
group by eg.DEPT_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0
and co.del_flag=0
and st.del_flag=0
@ -1422,17 +1421,17 @@ select gr.id as orgId,
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,
(select eg.DEPT_ID as 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,
from esua_epdc_party_group.epdc_party_group eg
left join (select PARTY_GROUP_ID,
count(STATE = 10 OR NULL) AS userCount
from esua_epdc_group.epdc_user_group eu
from esua_epdc_party_group.epdc_party_user_group eu
where eu.DEL_FLAG=0
group by GROUP_ID)group_user on group_user.GROUP_ID = eg.id
group by PARTY_GROUP_ID)group_user on group_user.PARTY_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
group by eg.DEPT_ID)dg on dg.GRID_ID=gr.id
where gr.del_flag=0
and co.del_flag=0
and st.del_flag=0
@ -1477,10 +1476,10 @@ select gr.id as orgId,
(
select
count(*) groupTotal
from esua_epdc_group.epdc_group ws
from esua_epdc_party_group.epdc_party_group ws
where ws.DEL_FLAG = '0' and date_format(ws.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ),'%Y-%m' )
) groupTotal,
(select count(*) topicTotal from esua_epdc_group.epdc_topic top where top.DEL_FLAG = '0' and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) ) topicTotal,
(select count(*) topicTotal from esua_epdc_party_group.epdc_party_topic top where top.DEL_FLAG = '0' and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) ) topicTotal,
(
SELECT
count( t.a ) issueTotal
@ -1554,11 +1553,11 @@ select gr.id as orgId,
from (
SELECT
sum( info.STATE = 10 ) as num,
info.GRID_ID
info.DEPT_ID as GRID_ID
FROM
esua_epdc_group.epdc_group info
esua_epdc_party_group.epdc_party_group info
GROUP BY
info.GRID_ID
info.DEPT_ID
) daily
left join esua_epdc_admin.sys_dept dept on dept.id = daily.GRID_ID
left join esua_epdc_admin.sys_dept dept2 on dept2.id = dept.PID
@ -1568,7 +1567,7 @@ select gr.id as orgId,
) tto on tto.DEPT_ID = sd.ID
left join (
select sum(topn.topNum) topNum ,d2.PID DEPT_ID from
( select top.GRID_ID ,count(*) topNum from esua_epdc_group.epdc_topic top where top.DEL_FLAG = '0'
( select top.GRID_ID ,count(*) topNum from esua_epdc_party_group.epdc_party_topic top where top.DEL_FLAG = '0'
and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) group by top.GRID_ID ) topn
left join esua_epdc_admin.sys_dept d1 on d1.ID = topn.GRID_ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
@ -1687,11 +1686,11 @@ select gr.id as orgId,
from (
SELECT
sum( info.STATE = 10 ) as num,
info.GRID_ID
info.DEPT_ID as GRID_ID
FROM
esua_epdc_group.epdc_group info
esua_epdc_party_group.epdc_party_group info
GROUP BY
info.GRID_ID
info.DEPT_ID
) daily
left join esua_epdc_admin.sys_dept dept on dept.id = daily.GRID_ID
left join esua_epdc_admin.sys_dept parent on parent.id = dept.PID and parent.type_key= 'community_party'
@ -1700,7 +1699,7 @@ select gr.id as orgId,
) tto on tto.DEPT_ID = sd.ID
left join (
select sum(topn.topNum) topNum ,d1.PID DEPT_ID from
( select top.GRID_ID ,count(*) topNum from esua_epdc_group.epdc_topic top where top.DEL_FLAG = '0'
( select top.GRID_ID ,count(*) topNum from esua_epdc_party_group.epdc_party_topic top where top.DEL_FLAG = '0'
and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) group by top.GRID_ID ) topn
left join esua_epdc_admin.sys_dept d1 on d1.ID = topn.GRID_ID group by d1.PID
) topCount on topCount.DEPT_ID = sd.ID
@ -1805,12 +1804,12 @@ select gr.id as orgId,
left join (
select
count(*) as TIMES_TOTAL,
ws.GRID_ID as DEPT_ID
from esua_epdc_group.epdc_group ws
ws.DEPT_ID as DEPT_ID
from esua_epdc_party_group.epdc_party_group ws
where ws.DEL_FLAG = '0' and date_format(ws.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ),'%Y-%m' )
GROUP BY ws.GRID_ID
GROUP BY ws.DEPT_ID
) tto on tto.DEPT_ID = sd.ID
left join (select top.GRID_ID DEPT_ID ,count(*) topNum from esua_epdc_group.epdc_topic top where top.DEL_FLAG = '0' and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) group by top.GRID_ID) topCount on topCount.DEPT_ID = sd.ID
left join (select top.GRID_ID DEPT_ID ,count(*) topNum from esua_epdc_party_group.epdc_party_topic top where top.DEL_FLAG = '0' and date_format(top.CREATED_TIME, '%Y-%m' ) = date_format(date_add( now( ), INTERVAL - 1 DAY ), '%Y-%m' ) group by top.GRID_ID) topCount on topCount.DEPT_ID = sd.ID
left join (
SELECT
count( t.a ) issueNum,
@ -2001,7 +2000,12 @@ select gr.id as orgId,
count( behavior.GROUP_OPPOSE_FLAG = 1 OR NULL ) AS groupOpposeFlag,
count( behavior.GROUP_JOIN_FLAG = 1 OR NULL ) AS groupJoinFlag,
count( behavior.GROUP_COMMENT_FLAG = 1 OR NULL ) AS groupCommentFlag,
count( behavior.GROUP_CREATE_FLAG = 1 OR NULL ) groupCreateFlag
( SELECT
count( * )
FROM
esua_epdc_party_group.epdc_party_group
WHERE del_flag = 0
) groupCreateFlag
FROM
esua_epdc_analysis.epdc_user_behavior_log behavior
LEFT JOIN esua_epdc_user.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
@ -2093,7 +2097,11 @@ select gr.id as orgId,
count( behavior.GROUP_OPPOSE_FLAG = 1 OR NULL ) AS groupOpposeFlag,
count( behavior.GROUP_JOIN_FLAG = 1 OR NULL ) AS groupJoinFlag,
count( behavior.GROUP_COMMENT_FLAG = 1 OR NULL ) AS groupCommentFlag,
count( behavior.GROUP_CREATE_FLAG = 1 OR NULL ) groupCreateFlag
( SELECT
count( * )
FROM
esua_epdc_party_group.epdc_party_group
WHERE del_flag = 0 ) groupCreateFlag
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
LEFT JOIN esua_epdc_user.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
WHERE behavior.USER_ID in ( select meu.ID from esua_epdc_user.epdc_user meu )
@ -2175,7 +2183,11 @@ select gr.id as orgId,
count( behavior.GROUP_OPPOSE_FLAG = 1 OR NULL ) AS groupOpposeFlag,
count( behavior.GROUP_JOIN_FLAG = 1 OR NULL ) AS groupJoinFlag,
count( behavior.GROUP_COMMENT_FLAG = 1 OR NULL ) AS groupCommentFlag,
count( behavior.GROUP_CREATE_FLAG = 1 OR NULL ) groupCreateFlag
(SELECT
count( * )
FROM
esua_epdc_party_group.epdc_party_group
WHERE del_flag = 0 ) groupCreateFlag
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
LEFT JOIN esua_epdc_user.epdc_user USER ON USER.ID = behavior.USER_ID AND USER.DEL_FLAG = '0'
WHERE behavior.USER_ID in ( select meu.ID from esua_epdc_user.epdc_user meu )
@ -2247,7 +2259,11 @@ select gr.id as orgId,
count( behavior.GROUP_OPPOSE_FLAG = 1 OR NULL ) AS groupOpposeFlag,
count( behavior.GROUP_JOIN_FLAG = 1 OR NULL ) AS groupJoinFlag,
count( behavior.GROUP_COMMENT_FLAG = 1 OR NULL ) AS groupCommentFlag,
count( behavior.GROUP_CREATE_FLAG = 1 OR NULL ) groupCreateFlag
( SELECT
count( * )
FROM
esua_epdc_party_group.epdc_party_group
WHERE del_flag = 0 ) groupCreateFlag
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
LEFT JOIN esua_epdc_user.epdc_user USER ON USER.ID = behavior.USER_ID
AND USER.DEL_FLAG = '0'
@ -2338,7 +2354,11 @@ SELECT gr.id as orgId,
SUM( behavior.GROUP_OPPOSE_FLAG = 1 ) AS groupOpposeFlag,
SUM( behavior.GROUP_JOIN_FLAG = 1 ) AS groupJoinFlag,
SUM( behavior.GROUP_COMMENT_FLAG = 1 ) AS groupCommentFlag,
SUM( behavior.GROUP_CREATE_FLAG = 1 ) groupCreateFlag
( SELECT
count( * )
FROM
esua_epdc_party_group.epdc_party_group
WHERE del_flag = 0 ) groupCreateFlag
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
GROUP BY USER_ID
) behaviorCount
@ -2379,7 +2399,7 @@ SELECT gr.id as orgId,
0 as issueTotal,
count(id) as topicTotal,
0 as projectTotal
from esua_epdc_group.epdc_topic
from esua_epdc_party_group.epdc_party_topic
where DEL_FLAG=0
group by GRID_ID
@ -2477,7 +2497,11 @@ UNION ALL
SUM( behavior.GROUP_OPPOSE_FLAG = 1 ) AS groupOpposeFlag,
SUM( behavior.GROUP_JOIN_FLAG = 1 ) AS groupJoinFlag,
SUM( behavior.GROUP_COMMENT_FLAG = 1 ) AS groupCommentFlag,
SUM( behavior.GROUP_CREATE_FLAG = 1 ) groupCreateFlag
( SELECT
count( * )
FROM
esua_epdc_party_group.epdc_party_group
WHERE del_flag = 0 ) groupCreateFlag
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
GROUP BY USER_ID
) behaviorCount
@ -2517,7 +2541,7 @@ UNION ALL
0 as issueTotal,
count(id) as topicTotal,
0 as projectTotal
from esua_epdc_group.epdc_topic
from esua_epdc_party_group.epdc_party_topic
where DEL_FLAG=0
group by GRID_ID
@ -2618,7 +2642,11 @@ union all
SUM( behavior.GROUP_OPPOSE_FLAG = 1 ) AS groupOpposeFlag,
SUM( behavior.GROUP_JOIN_FLAG = 1 ) AS groupJoinFlag,
SUM( behavior.GROUP_COMMENT_FLAG = 1 ) AS groupCommentFlag,
SUM( behavior.GROUP_CREATE_FLAG = 1 ) groupCreateFlag
( SELECT
count( * )
FROM
esua_epdc_party_group.epdc_party_group
WHERE del_flag = 0 ) groupCreateFlag
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
GROUP BY USER_ID
) behaviorCount
@ -2658,7 +2686,7 @@ union all
0 as issueTotal,
count(id) as topicTotal,
0 as projectTotal
from esua_epdc_group.epdc_topic
from esua_epdc_party_group.epdc_party_topic
where DEL_FLAG=0
group by GRID_ID
@ -2761,7 +2789,11 @@ union all
SUM( behavior.GROUP_OPPOSE_FLAG = 1 ) AS groupOpposeFlag,
SUM( behavior.GROUP_JOIN_FLAG = 1 ) AS groupJoinFlag,
SUM( behavior.GROUP_COMMENT_FLAG = 1 ) AS groupCommentFlag,
SUM( behavior.GROUP_CREATE_FLAG = 1 ) groupCreateFlag
( SELECT
count( * )
FROM
esua_epdc_party_group.epdc_party_group
WHERE del_flag = 0 ) groupCreateFlag
FROM esua_epdc_analysis.epdc_user_behavior_log behavior
GROUP BY USER_ID
) behaviorCount
@ -2801,7 +2833,7 @@ union all
0 as issueTotal,
count(id) as topicTotal,
0 as projectTotal
from esua_epdc_group.epdc_topic
from esua_epdc_party_group.epdc_party_topic
where DEL_FLAG=0
group by GRID_ID

Loading…
Cancel
Save