Commit 271af9fd authored by maoying's avatar maoying

优化报警脚本查询语法

parent 65534e57
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d ) d
<where> <where>
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">and <if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">
d.warehouseStructureName like d.warehouseStructureName like
concat(concat("%",#{param.warehouseStructureName}),"%") concat(concat("%",#{param.warehouseStructureName}),"%")
</if> </if>
...@@ -270,7 +270,7 @@ ...@@ -270,7 +270,7 @@
left join wl_equipment_specific wles ON wlesa.equipment_specific_id = wles.id left join wl_equipment_specific wles ON wlesa.equipment_specific_id = wles.id
) d ) d
<where> <where>
<if test="warehouseStructureName != null and warehouseStructureName != ''">and d.warehouseStructureName like <if test="warehouseStructureName != null and warehouseStructureName != ''"> d.warehouseStructureName like
concat(concat("%",#{warehouseStructureName}),"%") concat(concat("%",#{warehouseStructureName}),"%")
</if> </if>
<if test="equipCode != null and equipCode != ''">AND d.fireEquipmentCode like <if test="equipCode != null and equipCode != ''">AND d.fireEquipmentCode like
...@@ -348,8 +348,8 @@ ...@@ -348,8 +348,8 @@
wl_equipment_specific_alarm_log wlesal wl_equipment_specific_alarm_log wlesal
LEFT JOIN wl_equipment we ON wlesal.equipment_code = we.code LEFT JOIN wl_equipment we ON wlesal.equipment_code = we.code
LEFT JOIN wl_equipment_specific_alarm wlesa ON wlesa.id = wlesal.equipment_specific_alarm_id) d LEFT JOIN wl_equipment_specific_alarm wlesa ON wlesa.id = wlesal.equipment_specific_alarm_id) d
WHERE <where>
<if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">and <if test="param.warehouseStructureName != null and param.warehouseStructureName != ''">
d.warehouseStructureName like d.warehouseStructureName like
concat(concat("%",#{param.warehouseStructureName}),"%") concat(concat("%",#{param.warehouseStructureName}),"%")
</if> </if>
...@@ -389,6 +389,8 @@ ...@@ -389,6 +389,8 @@
<if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 2">AND <if test="param.cleanStatus != null and param.cleanStatus != '' and param.cleanStatus == 2">AND
d.cleanStatus = '未消除' d.cleanStatus = '未消除'
</if> </if>
</where>
ORDER BY d.createDate DESC ORDER BY d.createDate DESC
</select> </select>
<select id="getAlarmList" resultType="java.util.HashMap"> <select id="getAlarmList" resultType="java.util.HashMap">
...@@ -459,7 +461,7 @@ ...@@ -459,7 +461,7 @@
) d ) d
<where> <where>
<if test="warehouseStructureName != null and warehouseStructureName != ''"> <if test="warehouseStructureName != null and warehouseStructureName != ''">
and d.warehouseStructureName like d.warehouseStructureName like
concat(concat("%",#{warehouseStructureName}),"%") concat(concat("%",#{warehouseStructureName}),"%")
</if> </if>
<if test="equipCode != null and equipCode != ''">AND d.fireEquipmentCode like <if test="equipCode != null and equipCode != ''">AND d.fireEquipmentCode like
...@@ -515,9 +517,8 @@ ...@@ -515,9 +517,8 @@
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d ) d
WHERE 1=1 WHERE
AND d.fireEquipmentName IS NOT NULL d.id = #{id}
AND d.id = #{id}
AND d.type = #{alarmType} AND d.type = #{alarmType}
ORDER BY d.createDate DESC ORDER BY d.createDate DESC
</select> </select>
...@@ -554,9 +555,7 @@ ...@@ -554,9 +555,7 @@
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d ) d
WHERE WHERE
1 = 1 d.equipmentSpecificId = #{id}
AND d.fireEquipmentName IS NOT NULL
AND d.equipmentSpecificId = #{id}
AND d.type = #{alarmType} AND d.type = #{alarmType}
</select> </select>
<select id="getEquipmentAlarmCount" resultType="int"> <select id="getEquipmentAlarmCount" resultType="int">
...@@ -577,9 +576,7 @@ ...@@ -577,9 +576,7 @@
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
LEFT JOIN wl_equipment we ON wled.equipment_id = we.id LEFT JOIN wl_equipment we ON wled.equipment_id = we.id
) d ) d
WHERE WHERE d.equipmentSpecificId = #{id}
d.fireEquipmentName <![CDATA[<>]]> ''
AND d.equipmentSpecificId = #{id}
AND d.type = #{alarmType} AND d.type = #{alarmType}
</select> </select>
<select id="findByTypeAndDate" resultMap="resultMapDto"> <select id="findByTypeAndDate" resultMap="resultMapDto">
...@@ -659,7 +656,6 @@ ...@@ -659,7 +656,6 @@
</where> </where>
) d ) d
<where> <where>
d.fireEquipmentName IS NOT NULL
<choose> <choose>
<when test="dto.type != null and dto.type != ''"> <when test="dto.type != null and dto.type != ''">
AND d.type = #{dto.type} AND d.type = #{dto.type}
...@@ -797,7 +793,6 @@ ...@@ -797,7 +793,6 @@
</where> </where>
) d ) d
<where> <where>
d.fireEquipmentName IS NOT NULL
<choose> <choose>
<when test="dto.type != null and dto.type != ''"> <when test="dto.type != null and dto.type != ''">
AND d.type = #{dto.type} AND d.type = #{dto.type}
...@@ -958,7 +953,6 @@ ...@@ -958,7 +953,6 @@
</where> </where>
) d ) d
<where> <where>
d.fireEquipmentName IS NOT NULL
<choose> <choose>
<when test="dto.type != null and dto.type != ''"> <when test="dto.type != null and dto.type != ''">
AND d.type = #{dto.type} AND d.type = #{dto.type}
...@@ -1011,7 +1005,7 @@ ...@@ -1011,7 +1005,7 @@
)m )m
<where> <where>
<if test="dto.status != null and dto.status != ''"> <if test="dto.status != null and dto.status != ''">
AND `status`= #{dto.status} `status`= #{dto.status}
</if> </if>
<if test="dto.warehouseStructureName != null and dto.warehouseStructureName != ''"> <if test="dto.warehouseStructureName != null and dto.warehouseStructureName != ''">
AND warehouseStructureName LIKE CONCAT('%', #{dto.warehouseStructureName}, '%' ) AND warehouseStructureName LIKE CONCAT('%', #{dto.warehouseStructureName}, '%' )
......
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