Browse Source

先进支部排行sql修改

feature/screenDataPush
songyunpeng 5 years ago
parent
commit
7825de19df
  1. 36
      esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/ScreenPublicDataDao.xml

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

@ -1515,9 +1515,9 @@ select gr.id as orgId,
EVENT_ID
)t
) projectTotal,
(select count(*) itemCloseTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 ) itemCloseTotal,
(select count(*) itemSatisfiedTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 ) itemSatisfiedTotal,
(select count(*) itemVeryTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 ) itemVeryTotal
(select count(*) itemCloseTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 GROUP BY `EVENT_ID`) itemCloseTotal,
(select count(*) itemSatisfiedTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 GROUP BY `EVENT_ID`) itemSatisfiedTotal,
(select count(*) itemVeryTotal from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 GROUP BY `EVENT_ID`) itemVeryTotal
from esua_epdc_admin.sys_dept sd
where sd.DEL_FLAG = '0'
AND sd.id IS NOT NULL
@ -1633,24 +1633,24 @@ select gr.id as orgId,
) itemCount on itemCount.DEPT_ID = sd.ID
left join (
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.GRID_ID ) itemgrid
(select GRID_ID,count(itemNum)itemNum FROM ( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.GRID_ID ) itemgrid
(select GRID_ID,count(itemNum)itemNum FROM( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
left join (
select sum(itemgrid.itemNum) itemNum ,d2.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.GRID_ID ) itemgrid
(select GRID_ID,count(itemNum)itemNum FROM( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID
left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID
group by d2.PID
@ -1764,20 +1764,20 @@ select gr.id as orgId,
) itemCount on itemCount.DEPT_ID = sd.ID
left join (
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.GRID_ID ) itemgrid
( SELECT GRID_ID,count(itemNum)itemNum from ( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.GRID_ID ) itemgrid
( SELECT GRID_ID,count(itemNum)itemNum from( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
left join (
select sum(itemgrid.itemNum) itemNum ,d1.PID DEPT_ID from
( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.GRID_ID ) itemgrid
( SELECT GRID_ID,count(itemNum)itemNum from( select item.GRID_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0'
and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.`EVENT_ID` ,item.GRID_ID )a GROUP BY a.GRID_ID) itemgrid
left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID
) itemVeryCount on itemVeryCount.DEPT_ID = sd.ID
where sd.DEL_FLAG = '0'
@ -1859,9 +1859,9 @@ select gr.id as orgId,
GROUP BY
t.GRID_ID
) itemCount on itemCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.GRID_ID) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.GRID_ID) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
left join (select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.GRID_ID) itemVeryCount on itemVeryCount.DEPT_ID = sd.ID
left join (select DEPT_ID, COUNT(itemNum)itemNum from((select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.ITEM_STATE = 10 group by item.`EVENT_ID` ,item.GRID_ID))a group by a.`DEPT_ID` ) itemCloseCount on itemCloseCount.DEPT_ID = sd.ID
left join (select DEPT_ID, COUNT(itemNum)itemNum from((select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 1 group by item.`EVENT_ID` ,item.GRID_ID))a group by a.`DEPT_ID` ) itemSatisfiedCount on itemSatisfiedCount.DEPT_ID = sd.ID
left join (select DEPT_ID, COUNT(itemNum)itemNum from((select item.GRID_ID DEPT_ID ,count(*) itemNum from esua_epdc_events.epdc_item item where item.DEL_FLAG = '0' and date_format(item.CREATED_TIME, '%Y-%m' ) = #{yearMonth} and item.EVALUATION_SCORE = 2 group by item.`EVENT_ID` ,item.GRID_ID))a group by a.`DEPT_ID` ) itemVeryCount on itemVeryCount.DEPT_ID = sd.ID
where sd.DEL_FLAG = '0'
AND sd.id IS NOT NULL
AND sd.`id` NOT IN( SELECT t.`dept_id`

Loading…
Cancel
Save