|
@ -617,4 +617,87 @@ |
|
|
<select id="selectByEventId" resultType="com.epmet.entity.IcEventEntity"> |
|
|
<select id="selectByEventId" resultType="com.epmet.entity.IcEventEntity"> |
|
|
select e.* from ic_event e where e.id = #{icEventId} |
|
|
select e.* from ic_event e where e.id = #{icEventId} |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
<sql id="eventArguments"> |
|
|
|
|
|
e.ID AS eventId, |
|
|
|
|
|
e.GRID_ID AS gridId, |
|
|
|
|
|
e.SOURCE_TYPE AS sourceType, |
|
|
|
|
|
e.EVENT_TYPE AS eventType, |
|
|
|
|
|
e.LATITUDE, |
|
|
|
|
|
e.LONGITUDE, |
|
|
|
|
|
e.EVENT_CONTENT AS eventContent, |
|
|
|
|
|
r.MANAGE_STATUS AS manageStatus, |
|
|
|
|
|
c.CATEGORY_CODE AS categoryCode |
|
|
|
|
|
</sql> |
|
|
|
|
|
|
|
|
|
|
|
<select id="getListByStatus" resultType="com.epmet.dto.result.IcEventResultDTO"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
<include refid="eventArguments"/> |
|
|
|
|
|
FROM ic_event e |
|
|
|
|
|
LEFT JOIN ic_event_reply r ON r.IC_EVENT_ID = e.ID |
|
|
|
|
|
LEFT JOIN ic_event_category c ON c.IC_EVENT_ID = e.ID |
|
|
|
|
|
<where> |
|
|
|
|
|
e.DEL_FLAG = 0 |
|
|
|
|
|
<if test="null != orgIdPath and orgIdPath != ''"> |
|
|
|
|
|
and e.GRID_PIDS LIKE concat(#{orgIdPath},'%') |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="null != sourceType and sourceType != ''"> |
|
|
|
|
|
AND e.SOURCE_TYPE = #{sourceType} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="null != status and status != ''"> |
|
|
|
|
|
AND r.MANAGE_STATUS = #{status} |
|
|
|
|
|
</if> |
|
|
|
|
|
</where> |
|
|
|
|
|
GROUP BY e.ID,c.ic_event_id,r.ic_event_id |
|
|
|
|
|
ORDER BY r.MANAGE_TIME DESC,e.CREATED_TIME DESC |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="getListBySourceTypeOrEventType" resultType="com.epmet.dto.result.IcEventResultDTO"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
<include refid="eventArguments"/> |
|
|
|
|
|
FROM ic_event e |
|
|
|
|
|
LEFT JOIN ic_event_reply r ON r.IC_EVENT_ID = e.ID |
|
|
|
|
|
LEFT JOIN ic_event_category c ON c.IC_EVENT_ID = e.ID |
|
|
|
|
|
<where> |
|
|
|
|
|
e.DEL_FLAG = 0 |
|
|
|
|
|
<if test="null != orgIdPath and orgIdPath != ''"> |
|
|
|
|
|
AND e.GRID_PIDS LIKE concat(#{orgIdPath},'%') |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="null != eventType and eventType != ''"> |
|
|
|
|
|
AND e.EVENT_TYPE = #{eventType} |
|
|
|
|
|
</if> |
|
|
|
|
|
<if test="null != sourceType and sourceType != ''"> |
|
|
|
|
|
AND e.SOURCE_TYPE = #{sourceType} |
|
|
|
|
|
</if> |
|
|
|
|
|
</where> |
|
|
|
|
|
GROUP BY e.ID,c.ic_event_id,r.ic_event_id |
|
|
|
|
|
ORDER BY r.MANAGE_TIME DESC,e.CREATED_TIME DESC |
|
|
|
|
|
</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 |
|
|
|
|
|
FROM |
|
|
|
|
|
( |
|
|
|
|
|
SELECT count( e.id ) AS total FROM ic_event e |
|
|
|
|
|
LEFT JOIN ic_event_reply r ON r.IC_EVENT_ID = e.ID |
|
|
|
|
|
<where> |
|
|
|
|
|
e.DEL_FLAG = 0 |
|
|
|
|
|
<if test="null != orgId and orgId !=''"> |
|
|
|
|
|
AND e.GRID_ID = #{orgId} |
|
|
|
|
|
</if> |
|
|
|
|
|
</where> |
|
|
|
|
|
) ea, |
|
|
|
|
|
( |
|
|
|
|
|
SELECT count( e.id ) AS total FROM ic_event e |
|
|
|
|
|
LEFT JOIN ic_event_reply r ON r.IC_EVENT_ID = e.ID |
|
|
|
|
|
<where> |
|
|
|
|
|
e.DEL_FLAG = 0 AND r.MANAGE_STATUS = 3 |
|
|
|
|
|
<if test="null != orgId and orgId !=''"> |
|
|
|
|
|
AND e.GRID_ID = #{orgId} |
|
|
|
|
|
</if> |
|
|
|
|
|
</where> |
|
|
|
|
|
) eb |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
</mapper> |
|
|
</mapper> |
|
|