张磊磊
2023-10-30 02250050642686e23e7f44cf1cea1ff4501baf03
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
<?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.thhy.materials.modules.biz.helmet.mapper.HelmetMapper">
  <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Tue Oct 10 10:55:08 CST 2023.
    -->
    <id column="helmet_device_id" jdbcType="VARCHAR" property="helmetDeviceId" />
    <result column="device_num" jdbcType="VARCHAR" property="deviceNum" />
    <result column="user_id" jdbcType="INTEGER" property="userId" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
  </resultMap>
 
 
  <select id="helmetServiceList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
    select helmet_device_id as helmetDeviceId,
    device_num as deviceNum,
    user_id as userId,
    user_name as userName
     from  t_helmet_device
  </select>
  <select id="userIdIid" parameterType="java.lang.Integer" resultType="java.lang.Integer">
    SELECT
    i_id
FROM
    t_helmet_picture
where user_id=#{userId}
ORDER BY
    i_id DESC
    LIMIT 0,1
  </select>
  <select id="userIdReport" parameterType="java.lang.Integer" resultType="java.lang.Integer">
    SELECT
    s_id
FROM
    t_helmet_report
where user_id=#{userId}
ORDER BY
    s_id DESC
    LIMIT 0,1
  </select>
  <insert id="helmetPictureInsert" parameterType="com.thhy.materials.modules.biz.helmet.entity.THelmetPicture">
    insert into t_helmet_picture
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="helmetPictureId != null">
        helmet_picture_id,
      </if>
      <if test="imageUrl != null">
        image_url,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="xPoint != null">
        x_point,
      </if>
      <if test="yPoint != null">
        y_point,
      </if>
      <if test="creTime != null">
        cre_time,
      </if>
      <if test="iId != null">
        i_id,
      </if>
      <if test="smTime != null">
        sm_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="helmetPictureId != null">
        #{helmetPictureId,jdbcType=INTEGER},
      </if>
      <if test="imageUrl != null">
        #{imageUrl,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="xPoint != null">
        #{xPoint,jdbcType=VARCHAR},
      </if>
      <if test="yPoint != null">
        #{yPoint,jdbcType=VARCHAR},
      </if>
      <if test="creTime != null">
        #{creTime,jdbcType=VARCHAR},
      </if>
      <if test="iId != null">
        #{iId,jdbcType=INTEGER},
      </if>
      <if test="smTime != null">
        #{smTime},
      </if>
    </trim>
  </insert>
  <insert id="helmetReportInsert" >
    insert into t_helmet_report
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="reportId != null">
        report_id,
      </if>
      <if test="sId != null">
        s_id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="userName != null">
        user_name,
      </if>
      <if test="deviceId != null">
        device_id,
      </if>
      <if test="xPoint != null">
        x_point,
      </if>
      <if test="yPoint != null">
        y_point,
      </if>
      <if test="cTime != null">
        c_time,
      </if>
      <if test="sosType != null">
        sos_type,
      </if>
      <if test="msg != null">
        msg,
      </if>
      <if test="imgurl != null">
        imgurl,
      </if>
      <if test="mobile != null">
        mobile,
      </if>
      <if test="smTime != null">
        sm_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="reportId != null">
        #{reportId,jdbcType=INTEGER},
      </if>
      <if test="sId != null">
        #{sId,jdbcType=INTEGER},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="deviceId != null">
        #{deviceId,jdbcType=VARCHAR},
      </if>
      <if test="xPoint != null">
        #{xPoint,jdbcType=VARCHAR},
      </if>
      <if test="yPoint != null">
        #{yPoint,jdbcType=VARCHAR},
      </if>
      <if test="cTime != null">
        #{cTime,jdbcType=VARCHAR},
      </if>
      <if test="sosType != null">
        #{sosType,jdbcType=VARCHAR},
      </if>
      <if test="msg != null">
        #{msg,jdbcType=VARCHAR},
      </if>
      <if test="imgurl != null">
        #{imgurl,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="smTime != null">
        #{smTime,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="trajectory"  resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetTrajectory">
        SELECT
    trajectory_id AS trajectoryId,
    ctime,
    ltime,
    sec,
    user_id AS userId
FROM
    t_helmet_trajectory
WHERE
    ctime = #{ctime} and user_id=#{userId}
  </select>
  <insert id="helmetTrajectoryInsert" >
    insert into t_helmet_trajectory
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="trajectoryId != null">
        trajectory_id,
      </if>
      <if test="ctime != null">
        ctime,
      </if>
      <if test="ltime != null">
        ltime,
      </if>
      <if test="sec != null">
        sec,
      </if>
      <if test="userId != null">
        user_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="trajectoryId != null">
        #{trajectoryId,jdbcType=INTEGER},
      </if>
      <if test="ctime != null">
        #{ctime,jdbcType=VARCHAR},
      </if>
      <if test="ltime != null">
        #{ltime,jdbcType=VARCHAR},
      </if>
      <if test="sec != null">
        #{sec,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
 
  <update id="helmetTrajectoryUpdate">
    update t_helmet_trajectory
    <set>
      <if test="ctime != null">
        ctime = #{ctime,jdbcType=VARCHAR},
      </if>
      <if test="ltime != null">
        ltime = #{ltime,jdbcType=VARCHAR},
      </if>
      <if test="sec != null">
        sec = #{sec,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        user_id = #{userId,jdbcType=INTEGER},
      </if>
    </set>
    where trajectory_id = #{trajectoryId,jdbcType=INTEGER}
  </update>
  <select id="helmetMotion" parameterType="java.lang.Integer" resultType="java.lang.String">
    select times from  t_helmet_motion where  user_id=#{userId} order by times desc limit 0,1
  </select>
  <insert id="helmetMotionInsert">
    insert into t_helmet_motion
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="motionId != null">
        motion_id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="xPoint != null">
        x_point,
      </if>
      <if test="yPoint != null">
        y_point,
      </if>
      <if test="times != null">
        times,
      </if>
      <if test="cAngle != null">
        c_angle,
      </if>
      <if test="cSpeed != null">
        c_speed,
      </if>
      <if test="cTrust != null">
        c_trust,
      </if>
      <if test="smTime != null">
        sm_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="motionId != null">
        #{motionId,jdbcType=INTEGER},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="xPoint != null">
        #{xPoint,jdbcType=VARCHAR},
      </if>
      <if test="yPoint != null">
        #{yPoint,jdbcType=VARCHAR},
      </if>
      <if test="times != null">
        #{times,jdbcType=VARCHAR},
      </if>
      <if test="cAngle != null">
        #{cAngle,jdbcType=VARCHAR},
      </if>
      <if test="cSpeed != null">
        #{cSpeed,jdbcType=VARCHAR},
      </if>
      <if test="cTrust != null">
        #{cTrust,jdbcType=VARCHAR},
      </if>
      <if test="smTime != null">
        #{smTime,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <select id="helmetList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetDevice">
  select helmet_device_id as helmetDeviceId,
      device_num as deviceNum,
      user_id as userId,
      user_name as userName
       from  t_helmet_device
       where 1=1
       <if test="userName!=null and userName!='' ">
            and user_name like concat('%',#{userName},'%')
       </if>
      <if test="deviceNum!=null and deviceNum!='' ">
        and device_num like concat('%',#{deviceNum},'%')
      </if>
  </select>
 
  <select id="helmetPictureList" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetPicture">
        select
         thp.image_url as imageUrl,
         thp.user_id as userId,
         thp.x_point as xPoint,
         thp.y_point as yPoint,
         thp.cre_time as creTime,
         thp.i_id as iId,
         thp.sm_time as smTime
         from t_helmet_picture thp
        where 1=1
        <if test="userId!=null and userId!='' ">
            and thp.user_id=#{userId}
        </if>
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
          and thp.sm_time between #{strTime} and #{endTime}
        </if>
        order by thp.cre_time desc
  </select>
 
  <select id="helmetTrajectoryList"  resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetTrajectory">
    select
    trajectory_id as trajectoryId,
    ctime,
    ltime,
    sec
    from  t_helmet_trajectory where  1=1
    <if test="userId!=null and userId!='' ">
        and user_id=#{userId}
    </if>
    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
      and ctime between #{strTime} and #{endTime}
    </if>
  </select>
 
  <select id="helmetTrajectoryTime" resultType="java.lang.String">
        SELECT
    SUM( ltime )
FROM
    t_helmet_trajectory
WHERE
    1=1
    <if test="userId!=null and userId!='' ">
      and user_id=#{userId}
    </if>
    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
      and ctime between #{strTime} and #{endTime}
    </if>
GROUP BY
    user_id
  </select>
 
  <select id="helmetMotionList"  resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetMotion">
    select
    motion_id as motionId,
    user_id as userId,
    x_point as xPoint,
    y_point as yPoint,
    times,
    c_angle as cAngle,
    c_speed as cSpeed,
    c_trust as cTrust,
    sm_time as smTime
     from t_helmet_motion
    where
    user_id=#{userId}
    <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
        and  sm_time between #{strTime} and #{endTime}
    </if>
    order by times asc
  </select>
 
  <insert id="dataValueInsert" >
    insert into t_data_value
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="dataId != null">
        data_id,
      </if>
      <if test="deviceId != null">
        device_id,
      </if>
      <if test="deviceName != null">
        device_name,
      </if>
      <if test="accountNumber != null">
        account_number,
      </if>
      <if test="uploadTime != null">
        upload_time,
      </if>
      <if test="pm25 != null">
        pm25,
      </if>
      <if test="pm10 != null">
        pm10,
      </if>
      <if test="tsp != null">
        tsp,
      </if>
      <if test="temperature != null">
        temperature,
      </if>
      <if test="humidity != null">
        humidity,
      </if>
      <if test="data6 != null">
        data6,
      </if>
      <if test="windSpeed != null">
        wind_speed,
      </if>
      <if test="windDirection != null">
        wind_direction,
      </if>
      <if test="tvoc != null">
        tvoc,
      </if>
      <if test="no2 != null">
        no2,
      </if>
      <if test="co != null">
        co,
      </if>
      <if test="so2 != null">
        so2,
      </if>
      <if test="o3 != null">
        o3,
      </if>
      <if test="noise != null">
        noise,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="dataId != null">
        #{dataId,jdbcType=INTEGER},
      </if>
      <if test="deviceId != null">
        #{deviceId,jdbcType=INTEGER},
      </if>
      <if test="deviceName != null">
        #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="accountNumber != null">
        #{accountNumber,jdbcType=VARCHAR},
      </if>
      <if test="uploadTime != null">
        #{uploadTime,jdbcType=VARCHAR},
      </if>
      <if test="pm25 != null">
        #{pm25,jdbcType=VARCHAR},
      </if>
      <if test="pm10 != null">
        #{pm10,jdbcType=VARCHAR},
      </if>
      <if test="tsp != null">
        #{tsp,jdbcType=VARCHAR},
      </if>
      <if test="temperature != null">
        #{temperature,jdbcType=VARCHAR},
      </if>
      <if test="humidity != null">
        #{humidity,jdbcType=VARCHAR},
      </if>
      <if test="data6 != null">
        #{data6,jdbcType=VARCHAR},
      </if>
      <if test="windSpeed != null">
        #{windSpeed,jdbcType=VARCHAR},
      </if>
      <if test="windDirection != null">
        #{windDirection,jdbcType=VARCHAR},
      </if>
      <if test="tvoc != null">
        #{tvoc,jdbcType=VARCHAR},
      </if>
      <if test="no2 != null">
        #{no2,jdbcType=VARCHAR},
      </if>
      <if test="co != null">
        #{co,jdbcType=VARCHAR},
      </if>
      <if test="so2 != null">
        #{so2,jdbcType=VARCHAR},
      </if>
      <if test="o3 != null">
        #{o3,jdbcType=VARCHAR},
      </if>
      <if test="noise != null">
        #{noise,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <select id="helmetReportTotal" resultType="com.thhy.materials.modules.biz.helmet.entity.dto.ReportNumDto">
       SELECT
      COUNT(sm_time) AS num,
      DATE(sm_time) as smTime
  FROM
      t_helmet_report
  WHERE
      user_id = #{userId}
      <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
        and DATE(sm_time) between #{strTime} and #{endTime}
      </if>
  GROUP BY
      DATE( sm_time )
  </select>
 
  <select id="helmetReportUser" resultType="com.thhy.materials.modules.biz.helmet.entity.THelmetReport">
        select user_id as userId,
         user_name as userName,
         sos_type as sosType,
         x_point as xPoint,
         y_point as yPoint,
         sm_time as smTime
         from t_helmet_report where
        user_id=#{userId}
      <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
        and sm_time between #{strTime} and #{endTime}
      </if>
        order by sm_time desc
  </select>
 
  <insert id="smockInser" >
    insert into t_data_smock
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="smokeId != null">
        smoke_id,
      </if>
      <if test="gatewayCyc != null">
        gateway_cyc,
      </if>
      <if test="fans != null">
        FanS,
      </if>
      <if test="v1run != null">
        V1Run,
      </if>
      <if test="uv1run != null">
        UV1Run,
      </if>
      <if test="fanrun != null">
        FanRun,
      </if>
      <if test="uv2run != null">
        UV2Run,
      </if>
      <if test="ssvrun != null">
        SSVRun,
      </if>
      <if test="dp != null">
        DP,
      </if>
      <if test="t != null">
        T,
      </if>
      <if test="oc != null">
        OC,
      </if>
      <if test="gatew != null">
        gatew,
      </if>
      <if test="nxrun != null">
        NXRun,
      </if>
      <if test="alarm != null">
        Alarm,
      </if>
      <if test="times != null">
        times,
      </if>
      <if test="rtcVolt != null">
        RTC_VOLT,
      </if>
      <if test="v2run != null">
        V2Run,
      </if>
      <if test="dxqvrun != null">
        DXQVRun,
      </if>
      <if test="press != null">
        Press,
      </if>
      <if test="dc != null">
        Dc,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="smokeId != null">
        #{smokeId,jdbcType=INTEGER},
      </if>
      <if test="gatewayCyc != null">
        #{gatewayCyc,jdbcType=VARCHAR},
      </if>
      <if test="fans != null">
        #{fans,jdbcType=VARCHAR},
      </if>
      <if test="v1run != null">
        #{v1run,jdbcType=VARCHAR},
      </if>
      <if test="uv1run != null">
        #{uv1run,jdbcType=VARCHAR},
      </if>
      <if test="fanrun != null">
        #{fanrun,jdbcType=VARCHAR},
      </if>
      <if test="uv2run != null">
        #{uv2run,jdbcType=VARCHAR},
      </if>
      <if test="ssvrun != null">
        #{ssvrun,jdbcType=VARCHAR},
      </if>
      <if test="dp != null">
        #{dp,jdbcType=VARCHAR},
      </if>
      <if test="t != null">
        #{t,jdbcType=VARCHAR},
      </if>
      <if test="oc != null">
        #{oc,jdbcType=VARCHAR},
      </if>
      <if test="gatew != null">
        #{gatew,jdbcType=VARCHAR},
      </if>
      <if test="nxrun != null">
        #{nxrun,jdbcType=VARCHAR},
      </if>
      <if test="alarm != null">
        #{alarm,jdbcType=VARCHAR},
      </if>
      <if test="times != null">
        #{times,jdbcType=VARCHAR},
      </if>
      <if test="rtcVolt != null">
        #{rtcVolt,jdbcType=VARCHAR},
      </if>
      <if test="v2run != null">
        #{v2run,jdbcType=VARCHAR},
      </if>
      <if test="dxqvrun != null">
        #{dxqvrun,jdbcType=VARCHAR},
      </if>
      <if test="press != null">
        #{press,jdbcType=VARCHAR},
      </if>
      <if test="dc != null">
        #{dc,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <select id="dataSmockList" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataSmock">
    select
    smoke_id as smokeId,
    gateway_cyc as gatewayCyc,
    FanS as fans,
    V1Run as v1run,
    UV1Run as uv1run,
    FanRun as fanrun,
    UV2Run as uv2run,
    SSVRun as ssvrun,
    DP as dp,
    T as t,
    OC as oc,
    gatew as gatew,
    NXRun as nxrun,
    Alarm as alarm,
    times as times,
    RTC_VOLT as rtcVolt,
    V2Run as v2run,
    DXQVRun as dxqvrun,
    Press as press,
    Dc as dc
     from  t_data_smock
    where 1=1
    <if test="strTime!=null and endTime!=null and strTime!='' and endTime!='' ">
        and times between #{strTime} and #{endTime}
    </if>
    order by times desc
  </select>
  <select id="dataValuesList" resultType="com.thhy.materials.modules.biz.helmet.entity.TDataValue">
        select
 data_id as dataId,
 device_id as deviceId,
  device_name as deviceName,
   account_number as accountNumber,
    upload_time as uploadTime,
     pm25 as pm25,
      pm10 as pm10,
      tsp as tsp,
      temperature as temperature,
    humidity as humidity,
     data6 as data6,
      wind_speed as windSpeed,
      wind_direction as windDirection,
       tvoc as tvoc,
        no2 as no2,
        co as co,
         so2 as so2,
          o3 as o3,
          noise as noise
         from t_data_value
        where 1=1
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
        and upload_time between #{strTime} and #{endTime}
        </if>
        order by upload_time desc
  </select>
 
</mapper>