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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
| <?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="com.ld.igds.oa.mapper.GpsServiceMapper">
|
| <!-- 根据IP更新GPS通讯状态, -->
| <update id="updateGpsStatus">
| update D_OA_GPS set STATUS_ = #{status}
| where IP_ = #{ip}
| </update>
|
| <!-- 更新GPS信息,根据手机卡号 -->
| <update id="updateGps" parameterType="com.ld.igds.oa.dto.GpsData">
| update D_OA_GPS
| <set>
| <if test="data.port != null and data.port != '' ">PORT_ = #{data.port},</if>
| <if test="data.ip != null and data.ip != '' ">IP_ = #{data.ip},</if>
| <if test="data.sn != null and data.sn != '' ">SN_ = #{data.sn},</if>
| UPDATE_TIME_ = now()
| </set>
| where PHONE_ = #{data.phone}
| </update>
|
| <!-- 根据手机卡号查询GPS设备信息 -->
| <select id="getGpsByPhone" parameterType="java.lang.String" resultType="com.ld.igds.oa.dto.GpsData">
| select
| ID_ AS id,
| NAME_ AS name,
| COMPANY_ID_ AS companyId,
| BRAND_ AS brand,
| DEPT_ID_ AS deptId,
| IP_ AS ip,
| PORT_ AS port,
| PROTOCOL_ AS protocol,
| REMARKS_ AS remarks,
| STATUS_ AS status,
| UPDATE_TIME_ AS updateTime,
| PHONE_ AS phone,
| SN_ AS sn
| from
| D_OA_GPS
| where PHONE_ = #{phone}
| </select>
|
| <!-- 新增GPS -->
| <insert id="addGps" parameterType="com.ld.igds.oa.dto.GpsData">
| insert into D_OA_GPS
| (ID_,
| NAME_,
| COMPANY_ID_,
| BRAND_,
| DEPT_ID_,
| IP_,
| PORT_,
| PROTOCOL_,
| REMARKS_,
| STATUS_,
| UPDATE_TIME_,
| PHONE_,
| SN_)
| values
| (#{data.id},
| #{data.name},
| #{data.companyId},
| #{data.brand},
| #{data.deptId},
| #{data.ip},
| #{data.port},
| #{data.protocol},
| #{data.remarks},
| #{data.status},
| #{data.updateTime},
| #{data.phone},
| #{data.sn})
| </insert>
|
|
|
| <!-- 更新GPS位置信息 -->
| <update id="updateGpsRecord" parameterType="com.ld.igds.oa.dto.GpsData">
| update D_OA_GPS_RECORD
| <set>
| <if test="data.phone != null and data.phone != '' ">PHONE_ = #{data.phone},</if>
| <if test="data.longitude != null and data.longitude != '' ">LONGITUDE_ = #{data.longitude},</if>
| <if test="data.latitude != null and data.latitude != '' ">LATITUDE_ = #{data.latitude},</if>
| UPDATE_TIME_ = now()
| </set>
| where ID_ = #{data.recordId}
| </update>
|
| <!-- 新增GPS位置信息 -->
| <insert id="addGpsRecord" parameterType="com.ld.igds.oa.dto.GpsData">
| insert into D_OA_GPS_RECORD
| (ID_,PHONE_,LONGITUDE_,LATITUDE_,UPDATE_TIME_,SN_)
| values(
| #{data.recordId},#{data.phone},#{data.longitude},#{data.latitude},#{data.updateTime},#{data.sn}
| )
| </insert>
|
| <!-- 根据组织编码获取状态状态正常且绑定有GPS的资产设备 -->
| <select id="getAsset" parameterType="java.lang.String" resultType="com.ld.igds.oa.dto.AssetData">
| select * from
| D_OA_ASSET
| where
| COMPANY_ID_ = #{companyId} AND
| STATUS_ = '正常' AND
| GPS_PHONE_ != '' AND
| GPS_PHONE_ is not NULL
| </select>
| </mapper>
|
|