邱宇豪
2023-11-01 9100d3fa53c50ba5c5ca3972724a9f8ad905eea0
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
<?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.engineering.modules.biz.device.mapper.TBigDeviceMapper">
  <resultMap id="BaseResultMap" type="com.thhy.engineering.modules.biz.device.entity.TBigDevice">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 15 16:41:32 CST 2023.
    -->
    <id column="big_device_id" jdbcType="VARCHAR" property="bigDeviceId" />
    <result column="big_device_Name" jdbcType="VARCHAR" property="bigDeviceName" />
    <result column="big_device_model" jdbcType="VARCHAR" property="bigDeviceModel" />
    <result column="big_number" jdbcType="VARCHAR" property="bigNumber" />
    <result column="big_type" jdbcType="VARCHAR" property="bigType" />
    <result column="big_position" jdbcType="VARCHAR" property="bigPosition" />
    <result column="big_state" jdbcType="INTEGER" property="bigState" />
    <result column="purchase_time" jdbcType="TIMESTAMP" property="purchaseTime" />
    <result column="supplier_id" jdbcType="VARCHAR" property="supplierId" />
    <result column="use_life" jdbcType="VARCHAR" property="useLife" />
    <result column="key_cabinet" jdbcType="VARCHAR" property="keyCabinet" />
    <result column="user_id" jdbcType="VARCHAR" property="userId" />
    <result column="big_notes" jdbcType="VARCHAR" property="bigNotes" />
    <result column="safety_code" jdbcType="INTEGER" property="safetyCode" />
    <result column="is_certificate" jdbcType="INTEGER" property="isCertificate" />
    <result column="is_use" jdbcType="INTEGER" property="isUse" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
 
    <result column="company_id" jdbcType="VARCHAR" property="companyId" />
    <result column="manufacturer" jdbcType="VARCHAR" property="manufacturer" />
    <result column="date_of_production" jdbcType="TIMESTAMP" property="dateOfProduction" />
    <result column="use_year_month" jdbcType="TIMESTAMP" property="useYearMonth" />
    <result column="shape_size" jdbcType="VARCHAR" property="shapeSize" />
    <result column="total_power" jdbcType="VARCHAR" property="totalPower" />
    <result column="total_weight" jdbcType="VARCHAR" property="totalWeight" />
    <result column="original_value" jdbcType="VARCHAR" property="originalValue" />
    <result column="year_depreciation_rate" jdbcType="VARCHAR" property="yearDepreciationRate" />
    <result column="accumulated_depreciation" jdbcType="VARCHAR" property="accumulatedDepreciation" />
    <result column="net_worth" jdbcType="VARCHAR" property="netWorth" />
    <result column="use_status" jdbcType="INTEGER" property="useStatus" />
    <result column="is_need" jdbcType="INTEGER" property="isNeed" />
    <result column="device_source" jdbcType="VARCHAR" property="deviceSource" />
    <result column="device_nexus" jdbcType="VARCHAR" property="deviceNexus" />
    <result column="fixed_person" jdbcType="VARCHAR" property="fixedPerson" />
  </resultMap>
 
 
  <select id="bigNumberByOne" resultType="java.lang.String" parameterType="java.lang.String">
    select big_device_id from t_big_device
    where is_use=1 and big_number=#{bigNumber} and company_id=#{companyId}
  </select>
  <insert id="bigDeviceInsert" >
    insert into t_big_device
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="bigDeviceId != null">
        big_device_id,
      </if>
      <if test="bigDeviceName != null">
        big_device_Name,
      </if>
      <if test="bigDeviceModel != null">
        big_device_model,
      </if>
      <if test="bigNumber != null">
        big_number,
      </if>
      <if test="bigType != null">
        big_type,
      </if>
      <if test="bigPosition != null">
        big_position,
      </if>
      <if test="bigState != null">
        big_state,
      </if>
      <if test="purchaseTime != null">
        purchase_time,
      </if>
      <if test="supplierId != null">
        supplier_id,
      </if>
      <if test="useLife != null">
        use_life,
      </if>
      <if test="keyCabinet != null">
        key_cabinet,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="bigNotes != null">
        big_notes,
      </if>
      <if test="safetyCode != null">
        safety_code,
      </if>
      <if test="isCertificate != null">
        is_certificate,
      </if>
      <if test="isUse != null">
        is_use,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
      <if test="manufacturer != null">
        manufacturer,
      </if>
      <if test="dateOfProduction != null">
        date_of_production,
      </if>
      <if test="useYearMonth != null">
        use_year_month,
      </if>
      <if test="shapeSize != null">
        shape_size,
      </if>
      <if test="totalPower != null">
        total_power,
      </if>
      <if test="totalWeight != null">
        total_weight,
      </if>
      <if test="originalValue != null">
        original_value,
      </if>
      <if test="yearDepreciationRate != null">
        year_depreciation_rate,
      </if>
      <if test="accumulatedDepreciation != null">
        accumulated_depreciation,
      </if>
      <if test="netWorth != null">
        net_worth,
      </if>
      <if test="useStatus != null">
        use_status,
      </if>
      <if test="isNeed != null">
        is_need,
      </if>
      <if test="deviceSource != null">
        device_source,
      </if>
      <if test="deviceNexus != null">
        device_nexus,
      </if>
      <if test="fixedPerson != null">
        fixed_person,
      </if>
      <if test="adminPhone != null">
        admin_phone,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="bigDeviceId != null">
        #{bigDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="bigDeviceName != null">
        #{bigDeviceName,jdbcType=VARCHAR},
      </if>
      <if test="bigDeviceModel != null">
        #{bigDeviceModel,jdbcType=VARCHAR},
      </if>
      <if test="bigNumber != null">
        #{bigNumber,jdbcType=VARCHAR},
      </if>
      <if test="bigType != null">
        #{bigType,jdbcType=VARCHAR},
      </if>
      <if test="bigPosition != null">
        #{bigPosition,jdbcType=VARCHAR},
      </if>
      <if test="bigState != null">
        #{bigState,jdbcType=INTEGER},
      </if>
      <if test="purchaseTime != null">
        #{purchaseTime,jdbcType=TIMESTAMP},
      </if>
      <if test="supplierId != null">
        #{supplierId,jdbcType=VARCHAR},
      </if>
      <if test="useLife != null">
        #{useLife,jdbcType=VARCHAR},
      </if>
      <if test="keyCabinet != null">
        #{keyCabinet,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=VARCHAR},
      </if>
      <if test="bigNotes != null">
        #{bigNotes,jdbcType=VARCHAR},
      </if>
      <if test="safetyCode != null">
        #{safetyCode,jdbcType=INTEGER},
      </if>
      <if test="isCertificate != null">
        #{isCertificate,jdbcType=INTEGER},
      </if>
      <if test="isUse != null">
        #{isUse,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
 
      <if test="manufacturer != null">
        #{manufacturer,jdbcType=VARCHAR},
      </if>
      <if test="dateOfProduction != null">
        #{dateOfProduction,jdbcType=TIMESTAMP},
      </if>
      <if test="useYearMonth != null">
        #{useYearMonth,jdbcType=TIMESTAMP},
      </if>
      <if test="shapeSize != null">
        #{shapeSize,jdbcType=VARCHAR},
      </if>
      <if test="totalPower != null">
        #{totalPower},
      </if>
      <if test="totalWeight != null">
        #{totalWeight,jdbcType=VARCHAR},
      </if>
      <if test="originalValue != null">
        #{originalValue,jdbcType=VARCHAR},
      </if>
      <if test="yearDepreciationRate != null">
        #{yearDepreciationRate,jdbcType=VARCHAR},
      </if>
      <if test="accumulatedDepreciation != null">
        #{accumulatedDepreciation,jdbcType=VARCHAR},
      </if>
      <if test="netWorth != null">
        #{netWorth,jdbcType=VARCHAR},
      </if>
      <if test="useStatus != null">
        #{useStatus,jdbcType=INTEGER},
      </if>
      <if test="isNeed != null">
        #{isNeed,jdbcType=INTEGER},
      </if>
      <if test="deviceSource != null">
        #{deviceSource,jdbcType=VARCHAR},
      </if>
      <if test="deviceNexus != null">
        #{deviceNexus,jdbcType=VARCHAR},
      </if>
      <if test="fixedPerson != null">
        #{fixedPerson,jdbcType=VARCHAR},
      </if>
      <if test="adminPhone != null">
        #{adminPhone,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <insert id="picturesInsert" >
    insert into t_big_path
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="bigDeviceId != null">
        big_device_id,
      </if>
      <if test="fileType != null">
        file_type,
      </if>
      <if test="filePath != null">
        file_path,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="bigDeviceId != null">
        #{bigDeviceId,jdbcType=VARCHAR},
      </if>
      <if test="fileType != null">
        #{fileType,jdbcType=INTEGER},
      </if>
      <if test="filePath != null">
        #{filePath,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="bigDeviceList" resultType="com.thhy.engineering.modules.biz.device.entity.TBigDevice">
    SELECT
    tbd.big_device_id AS bigDeviceId,
    tbd.big_device_Name AS bigDeviceName,
    tbd.big_device_model AS bigDeviceModel,
    tbd.big_number AS bigNumber,
    sd.dict_name AS bigTypeName,
    tbd.big_position AS bigPosition,
    tbd.big_state AS bigState,
    spu.real_name AS realName,
    ss.supplier_name AS supplierName,
    tbd.key_cabinet AS keyCabinet,
    tbd.use_life AS useLife,
    tbd.purchase_time as purchaseTime,
    tbd.use_life as useLife,
    tbd.big_type as bigType,
    tbd.key_cabinet as keyCabinet,
    tbd.big_notes AS bigNotes,
    tbd.safety_code AS safetyCode,
    tbd.is_certificate AS isCertificate,
    tbd.create_time AS createTime,
    tbd.manufacturer AS manufacturer,
    tbd.date_of_production AS dateOfProduction,
    tbd.use_year_month AS useYearMonth,
    tbd.shape_size AS shapeSize,
    tbd.total_power AS totalPower,
    tbd.total_weight AS totalWeight,
    tbd.original_value AS originalValue,
    tbd.year_depreciation_rate AS yearDepreciationRate,
    tbd.accumulated_depreciation AS accumulatedDepreciation,
    tbd.net_worth AS netWorth,
    tbd.use_status AS useStatus,
    tbd.is_need AS isNeed,
    tbd.device_source AS deviceSource,
    tbd.device_nexus AS deviceNexus,
    tbd.fixed_person AS fixedPerson
    FROM
    t_big_device tbd
    LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id
    LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id
    LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id
    where tbd.is_use=1
    <if test="bigDeviceName!=null and bigDeviceName!='' ">
        and tbd.big_device_Name like concat('%',#{bigDeviceName},'%')
    </if>
    <if test="bigNumber!=null and bigNumber!='' ">
      and tbd.big_number like concat('%',#{bigNumber},'%')
    </if>
    <if test="supplierId!=null and supplierId!='' ">
      and tbd.supplier_id=#{supplierId}
    </if>
    <if test="bigState!=null and bigState!='' ">
      and tbd.big_state=#{bigState}
    </if>
    <if test="companyId!=null and companyId!='' ">
      and tbd.company_id=#{companyId}
    </if>
    <if test="bigType!=null and bigType!='' ">
      and tbd.big_type=#{bigType}
    </if>
    order by tbd.create_time desc
  </select>
<select id="bigDevicePull" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigDevice">
    select
      big_device_id as  bigDeviceId,
      big_device_name as  bigDeviceName
     from t_big_device
    where is_use=1 and company_id=#{companyId}
</select>
 
 
  <select id="bigDeviceInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigDevice">
    SELECT
            tbd.big_device_id AS bigDeviceId,
            tbd.big_device_Name AS bigDeviceName,
            tbd.big_device_model AS bigDeviceModel,
            tbd.big_number AS bigNumber,
            sd.dict_name AS bigTypeName,
            tbd.big_position AS bigPosition,
            tbd.big_state AS bigState,
            spu.real_name AS realName,
            spu.phone AS zrrPhone,
            ss.supplier_name AS supplierName,
            tbd.key_cabinet AS keyCabinet,
            tbd.use_life AS useLife,
            tbd.big_type as bigType,
            tbd.supplier_id as supplierId,
            tbd.purchase_time as purchaseTime,
            tbd.big_notes as bigNotes,
            tbd.user_id as userId,
            tbd.safety_code as safetyCode,
            tbd.is_certificate as isCertificate,
            tbd.manufacturer AS manufacturer,
            tbd.date_of_production AS dateOfProduction,
            tbd.use_year_month AS useYearMonth,
            tbd.shape_size AS shapeSize,
            tbd.total_power AS totalPower,
            tbd.total_weight AS totalWeight,
            tbd.original_value AS originalValue,
            tbd.year_depreciation_rate AS yearDepreciationRate,
            tbd.accumulated_depreciation AS accumulatedDepreciation,
            tbd.net_worth AS netWorth,
            tbd.use_status AS useStatus,
            tbd.is_need AS isNeed,
            tbd.device_source AS deviceSource,
            tbd.device_nexus AS deviceNexus,
            tbd.fixed_person AS fixedPerson,
            su.real_name AS adminRealName,
            tbd.admin_phone AS adminPhone
    FROM
            t_big_device tbd
                    LEFT JOIN sys_dict sd ON tbd.big_type = sd.dict_id
                    LEFT JOIN sys_plat_user spu ON tbd.user_id = spu.user_id
                    LEFT JOIN sys_supplier ss ON tbd.supplier_id = ss.id
                    LEFT JOIN sys_users su ON su.user_id = tbd.create_user
    where tbd.is_use=1
    and tbd.big_device_id=#{bigDeviceId}
  </select>
 
  <select id="devicePath" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TBigPath">
        select
         big_device_id as bigDeviceId,
         file_type as fileType,
         file_path as filePath,
         id as id
         from t_big_path where big_device_id=#{bigDeviceId}
  </select>
 
  <update id="bigDeviceDel" parameterType="java.lang.String">
    update t_big_device set
    is_use=2
    where  big_device_id=#{bigDeviceId}
  </update>
  <delete id="bigDevicePathDel" parameterType="java.lang.String">
    delete from t_big_path where big_device_id=#{bigDeviceId}
  </delete>
  <update id="bigDeviceUpdate">
    update t_big_device
    <set>
      <if test="bigDeviceName != null">
        big_device_Name = #{bigDeviceName,jdbcType=VARCHAR},
      </if>
      <if test="bigDeviceModel != null">
        big_device_model = #{bigDeviceModel,jdbcType=VARCHAR},
      </if>
      <if test="bigNumber != null">
        big_number = #{bigNumber,jdbcType=VARCHAR},
      </if>
      <if test="bigType != null">
        big_type = #{bigType,jdbcType=VARCHAR},
      </if>
      <if test="bigPosition != null">
        big_position = #{bigPosition,jdbcType=VARCHAR},
      </if>
      <if test="bigState != null">
        big_state = #{bigState,jdbcType=INTEGER},
      </if>
      <if test="purchaseTime != null">
        purchase_time = #{purchaseTime,jdbcType=TIMESTAMP},
      </if>
      <if test="supplierId != null">
        supplier_id = #{supplierId,jdbcType=VARCHAR},
      </if>
      <if test="useLife != null">
        use_life = #{useLife,jdbcType=VARCHAR},
      </if>
      <if test="keyCabinet != null">
        key_cabinet = #{keyCabinet,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        user_id = #{userId,jdbcType=VARCHAR},
      </if>
      <if test="bigNotes != null">
        big_notes = #{bigNotes,jdbcType=VARCHAR},
      </if>
      <if test="safetyCode != null">
        safety_code = #{safetyCode,jdbcType=INTEGER},
      </if>
      <if test="isCertificate != null">
        is_certificate = #{isCertificate,jdbcType=INTEGER},
      </if>
      <if test="isUse != null">
        is_use = #{isUse,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
 
      <if test="manufacturer != null">
        manufacturer = #{manufacturer,jdbcType=VARCHAR},
      </if>
      <if test="dateOfProduction != null">
        date_of_production = #{dateOfProduction,jdbcType=TIMESTAMP},
      </if>
      <if test="useYearMonth != null">
        use_year_month = #{useYearMonth,jdbcType=TIMESTAMP},
      </if>
      <if test="shapeSize != null">
        shape_size = #{shapeSize,jdbcType=VARCHAR},
      </if>
      <if test="totalPower != null">
        total_power = #{totalPower},
      </if>
      <if test="totalWeight != null">
        total_weight = #{totalWeight,jdbcType=VARCHAR},
      </if>
      <if test="originalValue != null">
        original_value = #{originalValue,jdbcType=VARCHAR},
      </if>
      <if test="yearDepreciationRate != null">
        year_depreciation_rate = #{yearDepreciationRate,jdbcType=VARCHAR},
      </if>
      <if test="accumulatedDepreciation != null">
        accumulated_depreciation = #{accumulatedDepreciation,jdbcType=VARCHAR},
      </if>
      <if test="netWorth != null">
        net_worth = #{netWorth,jdbcType=VARCHAR},
      </if>
      <if test="useStatus != null">
        use_status = #{useStatus,jdbcType=INTEGER},
      </if>
      <if test="isNeed != null">
        is_need = #{isNeed,jdbcType=INTEGER},
      </if>
      <if test="deviceSource != null">
        device_source = #{deviceSource,jdbcType=VARCHAR},
      </if>
      <if test="deviceNexus != null">
        device_nexus = #{deviceNexus,jdbcType=VARCHAR},
      </if>
      <if test="fixedPerson != null">
        fixed_person = #{fixedPerson,jdbcType=VARCHAR},
      </if>
      <if test="adminPhone != null">
        admin_phone = #{adminPhone,jdbcType=VARCHAR},
      </if>
    </set>
    where big_device_id = #{bigDeviceId,jdbcType=VARCHAR}
  </update>
</mapper>