Commit e4e6fb28 authored by chenzhao's avatar chenzhao

修改sql问题

parent 06a2b24f
...@@ -253,17 +253,17 @@ ...@@ -253,17 +253,17 @@
from from
( (
select select
rec_date as recdate, rec_date as recDate,
station as station, station as station,
equipment_name as equipmentname, equipment_name as equipmentName,
content as content, content as content,
warning_name as warningname, warning_name as warningName,
disposotion_state as disposotionstate, disposotion_state as disposotionState,
arae as arae, arae as arae,
'pv' as stationtype, 'pv' as stationType,
gateway_id, gateway_id,
concat(point_name, '异常') as pointname, concat(point_name, '异常') as pointName,
disposotion_date as disposotiondate, disposotion_date as disposotionDate,
(case when warning_name = '注意' then 1 (case when warning_name = '注意' then 1
when warning_name = '警告' then 2 when warning_name = '警告' then 2
when warning_name = '危险' then 3 when warning_name = '危险' then 3
...@@ -271,17 +271,17 @@ ...@@ -271,17 +271,17 @@
from from
analysis_data.pv_warning_record union all analysis_data.pv_warning_record union all
select select
rec_date as recdate, rec_date as recDate,
station as station, station as station,
equipment_name as equipmentname, equipment_name as equipmentName,
content as content, content as content,
warning_name as warningname, warning_name as warningName,
disposotion_state as disposotionstate, disposotion_state as disposotionState,
arae as arae, arae as arae,
'fan' as stationtype, 'fan' as stationType,
gateway_id, gateway_id,
concat(point_name, '异常') as pointname, concat(point_name, '异常') as pointName,
disposotion_date as disposotiondate, disposotion_date as disposotionDate,
(case when warning_name = '注意' then 1 (case when warning_name = '注意' then 1
when warning_name = '警告' then 2 when warning_name = '警告' then 2
when warning_name = '危险' then 3 when warning_name = '危险' then 3
...@@ -307,13 +307,13 @@ ...@@ -307,13 +307,13 @@
and a.gateway_id = #{stationId} and a.gateway_id = #{stationId}
</if> </if>
<if test="startDate != '' and startDate != null"> <if test="startDate != '' and startDate != null">
and a.recdate >= concat(#{startDate}, ' 00:00:00') and a.recDate >= concat(#{startDate}, ' 00:00:00')
</if> </if>
<if test="endDate != '' and endDate != null"> <if test="endDate != '' and endDate != null">
and concat(#{endDate}, ' 23:59:59') >= a.recdate and concat(#{endDate}, ' 23:59:59') >= a.recdate
</if> </if>
</where> </where>
order by sort desc, recdate desc order by sort desc, recDate desc
limit #{current}, #{size} limit #{current}, #{size}
</select> </select>
...@@ -325,34 +325,34 @@ ...@@ -325,34 +325,34 @@
from from
( (
select select
rec_date as recdate, rec_date as recDate,
station as station, station as station,
equipment_name as equipmentname, equipment_name as equipmentName,
content as content, content as content,
warning_name as warningname, warning_name as warningName,
disposotion_state as disposotionstate, disposotion_state as disposotionState,
arae as arae, arae as arae,
'pv' as stationtype, 'pv' as stationType,
gateway_id, gateway_id,
disposotion_date as disposotiondate disposotion_date as disposotionDate
from from
analysis_data.pv_warning_record union all analysis_data.pv_warning_record union all
select select
rec_date as recdate, rec_date as recFate,
station as station, station as station,
equipment_name as equipmentname, equipment_name as equipmentName,
content as content, content as content,
warning_name as warningname, warning_name as warningName,
disposotion_state as disposotionstate, disposotion_state as disposotionState,
arae as arae, arae as arae,
'fan' as stationtype, 'fan' as stationType,
gateway_id, gateway_id,
disposotion_date as disposotiondate disposotion_date as disposotionDate
from from
analysis_data.fan_warning_record analysis_data.fan_warning_record
) a ) a
<where> <where>
a.disposotionstate = '未处置' or (a.disposotionstate = '已处置' and a.ts > ( now() - 3D - 8h )) a.disposotionState = '未处置' or (a.disposotionState = '已处置' and a.ts > ( now() - 3D - 8h ))
<if test="arae != '' and arae != null"> <if test="arae != '' and arae != null">
and a.arae = concat(#{area}, '区域') and a.arae = concat(#{area}, '区域')
</if> </if>
...@@ -360,7 +360,7 @@ ...@@ -360,7 +360,7 @@
and a.station = #{station} and a.station = #{station}
</if> </if>
<if test="stationType != '' and stationType != null"> <if test="stationType != '' and stationType != null">
and a.stationtype = #{stationType} and a.stationType = #{stationType}
</if> </if>
<if test="warningName != '' and warningName != null"> <if test="warningName != '' and warningName != null">
and a.warning_name = #{warningName} and a.warning_name = #{warningName}
...@@ -369,7 +369,7 @@ ...@@ -369,7 +369,7 @@
and a.gateway_id = #{stationId} and a.gateway_id = #{stationId}
</if> </if>
<if test="startDate != '' and startDate != null"> <if test="startDate != '' and startDate != null">
and a.recdate >= concat(#{startDate}, ' 00:00:00') and a.recDate >= concat(#{startDate}, ' 00:00:00')
</if> </if>
<if test="endDate != '' and endDate != null"> <if test="endDate != '' and endDate != null">
and concat(#{endDate}, ' 23:59:59') >= a.recdate and concat(#{endDate}, ' 23:59:59') >= a.recdate
...@@ -482,7 +482,7 @@ ...@@ -482,7 +482,7 @@
)) b )) b
<where> <where>
<if test="stationType != '' and stationType != null"> <if test="stationType != '' and stationType != null">
and b.stationtype = #{stationType} and b.stationType = #{stationType}
</if> </if>
<if test="araeCode != '' and araeCode != null"> <if test="araeCode != '' and araeCode != null">
and b.arae = #{araeCode} and b.arae = #{araeCode}
......
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