Commit fe422318 authored by KeYong's avatar KeYong

消防系统状态与告警表关系优化

parent 63b482ee
......@@ -123,4 +123,12 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object >> getAllTypeEquipStatistic(@Param("bizOrgCode") String bizOrgCode, @Param("list") List<String> list);
List<Map<String, Object>> fireCannonValve(@Param("bizOrgCode") String bizOrgCode);
Page<Map<String, Object>> alarmListNew(@Param("page") Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode,
@Param("systemCode") String systemCode, @Param("systemType") String systemType, @Param("types") List<String> types,
@Param("emergencyLevels") List<String> emergencyLevels, @Param("name") String name,
@Param("cleanStatus") Integer cleanStatus, @Param("handleStatus") Integer handleStatus,
@Param("createDate") String createDate , @Param("startDate") String startDate ,
@Param("endDate") String endDate, @Param("sortField") String sortField, @Param("sortOrder") String sortOrder);
}
......@@ -647,7 +647,7 @@ public class EmergencyServiceImpl implements IEmergencyService {
List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus,
Integer handleStatus,String createDate,String startDate,String endDate,
String sortField,String sortOrder) {
return emergencyMapper.alarmList(page, bizOrgCode, systemCode, systemType, types, emergencyLevels, name, cleanStatus,
return emergencyMapper.alarmListNew(page, bizOrgCode, systemCode, systemType, types, emergencyLevels, name, cleanStatus,
handleStatus, createDate, startDate, endDate, sortField, sortOrder);
}
......
......@@ -1499,6 +1499,100 @@
</if>
</select>
<select id="alarmListNew" resultType="java.util.Map">
SELECT
wlesa.id,
wlesa.biz_org_name AS bizOrgName,
concat( wlesa.equipment_specific_name, wlesa.equipment_specific_index_name ) AS alamContent,
IF
( wlesa.recovery_date IS NULL, '未确认', '已确认' ) handleStatus,
IF
( wlesa.`status` = 0, '已消除', '未消除' ) cleanStatus,
wlesa.equipment_index_id AS fireEquipmentIndexId,
fs.CODE AS systemCode,
wlesa.equipment_specific_index_key AS fireEquipmentSpecificIndexKey,
wlesa.equipment_specific_index_name AS fireEquipmentSpecificIndexName,
wlesa.emergency_level_color AS emergencyLevelColor,
CASE
wlesa.equipment_specific_index_value
WHEN 'true' THEN
'是'
WHEN 'false' THEN
'否' ELSE wlesa.equipment_specific_index_value
END AS fireEquipmentPointValue,
wlesa.type AS typeCode,
( SELECT type_name FROM wl_signal_classify sc WHERE sc.type_code = wlesa.type LIMIT 1 ) AS type,
wlesa.equipment_specific_name AS equipmentSpecificName,
wlesa.location,
date_format( wlesa.create_date, '%Y-%m-%d %H:%i:%s' ) createDate,
wlesa.emergency_level_describe AS emergencyLevelDescribe,
fs.NAME AS systemName
FROM
wl_equipment_specific_alarm wlesa
LEFT JOIN wl_equipment_specific wes ON wes.id = wlesa.equipment_specific_id
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET(fs.id, wlesa.system_ids)
<where>
fs.system_type_code IS NOT NULL
<if test="bizOrgCode != null and bizOrgCode != ''">
and wlesa.biz_org_code like concat(#{bizOrgCode},'%')
</if>
<if test='createDate != null and createDate == "1"'>
AND wlesa.create_date LIKE CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d' ), '%' )
</if>
<if test="startDate != null and startDate != ''">
AND wlesa.create_date >= DATE_FORMAT( #{startDate}, '%Y-%m-%d %H:%i:%s' )
</if>
<if test="endDate != null and endDate != ''">
AND DATE_FORMAT( #{endDate}, '%Y-%m-%d %H:%i:%s' ) >= wlesal.create_date
</if>
<if test="systemCode != null and systemCode != ''">
and fs.code = #{systemCode}
</if>
<if test="systemType != null and systemType != ''">
and fs.system_type = #{systemType}
</if>
<if test="name != null and name != ''">
and wlesa.equipment_specific_name like concat('%', #{name},'%')
</if>
<if test="cleanStatus != null and cleanStatus != '' and cleanStatus == 2">
and wlesa.status = 1
</if>
<if test="cleanStatus != null and cleanStatus != '' and cleanStatus == 1">
and wlesa.status = 0
</if>
<if test="handleStatus != null and handleStatus != '' and handleStatus == 2">
and wlesa.recovery_date IS NULL
</if>
<if test="handleStatus != null and handleStatus != '' and handleStatus == 1">
and wlesa.recovery_date IS NOT NULL
</if>
<if test="types != null">
<foreach collection="types" index="index" item="item" open="and (" separator=" OR " close=")">
wlesa.type = #{item}
</foreach>
</if>
<if test="emergencyLevels != null">
<foreach collection="emergencyLevels" index="index" item="item" open="and (" separator=" OR " close=")">
wlesa.emergency_level = #{item}
</foreach>
</if>
</where>
ORDER BY
<if test="sortField != null and sortField != ''">
<choose>
<when test="sortOrder == 'ascend'">
@SORT_FIELD ASC
</when>
<otherwise>
@SORT_FIELD DESC
</otherwise>
</choose>
</if>
<if test="sortField == null or sortField == ''">
wlesa.create_date DESC
</if>
</select>
<select id="alarmListNoPage" resultType="java.util.Map">
SELECT
wlesal.id,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment