|
|
@ -664,46 +664,21 @@ |
|
|
|
</select> |
|
|
|
<select id="getEventRateByGridIds" resultType="com.epmet.dto.result.GridOrVillageEventRateResultDTO"> |
|
|
|
SELECT |
|
|
|
ea.total AS total, |
|
|
|
eb.total, |
|
|
|
round( eb.total / ea.total, 2 ) AS rate |
|
|
|
count( e.id ) AS total, |
|
|
|
ROUND( sum( CASE WHEN (e.REPLY_STATUS = 2 OR e.REPLY_STATUS = 3 OR e.REPLY_STATUS = 4) THEN 1 ELSE 0 END ) / count( e.id ), 2 ) AS rate |
|
|
|
FROM |
|
|
|
( |
|
|
|
SELECT count( e.id ) AS total, e.id AS id |
|
|
|
FROM ic_event e |
|
|
|
<where> |
|
|
|
e.DEL_FLAG = 0 |
|
|
|
<if test="null != orgId and orgId != ''"> |
|
|
|
<if test="null != orgType and orgType !='' and orgType = 'agency'"> |
|
|
|
AND e.AGENCY_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="null != orgType and orgType !='' and orgType = 'grid'"> |
|
|
|
AND e.GRID_ID = #{orgId} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
) ea, |
|
|
|
( |
|
|
|
SELECT count( r.id ) AS total FROM ic_event_reply r |
|
|
|
<where> |
|
|
|
r.DEL_FLAG = 0 |
|
|
|
AND r.MANAGE_STATUS = 2 OR r.MANAGE_STATUS = 3 OR r.MANAGE_STATUS = 4 |
|
|
|
AND r.IC_EVENT_ID IN ( |
|
|
|
SELECT e.id AS id FROM ic_event e |
|
|
|
<where> |
|
|
|
e.DEL_FLAG = 0 |
|
|
|
<if test="null != orgId and orgId != ''"> |
|
|
|
<if test="null != orgType and orgType !='' and orgType = 'agency'"> |
|
|
|
AND e.AGENCY_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="null != orgType and orgType !='' and orgType = 'grid'"> |
|
|
|
AND e.GRID_ID = #{orgId} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
) |
|
|
|
</where> |
|
|
|
) eb |
|
|
|
ic_event e |
|
|
|
<where> |
|
|
|
e.DEL_FLAG = 0 |
|
|
|
<if test="null != orgId and orgId != ''"> |
|
|
|
<if test="null != orgType and orgType !='' and orgType = 'agency'"> |
|
|
|
AND e.AGENCY_ID = #{orgId} |
|
|
|
</if> |
|
|
|
<if test="null != orgType and orgType !='' and orgType = 'grid'"> |
|
|
|
AND e.GRID_ID = #{orgId} |
|
|
|
</if> |
|
|
|
</if> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
</mapper> |
|
|
|