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
113
114
115
116
117
118
119
120
121
122
| <?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.common.mapper.DeviceSerMapper">
|
|
| <!-- 根据IP和端口号获取分机信息 -->
| <select id="getSerByIP" resultType="com.ld.igds.models.DeviceSer">
| select
| ID_ as id,
| COMPANY_ID_ as companyId,
| NAME_ as name,
| IP_ as ip,
| PORT_ as port,
| SN_ as sn,
| STATUS_ as status,
| PROTOCOL_ as protocol,
| UPDATE_TIME_ as updateTime,
| CONTROL_MODEL_ as controlModel,
| NETWORK_TYPE_ as networkType,
| TYPE_ as type
| from
| D_DEVICE_SER
| where ip_=#{ip} and port_ = #{port}
| </select>
|
| <!-- ID获取 -->
| <select id="getDataSer" resultType="com.ld.igds.models.DeviceSer">
| select
| ID_ as id,
| COMPANY_ID_ as companyId,
| NAME_ as name,
| IP_ as ip,
| PORT_ as port,
| SN_ as sn,
| STATUS_ as status,
| PROTOCOL_ as protocol,
| UPDATE_TIME_ as updateTime,
| CONTROL_MODEL_ as controlModel,
| NETWORK_TYPE_ as networkType,
| TYPE_ as type
| from
| D_DEVICE_SER
| where COMPANY_ID_=#{companyId} and ID_ = #{serId}
| </select>
|
| <!-- 获取所有分机 -->
| <select id="queryAll" resultType="com.ld.igds.models.DeviceSer">
| select
| ID_ as id,
| COMPANY_ID_ as companyId,
| NAME_ as name,
| IP_ as ip,
| PORT_ as port,
| SN_ as sn,
| STATUS_ as status,
| PROTOCOL_ as protocol,
| UPDATE_TIME_ as updateTime,
| CONTROL_MODEL_ as controlModel,
| NETWORK_TYPE_ as networkType,
| TYPE_ as type
| from
| D_DEVICE_SER
| where COMPANY_ID_=#{companyId}
| </select>
|
| <!-- 根据IP和端口号更新状态-->
| <update id="updateStatusByIp">
| update d_device_ser set status_=#{status},update_time_=now() where ip_=#{ip} and port_ = #{port}
| </update>
|
| <!-- 根据SN更新设备状态-->
| <update id="updateBySn">
| update d_device_ser set status_=#{status},update_time_=now(), ip_=#{ip}, port_ = #{port} where sn_ = #{sn}
| </update>
|
| <!-- 更新 所有状态,排除默认测试协议更改-->
| <update id="updateStatusAll">
| update d_device_ser set status_=#{status} where company_id_=#{companyId} and PROTOCOL_ != 'TCP_DEFAULT'
| </update>
|
|
| <!-- 更新操作模式 同事更新为在线 -->
| <update id="updateControlModel">
| update d_device_ser set CONTROL_MODEL_=#{controlModel},STATUS_ = 'Y',update_time_=now() where id_=#{id} and company_id_ = #{companyId}
| </update>
|
| <!-- 更新配置 -->
| <update id="updateSerById" parameterType="com.ld.igds.models.DeviceSer">
| update d_device_ser set
| CABLE_FORMAT_=#{ser.cableFormat},
| CABLE_TYPE_=#{ser.cableType},
| POWER_MODEL_=#{ser.powerModel},
| CABLE_Z_=#{ser.cableZ},
| CABLE_Y_=#{ser.cableY},
| CABLE_X_=#{ser.cableX},
| STATUS_ = 'Y',
| IP_ = #{ser.ip},
| PORT_ = #{ser.port},
| SN_ = #{ser.sn},
| ORG_ID_ = #{ser.orgId},
| update_time_=now()
| where id_=#{ser.id}
| and company_id_ = #{ser.companyId}
| </update>
|
| <!-- 更新配置 -->
| <update id="updateByData" parameterType="com.ld.igds.models.DeviceSer">
| update d_device_ser
| <set>
| STATUS_ = 'Y',
| IP_ = #{data.ip},
| PORT_ = #{data.port},
| update_time_=now()
| </set>
| where COMPANY_ID_ = #{data.companyId}
| AND ID_ = #{data.id}
| </update>
|
| </mapper>
|
|