hanqingsong il y a 4 ans
Parent
commit
ad41664e7a

+ 40 - 0
depot-basic/src/main/java/com/chinaitop/depot/basic/mapper/MonitorCameraMapper.java

@@ -0,0 +1,40 @@
1
+package com.chinaitop.depot.basic.mapper;
2
+
3
+import com.chinaitop.depot.basic.model.MonitorCamera;
4
+import com.chinaitop.depot.basic.model.MonitorCameraExample;
5
+import java.util.List;
6
+import java.util.Map;
7
+
8
+import org.apache.ibatis.annotations.Param;
9
+import org.springframework.stereotype.Repository;
10
+
11
+@Repository
12
+public interface MonitorCameraMapper {
13
+    long countByExample(MonitorCameraExample example);
14
+
15
+    int deleteByExample(MonitorCameraExample example);
16
+
17
+    int deleteByPrimaryKey(Integer id);
18
+
19
+    int insert(MonitorCamera record);
20
+
21
+    int insertSelective(MonitorCamera record);
22
+
23
+    List<MonitorCamera> selectByExample(MonitorCameraExample example);
24
+
25
+    MonitorCamera selectByPrimaryKey(Integer id);
26
+
27
+    int updateByExampleSelective(@Param("record") MonitorCamera record, @Param("example") MonitorCameraExample example);
28
+
29
+    int updateByExample(@Param("record") MonitorCamera record, @Param("example") MonitorCameraExample example);
30
+
31
+    int updateByPrimaryKeySelective(MonitorCamera record);
32
+
33
+    int updateByPrimaryKey(MonitorCamera record);
34
+
35
+    List<MonitorCamera> selectByNVRDates(Map<String,Object> map);
36
+
37
+    List<MonitorCamera> selectByCameraAndNVR();
38
+
39
+    List<Map<String,Object>> selectByGroupId(String groupIds);
40
+}

+ 558 - 0
depot-basic/src/main/java/com/chinaitop/depot/basic/mapper/MonitorCameraMapper.xml

@@ -0,0 +1,558 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.chinaitop.depot.basic.mapper.MonitorCameraMapper">
4
+  <resultMap id="BaseResultMap" type="com.chinaitop.depot.basic.model.MonitorCamera">
5
+    <constructor>
6
+      <idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
7
+      <arg column="org_id" javaType="java.lang.String" jdbcType="VARCHAR" />
8
+      <arg column="name" javaType="java.lang.String" jdbcType="VARCHAR" />
9
+      <arg column="alias" javaType="java.lang.String" jdbcType="VARCHAR" />
10
+      <arg column="username" javaType="java.lang.String" jdbcType="VARCHAR" />
11
+      <arg column="password" javaType="java.lang.String" jdbcType="VARCHAR" />
12
+      <arg column="ip" javaType="java.lang.String" jdbcType="VARCHAR" />
13
+      <arg column="subnetmask" javaType="java.lang.String" jdbcType="VARCHAR" />
14
+      <arg column="gateway" javaType="java.lang.String" jdbcType="VARCHAR" />
15
+      <arg column="type" javaType="java.lang.String" jdbcType="VARCHAR" />
16
+      <arg column="port" javaType="java.lang.String" jdbcType="VARCHAR" />
17
+      <arg column="factory" javaType="java.lang.String" jdbcType="VARCHAR" />
18
+      <arg column="live" javaType="java.lang.String" jdbcType="VARCHAR" />
19
+      <arg column="model_number" javaType="java.lang.String" jdbcType="VARCHAR" />
20
+      <arg column="serial_number" javaType="java.lang.String" jdbcType="VARCHAR" />
21
+      <arg column="installation_site" javaType="java.lang.String" jdbcType="VARCHAR" />
22
+      <arg column="installation_method" javaType="java.lang.String" jdbcType="VARCHAR" />
23
+      <arg column="Irradiated_area" javaType="java.lang.String" jdbcType="VARCHAR" />
24
+      <arg column="power_position" javaType="java.lang.String" jdbcType="VARCHAR" />
25
+      <arg column="remark" javaType="java.lang.String" jdbcType="VARCHAR" />
26
+      <arg column="isremove" javaType="java.lang.String" jdbcType="VARCHAR" />
27
+      <arg column="update_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
28
+    </constructor>
29
+  </resultMap>
30
+  <sql id="Example_Where_Clause">
31
+    <where>
32
+      <foreach collection="oredCriteria" item="criteria" separator="or">
33
+        <if test="criteria.valid">
34
+          <trim prefix="(" prefixOverrides="and" suffix=")">
35
+            <foreach collection="criteria.criteria" item="criterion">
36
+              <choose>
37
+                <when test="criterion.noValue">
38
+                  and ${criterion.condition}
39
+                </when>
40
+                <when test="criterion.singleValue">
41
+                  and ${criterion.condition} #{criterion.value}
42
+                </when>
43
+                <when test="criterion.betweenValue">
44
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
45
+                </when>
46
+                <when test="criterion.listValue">
47
+                  and ${criterion.condition}
48
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
49
+                    #{listItem}
50
+                  </foreach>
51
+                </when>
52
+              </choose>
53
+            </foreach>
54
+          </trim>
55
+        </if>
56
+      </foreach>
57
+    </where>
58
+  </sql>
59
+  <sql id="Update_By_Example_Where_Clause">
60
+    <where>
61
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
62
+        <if test="criteria.valid">
63
+          <trim prefix="(" prefixOverrides="and" suffix=")">
64
+            <foreach collection="criteria.criteria" item="criterion">
65
+              <choose>
66
+                <when test="criterion.noValue">
67
+                  and ${criterion.condition}
68
+                </when>
69
+                <when test="criterion.singleValue">
70
+                  and ${criterion.condition} #{criterion.value}
71
+                </when>
72
+                <when test="criterion.betweenValue">
73
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
74
+                </when>
75
+                <when test="criterion.listValue">
76
+                  and ${criterion.condition}
77
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
78
+                    #{listItem}
79
+                  </foreach>
80
+                </when>
81
+              </choose>
82
+            </foreach>
83
+          </trim>
84
+        </if>
85
+      </foreach>
86
+    </where>
87
+  </sql>
88
+  <sql id="Base_Column_List">
89
+    id, org_id, name, alias, username, password, ip, subnetmask, gateway, type, port, 
90
+    factory, live, model_number, serial_number, installation_site, installation_method, 
91
+    Irradiated_area, power_position, remark, isremove, update_time
92
+  </sql>
93
+  <select id="selectByExample" parameterType="com.chinaitop.depot.basic.model.MonitorCameraExample" resultMap="BaseResultMap">
94
+  select
95
+  <if test="distinct">
96
+    distinct
97
+  </if>
98
+  <include refid="Base_Column_List" />
99
+  from monitor_camera
100
+  <if test="_parameter != null">
101
+    <include refid="Example_Where_Clause" />
102
+  </if>
103
+  <if test="orderByClause != null">
104
+    order by ${orderByClause}
105
+  </if>
106
+</select>
107
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
108
+    select 
109
+    <include refid="Base_Column_List" />
110
+    from monitor_camera
111
+    where id = #{id,jdbcType=INTEGER}
112
+  </select>
113
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
114
+    delete from monitor_camera
115
+    where id = #{id,jdbcType=INTEGER}
116
+  </delete>
117
+  <delete id="deleteByExample" parameterType="com.chinaitop.depot.basic.model.MonitorCameraExample">
118
+    delete from monitor_camera
119
+    <if test="_parameter != null">
120
+      <include refid="Example_Where_Clause" />
121
+    </if>
122
+  </delete>
123
+  <insert id="insert" parameterType="com.chinaitop.depot.basic.model.MonitorCamera">
124
+    insert into monitor_camera (id, org_id, name, 
125
+      alias, username, password, 
126
+      ip, subnetmask, gateway, 
127
+      type, port, factory, 
128
+      live, model_number, serial_number, 
129
+      installation_site, installation_method, Irradiated_area, 
130
+      power_position, remark, isremove, 
131
+      update_time)
132
+    values (#{id,jdbcType=INTEGER}, #{orgId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
133
+      #{alias,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
134
+      #{ip,jdbcType=VARCHAR}, #{subnetmask,jdbcType=VARCHAR}, #{gateway,jdbcType=VARCHAR},
135
+      #{type,jdbcType=VARCHAR}, #{port,jdbcType=VARCHAR}, #{factory,jdbcType=VARCHAR},
136
+      #{live,jdbcType=VARCHAR}, #{modelNumber,jdbcType=VARCHAR}, #{serialNumber,jdbcType=VARCHAR},
137
+      #{installationSite,jdbcType=VARCHAR}, #{installationMethod,jdbcType=VARCHAR}, #{irradiatedArea,jdbcType=VARCHAR},
138
+      #{powerPosition,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{isremove,jdbcType=VARCHAR},
139
+      #{updateTime,jdbcType=TIMESTAMP})
140
+  </insert>
141
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.basic.model.MonitorCamera">
142
+    insert into monitor_camera
143
+    <trim prefix="(" suffix=")" suffixOverrides=",">
144
+      <if test="id != null">
145
+        id,
146
+      </if>
147
+      <if test="orgId != null">
148
+        org_id,
149
+      </if>
150
+      <if test="name != null">
151
+        name,
152
+      </if>
153
+      <if test="alias != null">
154
+        alias,
155
+      </if>
156
+      <if test="username != null">
157
+        username,
158
+      </if>
159
+      <if test="password != null">
160
+        password,
161
+      </if>
162
+      <if test="ip != null">
163
+        ip,
164
+      </if>
165
+      <if test="subnetmask != null">
166
+        subnetmask,
167
+      </if>
168
+      <if test="gateway != null">
169
+        gateway,
170
+      </if>
171
+      <if test="type != null">
172
+        type,
173
+      </if>
174
+      <if test="port != null">
175
+        port,
176
+      </if>
177
+      <if test="factory != null">
178
+        factory,
179
+      </if>
180
+      <if test="live != null">
181
+        live,
182
+      </if>
183
+      <if test="modelNumber != null">
184
+        model_number,
185
+      </if>
186
+      <if test="serialNumber != null">
187
+        serial_number,
188
+      </if>
189
+      <if test="installationSite != null">
190
+        installation_site,
191
+      </if>
192
+      <if test="installationMethod != null">
193
+        installation_method,
194
+      </if>
195
+      <if test="irradiatedArea != null">
196
+        Irradiated_area,
197
+      </if>
198
+      <if test="powerPosition != null">
199
+        power_position,
200
+      </if>
201
+      <if test="remark != null">
202
+        remark,
203
+      </if>
204
+      <if test="isremove != null">
205
+        isremove,
206
+      </if>
207
+      <if test="updateTime != null">
208
+        update_time,
209
+      </if>
210
+    </trim>
211
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
212
+      <if test="id != null">
213
+        #{id,jdbcType=INTEGER},
214
+      </if>
215
+      <if test="orgId != null">
216
+        #{orgId,jdbcType=VARCHAR},
217
+      </if>
218
+      <if test="name != null">
219
+        #{name,jdbcType=VARCHAR},
220
+      </if>
221
+      <if test="alias != null">
222
+        #{alias,jdbcType=VARCHAR},
223
+      </if>
224
+      <if test="username != null">
225
+        #{username,jdbcType=VARCHAR},
226
+      </if>
227
+      <if test="password != null">
228
+        #{password,jdbcType=VARCHAR},
229
+      </if>
230
+      <if test="ip != null">
231
+        #{ip,jdbcType=VARCHAR},
232
+      </if>
233
+      <if test="subnetmask != null">
234
+        #{subnetmask,jdbcType=VARCHAR},
235
+      </if>
236
+      <if test="gateway != null">
237
+        #{gateway,jdbcType=VARCHAR},
238
+      </if>
239
+      <if test="type != null">
240
+        #{type,jdbcType=VARCHAR},
241
+      </if>
242
+      <if test="port != null">
243
+        #{port,jdbcType=VARCHAR},
244
+      </if>
245
+      <if test="factory != null">
246
+        #{factory,jdbcType=VARCHAR},
247
+      </if>
248
+      <if test="live != null">
249
+        #{live,jdbcType=VARCHAR},
250
+      </if>
251
+      <if test="modelNumber != null">
252
+        #{modelNumber,jdbcType=VARCHAR},
253
+      </if>
254
+      <if test="serialNumber != null">
255
+        #{serialNumber,jdbcType=VARCHAR},
256
+      </if>
257
+      <if test="installationSite != null">
258
+        #{installationSite,jdbcType=VARCHAR},
259
+      </if>
260
+      <if test="installationMethod != null">
261
+        #{installationMethod,jdbcType=VARCHAR},
262
+      </if>
263
+      <if test="irradiatedArea != null">
264
+        #{irradiatedArea,jdbcType=VARCHAR},
265
+      </if>
266
+      <if test="powerPosition != null">
267
+        #{powerPosition,jdbcType=VARCHAR},
268
+      </if>
269
+      <if test="remark != null">
270
+        #{remark,jdbcType=VARCHAR},
271
+      </if>
272
+      <if test="isremove != null">
273
+        #{isremove,jdbcType=VARCHAR},
274
+      </if>
275
+      <if test="updateTime != null">
276
+        #{updateTime,jdbcType=TIMESTAMP},
277
+      </if>
278
+    </trim>
279
+  </insert>
280
+  <select id="countByExample" parameterType="com.chinaitop.depot.basic.model.MonitorCameraExample" resultType="java.lang.Long">
281
+    select count(*) from monitor_camera
282
+    <if test="_parameter != null">
283
+      <include refid="Example_Where_Clause" />
284
+    </if>
285
+  </select>
286
+  <update id="updateByExampleSelective" parameterType="map">
287
+    update monitor_camera
288
+    <set>
289
+      <if test="record.id != null">
290
+        id = #{record.id,jdbcType=INTEGER},
291
+      </if>
292
+      <if test="record.orgId != null">
293
+        org_id = #{record.orgId,jdbcType=VARCHAR},
294
+      </if>
295
+      <if test="record.name != null">
296
+        name = #{record.name,jdbcType=VARCHAR},
297
+      </if>
298
+      <if test="record.alias != null">
299
+        alias = #{record.alias,jdbcType=VARCHAR},
300
+      </if>
301
+      <if test="record.username != null">
302
+        username = #{record.username,jdbcType=VARCHAR},
303
+      </if>
304
+      <if test="record.password != null">
305
+        password = #{record.password,jdbcType=VARCHAR},
306
+      </if>
307
+      <if test="record.ip != null">
308
+        ip = #{record.ip,jdbcType=VARCHAR},
309
+      </if>
310
+      <if test="record.subnetmask != null">
311
+        subnetmask = #{record.subnetmask,jdbcType=VARCHAR},
312
+      </if>
313
+      <if test="record.gateway != null">
314
+        gateway = #{record.gateway,jdbcType=VARCHAR},
315
+      </if>
316
+      <if test="record.type != null">
317
+        type = #{record.type,jdbcType=VARCHAR},
318
+      </if>
319
+      <if test="record.port != null">
320
+        port = #{record.port,jdbcType=VARCHAR},
321
+      </if>
322
+      <if test="record.factory != null">
323
+        factory = #{record.factory,jdbcType=VARCHAR},
324
+      </if>
325
+      <if test="record.live != null">
326
+        live = #{record.live,jdbcType=VARCHAR},
327
+      </if>
328
+      <if test="record.modelNumber != null">
329
+        model_number = #{record.modelNumber,jdbcType=VARCHAR},
330
+      </if>
331
+      <if test="record.serialNumber != null">
332
+        serial_number = #{record.serialNumber,jdbcType=VARCHAR},
333
+      </if>
334
+      <if test="record.installationSite != null">
335
+        installation_site = #{record.installationSite,jdbcType=VARCHAR},
336
+      </if>
337
+      <if test="record.installationMethod != null">
338
+        installation_method = #{record.installationMethod,jdbcType=VARCHAR},
339
+      </if>
340
+      <if test="record.irradiatedArea != null">
341
+        Irradiated_area = #{record.irradiatedArea,jdbcType=VARCHAR},
342
+      </if>
343
+      <if test="record.powerPosition != null">
344
+        power_position = #{record.powerPosition,jdbcType=VARCHAR},
345
+      </if>
346
+      <if test="record.remark != null">
347
+        remark = #{record.remark,jdbcType=VARCHAR},
348
+      </if>
349
+      <if test="record.isremove != null">
350
+        isremove = #{record.isremove,jdbcType=VARCHAR},
351
+      </if>
352
+      <if test="record.updateTime != null">
353
+        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
354
+      </if>
355
+    </set>
356
+    <if test="_parameter != null">
357
+      <include refid="Update_By_Example_Where_Clause" />
358
+    </if>
359
+  </update>
360
+  <update id="updateByExample" parameterType="map">
361
+    update monitor_camera
362
+    set id = #{record.id,jdbcType=INTEGER},
363
+      org_id = #{record.orgId,jdbcType=VARCHAR},
364
+      name = #{record.name,jdbcType=VARCHAR},
365
+      alias = #{record.alias,jdbcType=VARCHAR},
366
+      username = #{record.username,jdbcType=VARCHAR},
367
+      password = #{record.password,jdbcType=VARCHAR},
368
+      ip = #{record.ip,jdbcType=VARCHAR},
369
+      subnetmask = #{record.subnetmask,jdbcType=VARCHAR},
370
+      gateway = #{record.gateway,jdbcType=VARCHAR},
371
+      type = #{record.type,jdbcType=VARCHAR},
372
+      port = #{record.port,jdbcType=VARCHAR},
373
+      factory = #{record.factory,jdbcType=VARCHAR},
374
+      live = #{record.live,jdbcType=VARCHAR},
375
+      model_number = #{record.modelNumber,jdbcType=VARCHAR},
376
+      serial_number = #{record.serialNumber,jdbcType=VARCHAR},
377
+      installation_site = #{record.installationSite,jdbcType=VARCHAR},
378
+      installation_method = #{record.installationMethod,jdbcType=VARCHAR},
379
+      Irradiated_area = #{record.irradiatedArea,jdbcType=VARCHAR},
380
+      power_position = #{record.powerPosition,jdbcType=VARCHAR},
381
+      remark = #{record.remark,jdbcType=VARCHAR},
382
+      isremove = #{record.isremove,jdbcType=VARCHAR},
383
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP}
384
+    <if test="_parameter != null">
385
+      <include refid="Update_By_Example_Where_Clause" />
386
+    </if>
387
+  </update>
388
+  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.basic.model.MonitorCamera">
389
+    update monitor_camera
390
+    <set>
391
+      <if test="orgId != null">
392
+        org_id = #{orgId,jdbcType=VARCHAR},
393
+      </if>
394
+      <if test="name != null">
395
+        name = #{name,jdbcType=VARCHAR},
396
+      </if>
397
+      <if test="alias != null">
398
+        alias = #{alias,jdbcType=VARCHAR},
399
+      </if>
400
+      <if test="username != null">
401
+        username = #{username,jdbcType=VARCHAR},
402
+      </if>
403
+      <if test="password != null">
404
+        password = #{password,jdbcType=VARCHAR},
405
+      </if>
406
+      <if test="ip != null">
407
+        ip = #{ip,jdbcType=VARCHAR},
408
+      </if>
409
+      <if test="subnetmask != null">
410
+        subnetmask = #{subnetmask,jdbcType=VARCHAR},
411
+      </if>
412
+      <if test="gateway != null">
413
+        gateway = #{gateway,jdbcType=VARCHAR},
414
+      </if>
415
+      <if test="type != null">
416
+        type = #{type,jdbcType=VARCHAR},
417
+      </if>
418
+      <if test="port != null">
419
+        port = #{port,jdbcType=VARCHAR},
420
+      </if>
421
+      <if test="factory != null">
422
+        factory = #{factory,jdbcType=VARCHAR},
423
+      </if>
424
+      <if test="live != null">
425
+        live = #{live,jdbcType=VARCHAR},
426
+      </if>
427
+      <if test="modelNumber != null">
428
+        model_number = #{modelNumber,jdbcType=VARCHAR},
429
+      </if>
430
+      <if test="serialNumber != null">
431
+        serial_number = #{serialNumber,jdbcType=VARCHAR},
432
+      </if>
433
+      <if test="installationSite != null">
434
+        installation_site = #{installationSite,jdbcType=VARCHAR},
435
+      </if>
436
+      <if test="installationMethod != null">
437
+        installation_method = #{installationMethod,jdbcType=VARCHAR},
438
+      </if>
439
+      <if test="irradiatedArea != null">
440
+        Irradiated_area = #{irradiatedArea,jdbcType=VARCHAR},
441
+      </if>
442
+      <if test="powerPosition != null">
443
+        power_position = #{powerPosition,jdbcType=VARCHAR},
444
+      </if>
445
+      <if test="remark != null">
446
+        remark = #{remark,jdbcType=VARCHAR},
447
+      </if>
448
+      <if test="isremove != null">
449
+        isremove = #{isremove,jdbcType=VARCHAR},
450
+      </if>
451
+      <if test="updateTime != null">
452
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
453
+      </if>
454
+    </set>
455
+    where id = #{id,jdbcType=INTEGER}
456
+  </update>
457
+  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.basic.model.MonitorCamera">
458
+    update monitor_camera
459
+    set org_id = #{orgId,jdbcType=VARCHAR},
460
+      name = #{name,jdbcType=VARCHAR},
461
+      alias = #{alias,jdbcType=VARCHAR},
462
+      username = #{username,jdbcType=VARCHAR},
463
+      password = #{password,jdbcType=VARCHAR},
464
+      ip = #{ip,jdbcType=VARCHAR},
465
+      subnetmask = #{subnetmask,jdbcType=VARCHAR},
466
+      gateway = #{gateway,jdbcType=VARCHAR},
467
+      type = #{type,jdbcType=VARCHAR},
468
+      port = #{port,jdbcType=VARCHAR},
469
+      factory = #{factory,jdbcType=VARCHAR},
470
+      live = #{live,jdbcType=VARCHAR},
471
+      model_number = #{modelNumber,jdbcType=VARCHAR},
472
+      serial_number = #{serialNumber,jdbcType=VARCHAR},
473
+      installation_site = #{installationSite,jdbcType=VARCHAR},
474
+      installation_method = #{installationMethod,jdbcType=VARCHAR},
475
+      Irradiated_area = #{irradiatedArea,jdbcType=VARCHAR},
476
+      power_position = #{powerPosition,jdbcType=VARCHAR},
477
+      remark = #{remark,jdbcType=VARCHAR},
478
+      isremove = #{isremove,jdbcType=VARCHAR},
479
+      update_time = #{updateTime,jdbcType=TIMESTAMP}
480
+    where id = #{id,jdbcType=INTEGER}
481
+  </update>
482
+  <select id="selectByNVRDates" resultType="java.util.HashMap" parameterType="java.util.Map" >
483
+    SELECT
484
+        camera.id cameraId,
485
+        camera.alias,
486
+        camera.factory,
487
+        camera.live,
488
+        camera.ip cameraIp,
489
+        camera.username cameraName,
490
+        camera.password cameraPassword,
491
+        camera.port cameraPort,
492
+        camera.type cameraType,
493
+        nvr.ip nvrIp,
494
+        nvr.username nvrName,
495
+        nvr. PASSWORD nvrPassword,
496
+        nvr. PORT nvrPort,
497
+        nvr.factory nvrFactory,
498
+        tdh.channel_number channelNumber
499
+    FROM
500
+        monitor_camera camera
501
+    LEFT JOIN monitor_nvr_camera tdh ON tdh.camera_id = camera.id
502
+    LEFT JOIN monitor_nvr nvr ON nvr.id = tdh.nvr_id
503
+    WHERE camera.org_id = #{orgid,jdbcType=VARCHAR} AND nvr.org_id = #{orgid,jdbcType=VARCHAR}
504
+    GROUP BY camera.id
505
+  </select>
506
+  <select id="selectByCameraAndNVR" resultType="java.util.HashMap">
507
+    SELECT
508
+        camera.id Id,
509
+        camera.alias,
510
+        camera.factory,
511
+        camera.live,
512
+        camera.ip Ip,
513
+        camera.username Name,
514
+        camera.password Password,
515
+        camera.port Port,
516
+        camera.type Type,
517
+        tdh.channel_number channelNumber,
518
+        tdh.nvr_id nvr_id,
519
+        (@ic :=@ic) AS isCamera
520
+    FROM
521
+        (SELECT @ic := 1) AS icamera,monitor_camera camera
522
+    LEFT JOIN monitor_nvr_camera tdh ON tdh.camera_id = camera.id
523
+    GROUP BY camera.id
524
+  UNION ALL
525
+    SELECT
526
+        nvr.id Id,
527
+        nvr.alias,
528
+        nvr.factory,
529
+        nvr.position live,
530
+        nvr.ip live,
531
+        nvr.username Ip,
532
+        nvr. PASSWORD Password,
533
+        nvr. PORT Port,
534
+        nvr. type Type,
535
+        tdh.channel_number channelNumber,
536
+        tdh.nvr_id nvr_id,
537
+        (@iv :=@iv) AS isCamera
538
+    FROM
539
+        (SELECT @iv := 2) AS invr,monitor_nvr nvr
540
+    LEFT JOIN monitor_nvr_camera tdh ON tdh.nvr_id = nvr.id
541
+    GROUP BY nvr.id
542
+</select>
543
+
544
+  <select id="selectByGroupId" parameterType="java.lang.String" resultType="java.util.HashMap">
545
+    SELECT
546
+      c.id,c.alias,c.ip,c.username,c.`password`,c.`port`,c.factory, c.type,c.org_id
547
+    FROM
548
+      monitor_camera c
549
+    LEFT JOIN monitor_gorup_camera gc ON gc.cameraid = c.id
550
+    WHERE
551
+      c.isremove = '1'
552
+    AND
553
+     gc.groupid = #{groupid,jdbcType=VARCHAR}
554
+  </select>
555
+
556
+
557
+
558
+</mapper>

+ 42 - 0
depot-basic/src/main/java/com/chinaitop/depot/basic/mapper/MonitorNvrMapper.java

@@ -0,0 +1,42 @@
1
+package com.chinaitop.depot.basic.mapper;
2
+
3
+import com.chinaitop.depot.basic.model.MonitorNvr;
4
+import com.chinaitop.depot.basic.model.MonitorNvrExample;
5
+import java.util.List;
6
+import java.util.Map;
7
+
8
+import org.apache.ibatis.annotations.Param;
9
+import org.springframework.stereotype.Repository;
10
+
11
+@Repository
12
+public interface MonitorNvrMapper {
13
+    long countByExample(MonitorNvrExample example);
14
+
15
+    int deleteByExample(MonitorNvrExample example);
16
+
17
+    int deleteByPrimaryKey(Integer id);
18
+
19
+    int insert(MonitorNvr record);
20
+
21
+    int insertSelective(MonitorNvr record);
22
+
23
+    List<MonitorNvr> selectByExample(MonitorNvrExample example);
24
+
25
+    MonitorNvr selectByPrimaryKey(Integer id);
26
+
27
+    int updateByExampleSelective(@Param("record") MonitorNvr record, @Param("example") MonitorNvrExample example);
28
+
29
+    int updateByExample(@Param("record") MonitorNvr record, @Param("example") MonitorNvrExample example);
30
+
31
+    int updateByPrimaryKeySelective(MonitorNvr record);
32
+
33
+    int updateByPrimaryKey(MonitorNvr record);
34
+
35
+    int deleteNvrCameraByNVRID(Integer nvrId);
36
+
37
+    List<Map<String,Object>> getThroughByNVRId(Integer nvrId);
38
+
39
+    int insertChannel(Map<String, Object> channelDate);
40
+
41
+    int importData(Map<String,String> map);
42
+}

+ 509 - 0
depot-basic/src/main/java/com/chinaitop/depot/basic/mapper/MonitorNvrMapper.xml

@@ -0,0 +1,509 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.chinaitop.depot.basic.mapper.MonitorNvrMapper">
4
+  <resultMap id="BaseResultMap" type="com.chinaitop.depot.basic.model.MonitorNvr">
5
+    <constructor>
6
+      <idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
7
+      <arg column="name" javaType="java.lang.String" jdbcType="VARCHAR" />
8
+      <arg column="ip" javaType="java.lang.String" jdbcType="VARCHAR" />
9
+      <arg column="username" javaType="java.lang.String" jdbcType="VARCHAR" />
10
+      <arg column="password" javaType="java.lang.String" jdbcType="VARCHAR" />
11
+      <arg column="type" javaType="java.lang.String" jdbcType="VARCHAR" />
12
+      <arg column="factory" javaType="java.lang.String" jdbcType="VARCHAR" />
13
+      <arg column="port" javaType="java.lang.String" jdbcType="VARCHAR" />
14
+      <arg column="model_num" javaType="java.lang.String" jdbcType="VARCHAR" />
15
+      <arg column="department" javaType="java.lang.String" jdbcType="VARCHAR" />
16
+      <arg column="serialno" javaType="java.lang.String" jdbcType="VARCHAR" />
17
+      <arg column="warden" javaType="java.lang.String" jdbcType="VARCHAR" />
18
+      <arg column="position" javaType="java.lang.String" jdbcType="VARCHAR" />
19
+      <arg column="quantity" javaType="java.lang.String" jdbcType="VARCHAR" />
20
+      <arg column="install_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
21
+      <arg column="subnet_mask" javaType="java.lang.String" jdbcType="VARCHAR" />
22
+      <arg column="alias" javaType="java.lang.String" jdbcType="VARCHAR" />
23
+      <arg column="update_time" javaType="java.util.Date" jdbcType="TIMESTAMP" />
24
+      <arg column="gateway" javaType="java.lang.String" jdbcType="VARCHAR" />
25
+      <arg column="remark" javaType="java.lang.String" jdbcType="VARCHAR" />
26
+      <arg column="delete_mark" javaType="java.lang.String" jdbcType="VARCHAR" />
27
+      <arg column="org_id" javaType="java.lang.String" jdbcType="VARCHAR" />
28
+    </constructor>
29
+  </resultMap>
30
+  <sql id="Example_Where_Clause">
31
+    <where>
32
+      <foreach collection="oredCriteria" item="criteria" separator="or">
33
+        <if test="criteria.valid">
34
+          <trim prefix="(" prefixOverrides="and" suffix=")">
35
+            <foreach collection="criteria.criteria" item="criterion">
36
+              <choose>
37
+                <when test="criterion.noValue">
38
+                  and ${criterion.condition}
39
+                </when>
40
+                <when test="criterion.singleValue">
41
+                  and ${criterion.condition} #{criterion.value}
42
+                </when>
43
+                <when test="criterion.betweenValue">
44
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
45
+                </when>
46
+                <when test="criterion.listValue">
47
+                  and ${criterion.condition}
48
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
49
+                    #{listItem}
50
+                  </foreach>
51
+                </when>
52
+              </choose>
53
+            </foreach>
54
+          </trim>
55
+        </if>
56
+      </foreach>
57
+    </where>
58
+  </sql>
59
+  <sql id="Update_By_Example_Where_Clause">
60
+    <where>
61
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
62
+        <if test="criteria.valid">
63
+          <trim prefix="(" prefixOverrides="and" suffix=")">
64
+            <foreach collection="criteria.criteria" item="criterion">
65
+              <choose>
66
+                <when test="criterion.noValue">
67
+                  and ${criterion.condition}
68
+                </when>
69
+                <when test="criterion.singleValue">
70
+                  and ${criterion.condition} #{criterion.value}
71
+                </when>
72
+                <when test="criterion.betweenValue">
73
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
74
+                </when>
75
+                <when test="criterion.listValue">
76
+                  and ${criterion.condition}
77
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
78
+                    #{listItem}
79
+                  </foreach>
80
+                </when>
81
+              </choose>
82
+            </foreach>
83
+          </trim>
84
+        </if>
85
+      </foreach>
86
+    </where>
87
+  </sql>
88
+  <sql id="Base_Column_List">
89
+    id, name, ip, username, password, type, factory, port, model_num, department, serialno, 
90
+    warden, position, quantity, install_time, subnet_mask, alias, update_time, gateway, 
91
+    remark, delete_mark, org_id
92
+  </sql>
93
+  <select id="selectByExample" parameterType="com.chinaitop.depot.basic.model.MonitorNvrExample" resultMap="BaseResultMap">
94
+    select
95
+    <if test="distinct">
96
+      distinct
97
+    </if>
98
+    <include refid="Base_Column_List" />
99
+    from monitor_nvr
100
+    <if test="_parameter != null">
101
+      <include refid="Example_Where_Clause" />
102
+    </if>
103
+    <if test="orderByClause != null">
104
+      order by ${orderByClause}
105
+    </if>
106
+  </select>
107
+  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
108
+    select 
109
+    <include refid="Base_Column_List" />
110
+    from monitor_nvr
111
+    where id = #{id,jdbcType=INTEGER}
112
+  </select>
113
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
114
+    delete from monitor_nvr
115
+    where id = #{id,jdbcType=INTEGER}
116
+  </delete>
117
+  <delete id="deleteByExample" parameterType="com.chinaitop.depot.basic.model.MonitorNvrExample">
118
+    delete from monitor_nvr
119
+    <if test="_parameter != null">
120
+      <include refid="Example_Where_Clause" />
121
+    </if>
122
+  </delete>
123
+  <insert id="insert" parameterType="com.chinaitop.depot.basic.model.MonitorNvr">
124
+    insert into monitor_nvr (id, name, ip, 
125
+      username, password, type, 
126
+      factory, port, model_num, 
127
+      department, serialno, warden, 
128
+      position, quantity, install_time, 
129
+      subnet_mask, alias, update_time, 
130
+      gateway, remark, delete_mark, 
131
+      org_id)
132
+    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, 
133
+      #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, 
134
+      #{factory,jdbcType=VARCHAR}, #{port,jdbcType=VARCHAR}, #{modelNum,jdbcType=VARCHAR}, 
135
+      #{department,jdbcType=VARCHAR}, #{serialno,jdbcType=VARCHAR}, #{warden,jdbcType=VARCHAR}, 
136
+      #{position,jdbcType=VARCHAR}, #{quantity,jdbcType=VARCHAR}, #{installTime,jdbcType=TIMESTAMP}, 
137
+      #{subnetMask,jdbcType=VARCHAR}, #{alias,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, 
138
+      #{gateway,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{deleteMark,jdbcType=VARCHAR}, 
139
+      #{orgId,jdbcType=VARCHAR})
140
+  </insert>
141
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.basic.model.MonitorNvr">
142
+    insert into monitor_nvr
143
+    <trim prefix="(" suffix=")" suffixOverrides=",">
144
+      <if test="id != null">
145
+        id,
146
+      </if>
147
+      <if test="name != null">
148
+        name,
149
+      </if>
150
+      <if test="ip != null">
151
+        ip,
152
+      </if>
153
+      <if test="username != null">
154
+        username,
155
+      </if>
156
+      <if test="password != null">
157
+        password,
158
+      </if>
159
+      <if test="type != null">
160
+        type,
161
+      </if>
162
+      <if test="factory != null">
163
+        factory,
164
+      </if>
165
+      <if test="port != null">
166
+        port,
167
+      </if>
168
+      <if test="modelNum != null">
169
+        model_num,
170
+      </if>
171
+      <if test="department != null">
172
+        department,
173
+      </if>
174
+      <if test="serialno != null">
175
+        serialno,
176
+      </if>
177
+      <if test="warden != null">
178
+        warden,
179
+      </if>
180
+      <if test="position != null">
181
+        position,
182
+      </if>
183
+      <if test="quantity != null">
184
+        quantity,
185
+      </if>
186
+      <if test="installTime != null">
187
+        install_time,
188
+      </if>
189
+      <if test="subnetMask != null">
190
+        subnet_mask,
191
+      </if>
192
+      <if test="alias != null">
193
+        alias,
194
+      </if>
195
+      <if test="updateTime != null">
196
+        update_time,
197
+      </if>
198
+      <if test="gateway != null">
199
+        gateway,
200
+      </if>
201
+      <if test="remark != null">
202
+        remark,
203
+      </if>
204
+      <if test="deleteMark != null">
205
+        delete_mark,
206
+      </if>
207
+      <if test="orgId != null">
208
+        org_id,
209
+      </if>
210
+    </trim>
211
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
212
+      <if test="id != null">
213
+        #{id,jdbcType=INTEGER},
214
+      </if>
215
+      <if test="name != null">
216
+        #{name,jdbcType=VARCHAR},
217
+      </if>
218
+      <if test="ip != null">
219
+        #{ip,jdbcType=VARCHAR},
220
+      </if>
221
+      <if test="username != null">
222
+        #{username,jdbcType=VARCHAR},
223
+      </if>
224
+      <if test="password != null">
225
+        #{password,jdbcType=VARCHAR},
226
+      </if>
227
+      <if test="type != null">
228
+        #{type,jdbcType=VARCHAR},
229
+      </if>
230
+      <if test="factory != null">
231
+        #{factory,jdbcType=VARCHAR},
232
+      </if>
233
+      <if test="port != null">
234
+        #{port,jdbcType=VARCHAR},
235
+      </if>
236
+      <if test="modelNum != null">
237
+        #{modelNum,jdbcType=VARCHAR},
238
+      </if>
239
+      <if test="department != null">
240
+        #{department,jdbcType=VARCHAR},
241
+      </if>
242
+      <if test="serialno != null">
243
+        #{serialno,jdbcType=VARCHAR},
244
+      </if>
245
+      <if test="warden != null">
246
+        #{warden,jdbcType=VARCHAR},
247
+      </if>
248
+      <if test="position != null">
249
+        #{position,jdbcType=VARCHAR},
250
+      </if>
251
+      <if test="quantity != null">
252
+        #{quantity,jdbcType=VARCHAR},
253
+      </if>
254
+      <if test="installTime != null">
255
+        #{installTime,jdbcType=TIMESTAMP},
256
+      </if>
257
+      <if test="subnetMask != null">
258
+        #{subnetMask,jdbcType=VARCHAR},
259
+      </if>
260
+      <if test="alias != null">
261
+        #{alias,jdbcType=VARCHAR},
262
+      </if>
263
+      <if test="updateTime != null">
264
+        #{updateTime,jdbcType=TIMESTAMP},
265
+      </if>
266
+      <if test="gateway != null">
267
+        #{gateway,jdbcType=VARCHAR},
268
+      </if>
269
+      <if test="remark != null">
270
+        #{remark,jdbcType=VARCHAR},
271
+      </if>
272
+      <if test="deleteMark != null">
273
+        #{deleteMark,jdbcType=VARCHAR},
274
+      </if>
275
+      <if test="orgId != null">
276
+        #{orgId,jdbcType=VARCHAR},
277
+      </if>
278
+    </trim>
279
+  </insert>
280
+  <select id="countByExample" parameterType="com.chinaitop.depot.basic.model.MonitorNvrExample" resultType="java.lang.Long">
281
+    select count(*) from monitor_nvr
282
+    <if test="_parameter != null">
283
+      <include refid="Example_Where_Clause" />
284
+    </if>
285
+  </select>
286
+  <update id="updateByExampleSelective" parameterType="map">
287
+    update monitor_nvr
288
+    <set>
289
+      <if test="record.id != null">
290
+        id = #{record.id,jdbcType=INTEGER},
291
+      </if>
292
+      <if test="record.name != null">
293
+        name = #{record.name,jdbcType=VARCHAR},
294
+      </if>
295
+      <if test="record.ip != null">
296
+        ip = #{record.ip,jdbcType=VARCHAR},
297
+      </if>
298
+      <if test="record.username != null">
299
+        username = #{record.username,jdbcType=VARCHAR},
300
+      </if>
301
+      <if test="record.password != null">
302
+        password = #{record.password,jdbcType=VARCHAR},
303
+      </if>
304
+      <if test="record.type != null">
305
+        type = #{record.type,jdbcType=VARCHAR},
306
+      </if>
307
+      <if test="record.factory != null">
308
+        factory = #{record.factory,jdbcType=VARCHAR},
309
+      </if>
310
+      <if test="record.port != null">
311
+        port = #{record.port,jdbcType=VARCHAR},
312
+      </if>
313
+      <if test="record.modelNum != null">
314
+        model_num = #{record.modelNum,jdbcType=VARCHAR},
315
+      </if>
316
+      <if test="record.department != null">
317
+        department = #{record.department,jdbcType=VARCHAR},
318
+      </if>
319
+      <if test="record.serialno != null">
320
+        serialno = #{record.serialno,jdbcType=VARCHAR},
321
+      </if>
322
+      <if test="record.warden != null">
323
+        warden = #{record.warden,jdbcType=VARCHAR},
324
+      </if>
325
+      <if test="record.position != null">
326
+        position = #{record.position,jdbcType=VARCHAR},
327
+      </if>
328
+      <if test="record.quantity != null">
329
+        quantity = #{record.quantity,jdbcType=VARCHAR},
330
+      </if>
331
+      <if test="record.installTime != null">
332
+        install_time = #{record.installTime,jdbcType=TIMESTAMP},
333
+      </if>
334
+      <if test="record.subnetMask != null">
335
+        subnet_mask = #{record.subnetMask,jdbcType=VARCHAR},
336
+      </if>
337
+      <if test="record.alias != null">
338
+        alias = #{record.alias,jdbcType=VARCHAR},
339
+      </if>
340
+      <if test="record.updateTime != null">
341
+        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
342
+      </if>
343
+      <if test="record.gateway != null">
344
+        gateway = #{record.gateway,jdbcType=VARCHAR},
345
+      </if>
346
+      <if test="record.remark != null">
347
+        remark = #{record.remark,jdbcType=VARCHAR},
348
+      </if>
349
+      <if test="record.deleteMark != null">
350
+        delete_mark = #{record.deleteMark,jdbcType=VARCHAR},
351
+      </if>
352
+      <if test="record.orgId != null">
353
+        org_id = #{record.orgId,jdbcType=VARCHAR},
354
+      </if>
355
+    </set>
356
+    <if test="_parameter != null">
357
+      <include refid="Update_By_Example_Where_Clause" />
358
+    </if>
359
+  </update>
360
+  <update id="updateByExample" parameterType="map">
361
+    update monitor_nvr
362
+    set id = #{record.id,jdbcType=INTEGER},
363
+      name = #{record.name,jdbcType=VARCHAR},
364
+      ip = #{record.ip,jdbcType=VARCHAR},
365
+      username = #{record.username,jdbcType=VARCHAR},
366
+      password = #{record.password,jdbcType=VARCHAR},
367
+      type = #{record.type,jdbcType=VARCHAR},
368
+      factory = #{record.factory,jdbcType=VARCHAR},
369
+      port = #{record.port,jdbcType=VARCHAR},
370
+      model_num = #{record.modelNum,jdbcType=VARCHAR},
371
+      department = #{record.department,jdbcType=VARCHAR},
372
+      serialno = #{record.serialno,jdbcType=VARCHAR},
373
+      warden = #{record.warden,jdbcType=VARCHAR},
374
+      position = #{record.position,jdbcType=VARCHAR},
375
+      quantity = #{record.quantity,jdbcType=VARCHAR},
376
+      install_time = #{record.installTime,jdbcType=TIMESTAMP},
377
+      subnet_mask = #{record.subnetMask,jdbcType=VARCHAR},
378
+      alias = #{record.alias,jdbcType=VARCHAR},
379
+      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
380
+      gateway = #{record.gateway,jdbcType=VARCHAR},
381
+      remark = #{record.remark,jdbcType=VARCHAR},
382
+      delete_mark = #{record.deleteMark,jdbcType=VARCHAR},
383
+      org_id = #{record.orgId,jdbcType=VARCHAR}
384
+    <if test="_parameter != null">
385
+      <include refid="Update_By_Example_Where_Clause" />
386
+    </if>
387
+  </update>
388
+  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.basic.model.MonitorNvr">
389
+    update monitor_nvr
390
+    <set>
391
+      <if test="name != null">
392
+        name = #{name,jdbcType=VARCHAR},
393
+      </if>
394
+      <if test="ip != null">
395
+        ip = #{ip,jdbcType=VARCHAR},
396
+      </if>
397
+      <if test="username != null">
398
+        username = #{username,jdbcType=VARCHAR},
399
+      </if>
400
+      <if test="password != null">
401
+        password = #{password,jdbcType=VARCHAR},
402
+      </if>
403
+      <if test="type != null">
404
+        type = #{type,jdbcType=VARCHAR},
405
+      </if>
406
+      <if test="factory != null">
407
+        factory = #{factory,jdbcType=VARCHAR},
408
+      </if>
409
+      <if test="port != null">
410
+        port = #{port,jdbcType=VARCHAR},
411
+      </if>
412
+      <if test="modelNum != null">
413
+        model_num = #{modelNum,jdbcType=VARCHAR},
414
+      </if>
415
+      <if test="department != null">
416
+        department = #{department,jdbcType=VARCHAR},
417
+      </if>
418
+      <if test="serialno != null">
419
+        serialno = #{serialno,jdbcType=VARCHAR},
420
+      </if>
421
+      <if test="warden != null">
422
+        warden = #{warden,jdbcType=VARCHAR},
423
+      </if>
424
+      <if test="position != null">
425
+        position = #{position,jdbcType=VARCHAR},
426
+      </if>
427
+      <if test="quantity != null">
428
+        quantity = #{quantity,jdbcType=VARCHAR},
429
+      </if>
430
+      <if test="installTime != null">
431
+        install_time = #{installTime,jdbcType=TIMESTAMP},
432
+      </if>
433
+      <if test="subnetMask != null">
434
+        subnet_mask = #{subnetMask,jdbcType=VARCHAR},
435
+      </if>
436
+      <if test="alias != null">
437
+        alias = #{alias,jdbcType=VARCHAR},
438
+      </if>
439
+      <if test="updateTime != null">
440
+        update_time = #{updateTime,jdbcType=TIMESTAMP},
441
+      </if>
442
+      <if test="gateway != null">
443
+        gateway = #{gateway,jdbcType=VARCHAR},
444
+      </if>
445
+      <if test="remark != null">
446
+        remark = #{remark,jdbcType=VARCHAR},
447
+      </if>
448
+      <if test="deleteMark != null">
449
+        delete_mark = #{deleteMark,jdbcType=VARCHAR},
450
+      </if>
451
+      <if test="orgId != null">
452
+        org_id = #{orgId,jdbcType=VARCHAR},
453
+      </if>
454
+    </set>
455
+    where id = #{id,jdbcType=INTEGER}
456
+  </update>
457
+  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.basic.model.MonitorNvr">
458
+    update monitor_nvr
459
+    set name = #{name,jdbcType=VARCHAR},
460
+      ip = #{ip,jdbcType=VARCHAR},
461
+      username = #{username,jdbcType=VARCHAR},
462
+      password = #{password,jdbcType=VARCHAR},
463
+      type = #{type,jdbcType=VARCHAR},
464
+      factory = #{factory,jdbcType=VARCHAR},
465
+      port = #{port,jdbcType=VARCHAR},
466
+      model_num = #{modelNum,jdbcType=VARCHAR},
467
+      department = #{department,jdbcType=VARCHAR},
468
+      serialno = #{serialno,jdbcType=VARCHAR},
469
+      warden = #{warden,jdbcType=VARCHAR},
470
+      position = #{position,jdbcType=VARCHAR},
471
+      quantity = #{quantity,jdbcType=VARCHAR},
472
+      install_time = #{installTime,jdbcType=TIMESTAMP},
473
+      subnet_mask = #{subnetMask,jdbcType=VARCHAR},
474
+      alias = #{alias,jdbcType=VARCHAR},
475
+      update_time = #{updateTime,jdbcType=TIMESTAMP},
476
+      gateway = #{gateway,jdbcType=VARCHAR},
477
+      remark = #{remark,jdbcType=VARCHAR},
478
+      delete_mark = #{deleteMark,jdbcType=VARCHAR},
479
+      org_id = #{orgId,jdbcType=VARCHAR}
480
+    where id = #{id,jdbcType=INTEGER}
481
+  </update>
482
+
483
+  <delete id="deleteNvrCameraByNVRID" parameterType="java.lang.Integer">
484
+    delete from monitor_nvr_camera
485
+    where nvr_id = #{nvrId,jdbcType=INTEGER}
486
+  </delete>
487
+
488
+  <select id="getThroughByNVRId" parameterType="java.lang.Integer" resultType="java.util.HashMap">
489
+    SELECT
490
+        c.alias,
491
+        c.ip,
492
+        nc.channel_number
493
+    FROM
494
+        depot.monitor_nvr_camera nc
495
+    JOIN depot.monitor_camera c ON c.id = nc.camera_id
496
+    WHERE nc.nvr_id=#{nvrId,jdbcType=INTEGER}
497
+  </select>
498
+
499
+  <insert id="insertChannel" parameterType="map">
500
+    insert into monitor_nvr_camera (nvr_id,camera_id,channel_number)
501
+    values ${channel}
502
+  </insert>
503
+
504
+  <insert id="importData" parameterType="java.util.Map">
505
+      INSERT INTO monitor_nvr (org_id,name,alias,factory,model_num,type,ip,gateway,subnet_mask,username,password,port,warden,position,remark) VALUES
506
+      ${sql}
507
+  </insert>
508
+  
509
+</mapper>

+ 24 - 0
depot-basic/src/main/java/com/chinaitop/depot/basic/mapper/MonitorPresetMapper.java

@@ -0,0 +1,24 @@
1
+package com.chinaitop.depot.basic.mapper;
2
+
3
+import com.chinaitop.depot.basic.model.MonitorPreset;
4
+import com.chinaitop.depot.basic.model.MonitorPresetExample;
5
+import java.util.List;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.springframework.stereotype.Repository;
8
+
9
+@Repository
10
+public interface MonitorPresetMapper {
11
+    long countByExample(MonitorPresetExample example);
12
+
13
+    int deleteByExample(MonitorPresetExample example);
14
+
15
+    int insert(MonitorPreset record);
16
+
17
+    int insertSelective(MonitorPreset record);
18
+
19
+    List<MonitorPreset> selectByExample(MonitorPresetExample example);
20
+
21
+    int updateByExampleSelective(@Param("record") MonitorPreset record, @Param("example") MonitorPresetExample example);
22
+
23
+    int updateByExample(@Param("record") MonitorPreset record, @Param("example") MonitorPresetExample example);
24
+}

+ 190 - 0
depot-basic/src/main/java/com/chinaitop/depot/basic/mapper/MonitorPresetMapper.xml

@@ -0,0 +1,190 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.chinaitop.depot.basic.mapper.MonitorPresetMapper">
4
+  <resultMap id="BaseResultMap" type="com.chinaitop.depot.basic.model.MonitorPreset">
5
+    <constructor>
6
+      <arg column="nvr_ip" javaType="java.lang.String" jdbcType="VARCHAR" />
7
+      <arg column="camera_id" javaType="java.lang.String" jdbcType="VARCHAR" />
8
+      <arg column="channel_number" javaType="java.lang.String" jdbcType="VARCHAR" />
9
+      <arg column="position" javaType="java.lang.String" jdbcType="VARCHAR" />
10
+      <arg column="preset_type" javaType="java.lang.String" jdbcType="VARCHAR" />
11
+      <arg column="remark" javaType="java.lang.String" jdbcType="VARCHAR" />
12
+    </constructor>
13
+  </resultMap>
14
+  <sql id="Example_Where_Clause">
15
+    <where>
16
+      <foreach collection="oredCriteria" item="criteria" separator="or">
17
+        <if test="criteria.valid">
18
+          <trim prefix="(" prefixOverrides="and" suffix=")">
19
+            <foreach collection="criteria.criteria" item="criterion">
20
+              <choose>
21
+                <when test="criterion.noValue">
22
+                  and ${criterion.condition}
23
+                </when>
24
+                <when test="criterion.singleValue">
25
+                  and ${criterion.condition} #{criterion.value}
26
+                </when>
27
+                <when test="criterion.betweenValue">
28
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
29
+                </when>
30
+                <when test="criterion.listValue">
31
+                  and ${criterion.condition}
32
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
33
+                    #{listItem}
34
+                  </foreach>
35
+                </when>
36
+              </choose>
37
+            </foreach>
38
+          </trim>
39
+        </if>
40
+      </foreach>
41
+    </where>
42
+  </sql>
43
+  <sql id="Update_By_Example_Where_Clause">
44
+    <where>
45
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
46
+        <if test="criteria.valid">
47
+          <trim prefix="(" prefixOverrides="and" suffix=")">
48
+            <foreach collection="criteria.criteria" item="criterion">
49
+              <choose>
50
+                <when test="criterion.noValue">
51
+                  and ${criterion.condition}
52
+                </when>
53
+                <when test="criterion.singleValue">
54
+                  and ${criterion.condition} #{criterion.value}
55
+                </when>
56
+                <when test="criterion.betweenValue">
57
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
58
+                </when>
59
+                <when test="criterion.listValue">
60
+                  and ${criterion.condition}
61
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
62
+                    #{listItem}
63
+                  </foreach>
64
+                </when>
65
+              </choose>
66
+            </foreach>
67
+          </trim>
68
+        </if>
69
+      </foreach>
70
+    </where>
71
+  </sql>
72
+  <sql id="Base_Column_List">
73
+    nvr_ip, camera_id, channel_number, position, preset_type, remark
74
+  </sql>
75
+  <select id="selectByExample" parameterType="com.chinaitop.depot.basic.model.MonitorPresetExample" resultMap="BaseResultMap">
76
+    select
77
+    <if test="distinct">
78
+      distinct
79
+    </if>
80
+    <include refid="Base_Column_List" />
81
+    from monitor_preset
82
+    <if test="_parameter != null">
83
+      <include refid="Example_Where_Clause" />
84
+    </if>
85
+    <if test="orderByClause != null">
86
+      order by ${orderByClause}
87
+    </if>
88
+  </select>
89
+  <delete id="deleteByExample" parameterType="com.chinaitop.depot.basic.model.MonitorPresetExample">
90
+    delete from monitor_preset
91
+    <if test="_parameter != null">
92
+      <include refid="Example_Where_Clause" />
93
+    </if>
94
+  </delete>
95
+  <insert id="insert" parameterType="com.chinaitop.depot.basic.model.MonitorPreset">
96
+    insert into monitor_preset (nvr_ip, camera_id, channel_number, 
97
+      position, preset_type, remark
98
+      )
99
+    values (#{nvrIp,jdbcType=VARCHAR}, #{cameraId,jdbcType=VARCHAR}, #{channelNumber,jdbcType=VARCHAR}, 
100
+      #{position,jdbcType=VARCHAR}, #{presetType,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}
101
+      )
102
+  </insert>
103
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.basic.model.MonitorPreset">
104
+    insert into monitor_preset
105
+    <trim prefix="(" suffix=")" suffixOverrides=",">
106
+      <if test="nvrIp != null">
107
+        nvr_ip,
108
+      </if>
109
+      <if test="cameraId != null">
110
+        camera_id,
111
+      </if>
112
+      <if test="channelNumber != null">
113
+        channel_number,
114
+      </if>
115
+      <if test="position != null">
116
+        position,
117
+      </if>
118
+      <if test="presetType != null">
119
+        preset_type,
120
+      </if>
121
+      <if test="remark != null">
122
+        remark,
123
+      </if>
124
+    </trim>
125
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
126
+      <if test="nvrIp != null">
127
+        #{nvrIp,jdbcType=VARCHAR},
128
+      </if>
129
+      <if test="cameraId != null">
130
+        #{cameraId,jdbcType=VARCHAR},
131
+      </if>
132
+      <if test="channelNumber != null">
133
+        #{channelNumber,jdbcType=VARCHAR},
134
+      </if>
135
+      <if test="position != null">
136
+        #{position,jdbcType=VARCHAR},
137
+      </if>
138
+      <if test="presetType != null">
139
+        #{presetType,jdbcType=VARCHAR},
140
+      </if>
141
+      <if test="remark != null">
142
+        #{remark,jdbcType=VARCHAR},
143
+      </if>
144
+    </trim>
145
+  </insert>
146
+  <select id="countByExample" parameterType="com.chinaitop.depot.basic.model.MonitorPresetExample" resultType="java.lang.Long">
147
+    select count(*) from monitor_preset
148
+    <if test="_parameter != null">
149
+      <include refid="Example_Where_Clause" />
150
+    </if>
151
+  </select>
152
+  <update id="updateByExampleSelective" parameterType="map">
153
+    update monitor_preset
154
+    <set>
155
+      <if test="record.nvrIp != null">
156
+        nvr_ip = #{record.nvrIp,jdbcType=VARCHAR},
157
+      </if>
158
+      <if test="record.cameraId != null">
159
+        camera_id = #{record.cameraId,jdbcType=VARCHAR},
160
+      </if>
161
+      <if test="record.channelNumber != null">
162
+        channel_number = #{record.channelNumber,jdbcType=VARCHAR},
163
+      </if>
164
+      <if test="record.position != null">
165
+        position = #{record.position,jdbcType=VARCHAR},
166
+      </if>
167
+      <if test="record.presetType != null">
168
+        preset_type = #{record.presetType,jdbcType=VARCHAR},
169
+      </if>
170
+      <if test="record.remark != null">
171
+        remark = #{record.remark,jdbcType=VARCHAR},
172
+      </if>
173
+    </set>
174
+    <if test="_parameter != null">
175
+      <include refid="Update_By_Example_Where_Clause" />
176
+    </if>
177
+  </update>
178
+  <update id="updateByExample" parameterType="map">
179
+    update monitor_preset
180
+    set nvr_ip = #{record.nvrIp,jdbcType=VARCHAR},
181
+      camera_id = #{record.cameraId,jdbcType=VARCHAR},
182
+      channel_number = #{record.channelNumber,jdbcType=VARCHAR},
183
+      position = #{record.position,jdbcType=VARCHAR},
184
+      preset_type = #{record.presetType,jdbcType=VARCHAR},
185
+      remark = #{record.remark,jdbcType=VARCHAR}
186
+    <if test="_parameter != null">
187
+      <include refid="Update_By_Example_Where_Clause" />
188
+    </if>
189
+  </update>
190
+</mapper>