Commit 3ddb6232 by levphon

车辆管理-修改设备状态查询条件

1 parent 4664d086
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from t_electric_fence_sns from t_electric_fence_sns
where del_flag = 0 where del_flag = 0
where fence_id = #{fenceId} and fence_id = #{fenceId}
and sn in and sn in
<foreach collection="sns" separator="," open="(" close=")" item="item"> <foreach collection="sns" separator="," open="(" close=")" item="item">
#{item} #{item}
......
...@@ -469,15 +469,18 @@ ...@@ -469,15 +469,18 @@
<if test="deviceState != null"> <if test="deviceState != null">
<choose> <choose>
<when test="deviceState == 0"> <!-- 行驶中--> <when test="deviceState == 0"> <!-- 行驶中-->
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or (timestampdiff(SECOND,tdl.last_bs_time,now())) and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
<![CDATA[<]]> 600)
</when> </when>
<when test="deviceState == 1"> <!-- 静止--> <when test="deviceState == 1"> <!-- 静止-->
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
(timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 600) (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
</when> </when>
<when test="deviceState == 2"> <!-- 离线--> <when test="deviceState == 2"> <!-- 离线-->
and (timestampdiff(SECOND,tdl.last_gps_time,now())) &gt; #{offlineTime} and (timestampdiff(SECOND,tdl.last_bs_time,now())) &gt; #{offlineTime} and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is null)
)
</when> </when>
<when test="deviceState == 3"> <!-- 在线--> <when test="deviceState == 3"> <!-- 在线-->
and (timestampdiff(SECOND,tdl.last_gps_time,now()) &lt; #{offlineTime} or timestampdiff(SECOND,tdl.last_bs_time,now()) &lt; #{offlineTime}) and (timestampdiff(SECOND,tdl.last_gps_time,now()) &lt; #{offlineTime} or timestampdiff(SECOND,tdl.last_bs_time,now()) &lt; #{offlineTime})
...@@ -547,15 +550,18 @@ ...@@ -547,15 +550,18 @@
<if test="deviceState != null"> <if test="deviceState != null">
<choose> <choose>
<when test="deviceState == 0"> <!-- 行驶中--> <when test="deviceState == 0"> <!-- 行驶中-->
and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or (timestampdiff(SECOND,tdl.last_bs_time,now())) and (td.source=1) and speed>0 and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
<![CDATA[<]]> 600)
</when> </when>
<when test="deviceState == 1"> <!-- 静止--> <when test="deviceState == 1"> <!-- 静止-->
and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 600 or and (td.source=1) and (speed=0 or speed is null) and ((timestampdiff(SECOND,tdl.last_gps_time,now())) <![CDATA[<]]> 360 or
(timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 600) (timestampdiff(SECOND,tdl.last_bs_time,now())) <![CDATA[<]]> 360)
</when> </when>
<when test="deviceState == 2"> <!-- 离线--> <when test="deviceState == 2"> <!-- 离线-->
and (timestampdiff(SECOND,tdl.last_gps_time,now())) &gt; #{offlineTime} and (timestampdiff(SECOND,tdl.last_bs_time,now())) &gt; #{offlineTime} and ((timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and timestampdiff(SECOND, tdl.last_bs_time, now()) &gt; #{offlineTime})
or (timestampdiff(SECOND, tdl.last_gps_time, now()) &gt; #{offlineTime} and tdl.last_bs_time is null)
)
</when> </when>
<when test="deviceState == 3"> <!-- 在线--> <when test="deviceState == 3"> <!-- 在线-->
and (timestampdiff(SECOND,tdl.last_gps_time,now()) &lt; #{offlineTime} or timestampdiff(SECOND,tdl.last_bs_time,now()) &lt; #{offlineTime}) and (timestampdiff(SECOND,tdl.last_gps_time,now()) &lt; #{offlineTime} or timestampdiff(SECOND,tdl.last_bs_time,now()) &lt; #{offlineTime})
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!