diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml index 89ba03036c..675cce9c31 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectMainDailyDao.xml @@ -395,23 +395,25 @@ LEFT JOIN ( - SELECT - - project.ID AS projectId, - IF(project.project_status = 'closed',period.handled_date,NOW()) AS finishDate - - FROM fact_origin_project_main_daily project LEFT JOIN fact_origin_project_org_period_daily period - ON project.ID = period.project_id AND period.del_flag = '0' AND period.customer_id = #{customerId} - AND period.operation = 'close' - WHERE project.customer_id = #{customerId} AND project.del_flag = '0' - ) projectFinishDate ON projectFinishDate.projectId = period.project_id - - WHERE - period.del_flag = '0' + SELECT + project.ID AS projectId, + IFNULL(period.handled_date,NOW()) AS finishDate + FROM + fact_origin_project_main_daily project + LEFT JOIN fact_origin_project_org_period_daily period ON project.ID = period.project_id + AND period.del_flag = '0' AND period.customer_id = #{customerId} - AND TIMESTAMPDIFF( DAY, period.informed_date, projectFinishDate.finishDate) > #{thresholdValue} - ) + AND period.operation = 'close' + WHERE + project.customer_id = #{customerId} + AND project.del_flag = '0' + ) projectFinishDate ON projectFinishDate.projectId = period.project_id + WHERE + period.del_flag = '0' + AND period.customer_id = #{customerId} + AND TIMESTAMPDIFF( DAY, period.informed_date, IFNULL(period.handled_date,projectFinishDate.finishDate)) > #{thresholdValue} + )