DeviceLocationMapper.xml
2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.glsx.app.modules.mapper.DeviceLocationMapper">
<resultMap id="BaseResultMap" type="cn.com.glsx.app.modules.entity.DeviceLocation">
<!--
WARNING - @mbg.generated
-->
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="sn" jdbcType="VARCHAR" property="sn"/>
<result column="last_gps_time" jdbcType="TIMESTAMP" property="lastGpsTime"/>
<result column="last_bs_time" jdbcType="TIMESTAMP" property="lastBsTime"/>
<result column="speed" jdbcType="INTEGER" property="speed"/>
<result column="stay_status" jdbcType="TINYINT" property="stayStatus"/>
<result column="stay_status_updatetime" jdbcType="TIMESTAMP" property="stayStatusUpdatetime"/>
<result column="created_time" jdbcType="TIMESTAMP" property="createdTime"/>
<result column="updated_time" jdbcType="TIMESTAMP" property="updatedTime"/>
</resultMap>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
-->
id, sn, last_gps_time, last_bs_time, speed, stay_status, stay_status_updatetime,
created_time, updated_time
</sql>
<select id="getOfflineAlarmInfo" resultType="cn.com.glsx.app.modules.model.view.OfflineAlarmVO">
select
tv.id as vehicleId,
tvd.id as vdId,
tv.owner_name as ownerName,
tvd.sn as sn,
tv.vin as vin,
tvd.created_date as activeDate,
tdl.last_gps_time as lastGpsTime,
tdl.last_bs_time as lastBsTime,
tv.license_plate as licensePlate
from t_vehicle tv
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
left join t_device td on td.sn = tvd.sn
left join t_workorder tw on tw.id = tv.workorder_id and tw.del_flag = 0
left join t_user tu on tu.id = tv.created_by and tu.del_flag = 0
left join t_device_location tdl on tdl.sn = td.sn
where tv.del_flag = 0
and tvd.bind_status = 1
and tvd.del_flag = 0
<if test="offlineStartTime != null and offlineStartTime != ''">
and ((tdl.last_gps_time < #{offlineStartTime} and tdl.last_bs_time < #{offlineStartTime})
or (tdl.last_gps_time is null and tdl.last_bs_time is null)
or (tdl.last_gps_time is null and tdl.last_bs_time < #{offlineStartTime})
or (tdl.last_gps_time < #{offlineStartTime} and tdl.last_bs_time is null)
)
</if>
order by activeDate desc,vdId desc
</select>
</mapper>