From 7825de19dfef637524696959a3d2c5de762f545f Mon Sep 17 00:00:00 2001 From: songyunpeng Date: Sat, 8 May 2021 17:28:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=88=E8=BF=9B=E6=94=AF=E9=83=A8=E6=8E=92?= =?UTF-8?q?=E8=A1=8Csql=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/screen/ScreenPublicDataDao.xml | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/ScreenPublicDataDao.xml b/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/ScreenPublicDataDao.xml index 70ab3864..37205215 100644 --- a/esua-epdc/epdc-module/epdc-analysis/epdc-analysis-server/src/main/resources/mapper/screen/ScreenPublicDataDao.xml +++ b/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 @@ -1631,26 +1631,26 @@ select gr.id as orgId, left join esua_epdc_admin.sys_dept d2 on d1.PID = d2.ID group by d2.PID ) itemCount on itemCount.DEPT_ID = sd.ID - left join ( + 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 @@ -1762,22 +1762,22 @@ select gr.id as orgId, left join esua_epdc_admin.sys_dept d1 on d1.ID = itemgrid.GRID_ID group by d1.PID ) itemCount on itemCount.DEPT_ID = sd.ID - left join ( + 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`