|
|
@ -949,38 +949,56 @@ |
|
|
|
</select> |
|
|
|
<select id="selectAgencyClosedProjectCount" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO"> |
|
|
|
SELECT |
|
|
|
AGENCY_ID, |
|
|
|
COUNT(ID) AS "sum" |
|
|
|
FROM fact_origin_project_main_daily |
|
|
|
WHERE CUSTOMER_ID = #{customerId} |
|
|
|
AND DATE_ID <= #{dateId} |
|
|
|
AND PROJECT_STATUS = 'closed' |
|
|
|
a.ID AS AGENCY_ID, |
|
|
|
COUNT( b.ID ) AS "sum" |
|
|
|
FROM |
|
|
|
dim_agency a |
|
|
|
INNER JOIN fact_origin_project_main_daily b ON b.PIDS LIKE CONCAT( '%', a.ID, '%' ) |
|
|
|
AND b.CUSTOMER_ID = #{customerId} |
|
|
|
AND b.DATE_ID <= #{dateId} |
|
|
|
AND PROJECT_STATUS = 'closed' |
|
|
|
<if test='null != origin and "" != origin'> |
|
|
|
AND ORIGIN = #{origin} |
|
|
|
AND b.ORIGIN = #{origin} |
|
|
|
</if> |
|
|
|
<if test='null != closedStatus and "" != closedStatus'> |
|
|
|
AND IS_RESOLVED = #{closedStatus} |
|
|
|
AND b.IS_RESOLVED = #{closedStatus} |
|
|
|
</if> |
|
|
|
GROUP BY AGENCY_ID |
|
|
|
WHERE |
|
|
|
a.CUSTOMER_ID = #{customerId} |
|
|
|
GROUP BY |
|
|
|
a.ID |
|
|
|
</select> |
|
|
|
<select id="selectAgencyClosedProjectStaticDaily" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO"> |
|
|
|
SELECT |
|
|
|
a.AGENCY_ID, |
|
|
|
c.`LEVEL`, |
|
|
|
COUNT(a.ID) AS "sum", |
|
|
|
SUM(IF(b.ORG_TYPE = 'department', 1, 0)) AS "count" |
|
|
|
a.ID AS AGENCY_ID, |
|
|
|
b.`LEVEL`, |
|
|
|
COUNT( b.ID ) AS "sum", |
|
|
|
SUM( |
|
|
|
IF |
|
|
|
( b.ORG_TYPE = 'department', 1, 0 )) AS "count" |
|
|
|
FROM |
|
|
|
fact_origin_project_main_daily a |
|
|
|
INNER JOIN fact_origin_project_log_daily b ON a.ID = b.PROJECT_ID |
|
|
|
AND b.ACTION_CODE = 'close' |
|
|
|
INNER JOIN dim_agency c ON b.AGENCY_ID = c.ID |
|
|
|
dim_agency a |
|
|
|
INNER JOIN ( |
|
|
|
SELECT |
|
|
|
a.ID, |
|
|
|
a.PIDS, |
|
|
|
c.`LEVEL`, |
|
|
|
b.ORG_TYPE |
|
|
|
FROM |
|
|
|
fact_origin_project_main_daily a |
|
|
|
INNER JOIN fact_origin_project_log_daily b ON a.ID = b.PROJECT_ID |
|
|
|
AND b.ACTION_CODE = 'close' |
|
|
|
INNER JOIN dim_agency c ON b.AGENCY_ID = c.ID |
|
|
|
WHERE |
|
|
|
a.CUSTOMER_ID = #{customerId} |
|
|
|
AND a.DATE_ID <= #{dateId} |
|
|
|
AND a.PROJECT_STATUS = 'closed' |
|
|
|
a.CUSTOMER_ID = #{customerId} |
|
|
|
AND a.DATE_ID <= #{dateId} |
|
|
|
AND a.PROJECT_STATUS = 'closed' |
|
|
|
) b ON b.PIDS LIKE CONCAT( '%', a.ID, '%' ) |
|
|
|
WHERE |
|
|
|
a.CUSTOMER_ID = #{customerId} |
|
|
|
GROUP BY |
|
|
|
a.AGENCY_ID, |
|
|
|
c.`LEVEL` |
|
|
|
a.ID, |
|
|
|
b.`LEVEL` |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|