diff --git a/common/src/main/resources/mapper/ReportDataMapper.xml b/common/src/main/resources/mapper/ReportDataMapper.xml index d79e2ece..53768bf4 100644 --- a/common/src/main/resources/mapper/ReportDataMapper.xml +++ b/common/src/main/resources/mapper/ReportDataMapper.xml @@ -69,12 +69,12 @@ FROM RESRCE R LEFT JOIN WORK_CENTER_MEMBER WCMA ON WCMA.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE LEFT JOIN WORK_CENTER WCA ON WCA.HANDLE = WCMA.WORK_CENTER_BO - LEFT JOIN WORK_CENTER_T WCTA ON WCTA.WORK_CENTER_BO = WCA.HANDLE AND WCTA.LOCALE = 'zh' + INNER JOIN WORK_CENTER_T WCTA ON WCTA.WORK_CENTER_BO = WCA.HANDLE AND WCTA.LOCALE = 'zh' LEFT JOIN WORK_CENTER_MEMBER WCMB ON WCMB.WORK_CENTER_OR_RESOURCE_GBO = WCMA.WORK_CENTER_BO LEFT JOIN WORK_CENTER WCB ON WCB.HANDLE = WCMB.WORK_CENTER_BO - LEFT JOIN WORK_CENTER_T WCTB ON WCTB.WORK_CENTER_BO = WCB.HANDLE AND WCTB.LOCALE = 'zh' + INNER JOIN WORK_CENTER_T WCTB ON WCTB.WORK_CENTER_BO = WCB.HANDLE AND WCTB.LOCALE = 'zh' LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = R.HANDLE AND CF."ATTRIBUTE" = 'CAPACITY_MAN_HOUR' - LEFT JOIN Z_REPORT_DATE_TIME ON 1=1 + LEFT JOIN Z_REPORT_DATE_TIME ZRDT ON ZRDT.SITE = R.SITE LEFT JOIN RESOURCE_TYPE_RESOURCE RTR ON RTR.RESOURCE_BO = R.HANDLE LEFT JOIN RESOURCE_TYPE RT ON RT.HANDLE = RTR.RESOURCE_TYPE_BO WHERE R.SITE = #{site} @@ -180,12 +180,12 @@ FROM RESRCE R LEFT JOIN WORK_CENTER_MEMBER WCMA ON WCMA.WORK_CENTER_OR_RESOURCE_GBO = R.HANDLE LEFT JOIN WORK_CENTER WCA ON WCA.HANDLE = WCMA.WORK_CENTER_BO - LEFT JOIN WORK_CENTER_T WCTA ON WCTA.WORK_CENTER_BO = WCA.HANDLE AND WCTA.LOCALE = 'zh' + INNER JOIN WORK_CENTER_T WCTA ON WCTA.WORK_CENTER_BO = WCA.HANDLE AND WCTA.LOCALE = 'zh' LEFT JOIN WORK_CENTER_MEMBER WCMB ON WCMB.WORK_CENTER_OR_RESOURCE_GBO = WCMA.WORK_CENTER_BO LEFT JOIN WORK_CENTER WCB ON WCB.HANDLE = WCMB.WORK_CENTER_BO - LEFT JOIN WORK_CENTER_T WCTB ON WCTB.WORK_CENTER_BO = WCB.HANDLE AND WCTB.LOCALE = 'zh' + INNER JOIN WORK_CENTER_T WCTB ON WCTB.WORK_CENTER_BO = WCB.HANDLE AND WCTB.LOCALE = 'zh' LEFT JOIN CUSTOM_FIELDS CF ON CF.HANDLE = R.HANDLE AND CF."ATTRIBUTE" = 'CAPACITY_MAN_HOUR' - LEFT JOIN Z_REPORT_DATE_TIME ON 1=1 + LEFT JOIN Z_REPORT_DATE_TIME ZRDT ON ZRDT.SITE = R.SITE LEFT JOIN RESOURCE_TYPE_RESOURCE RTR ON RTR.RESOURCE_BO = R.HANDLE LEFT JOIN RESOURCE_TYPE RT ON RT.HANDLE = RTR.RESOURCE_TYPE_BO WHERE R.SITE = #{site} @@ -198,7 +198,7 @@ SELECT M.*,M.RATE_DATA_INT || '%' RATE_DATA FROM ( SELECT T.SITE,T.RESOURCE_TYPE, T.RESOURCE_TYPE_DESCRIPTION, T.WORK_CENTER, T.WORK_CENTER_DESCRIPTION,T.DATE_TIME, ROUND(SUM(T.PLAN_HOUR) * SUM(T.CAPACITY_MAN_HOUR) / 8 ,4) PLAN_HOUR, SUM(T.CAPACITY_MAN_HOUR) CAPACITY_MAN_HOUR, - CASE WHEN SUM(T.PLAN_HOUR) = 0 THEN 0 ELSE ROUND(SUM(T.PLAN_HOUR)/8,4)*100 END RATE_DATA_INT + CASE WHEN SUM(T.PLAN_HOUR) = 0 OR SUM(T.CAPACITY_MAN_HOUR) = 0 THEN 0 ELSE ROUND(SUM(T.PLAN_HOUR)/8,4)*100 END RATE_DATA_INT FROM ( SELECT RDT.* , SUM( (DECODE(A.CNT,NULL,0,A.CNT) + DECODE(B.CNT,NULL,0,B.CNT) + DECODE(C.CNT,NULL,0,C.CNT) + DECODE(D.CNT,NULL,0,D.CNT)