张磊磊
2023-12-05 266cb78c22a5644d5e2c15c42243b0b80ca7d233
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
<?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.concret.mapper.TMaterialReleaseMappper">
  <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.concret.entity.TMaterialRelease">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Sep 15 10:50:37 CST 2023.
    -->
    <id column="material_release_id" jdbcType="VARCHAR" property="materialReleaseId" />
    <result column="material_release_time" jdbcType="VARCHAR" property="materialReleaseTime" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
    <result column="quantity" jdbcType="DOUBLE" property="quantity" />
    <result column="company_id" jdbcType="VARCHAR" property="companyId" />
  </resultMap>
 
  <insert id="materialReleaseInsert" useGeneratedKeys="true" keyProperty="materialReleaseId" parameterType="java.util.Map">
    insert into t_material_release
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="materialReleaseId != null">
        material_release_id,
      </if>
      <if test="materialReleaseTime != null">
        material_release_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="quantity != null">
        quantity,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="materialReleaseId != null">
        #{materialReleaseId,jdbcType=VARCHAR},
      </if>
      <if test="materialReleaseTime != null">
        #{materialReleaseTime,jdbcType=VARCHAR},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="quantity != null">
        #{quantity,jdbcType=DOUBLE},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <insert id="releaseDataInsert" >
    insert into t_release_data
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="releaseDataId != null">
        release_data_id,
      </if>
      <if test="materialReleaseId != null">
        material_release_id,
      </if>
      <if test="dictId != null">
        dict_id,
      </if>
      <if test="releaseData != null">
        release_data,
      </if>
      <if test="releaseType != null">
        release_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="releaseDataId != null">
        #{releaseDataId,jdbcType=VARCHAR},
      </if>
      <if test="materialReleaseId != null">
        #{materialReleaseId,jdbcType=VARCHAR},
      </if>
      <if test="dictId != null">
        #{dictId,jdbcType=VARCHAR},
      </if>
      <if test="releaseData != null">
        #{releaseData},
      </if>
      <if test="releaseType != null">
        #{releaseType,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
 
  <select id="materialReleaseList" resultType="com.thhy.materials.modules.biz.concret.entity.TMaterialRelease">
 
        select
    material_release_id as materialReleaseId,
    material_release_time as materialReleaseTime,
    quantity as quantity
        from
        t_material_release
        where is_use=1
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and material_release_time between #{strTime} and #{endTime}
        </if>
        order by material_release_time desc
  </select>
 
  <select id="materialDataList" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.concret.entity.TReleaseData" >
        select
         dict_id as dictId,
        -- FORMAT(release_data, 4) as releaseData,
         release_data as releaseData,
         release_type as releaseType
         from t_release_data
        where
        material_release_id =#{materialReleaseId}
        order by release_type asc
  </select>
 
  <update id="materialReleaseUpdate" >
    update t_material_release
    <set>
      <if test="materialReleaseTime != null">
        material_release_time = #{materialReleaseTime,jdbcType=VARCHAR},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="quantity != null">
        quantity = #{quantity,jdbcType=DOUBLE},
      </if>
      <if test="companyId != null">
        company_id = #{companyId,jdbcType=VARCHAR},
      </if>
    </set>
    where material_release_id = #{materialReleaseId,jdbcType=VARCHAR}
  </update>
 
  <delete id="releaseDataDel" parameterType="java.lang.String">
     delete from t_release_data
    where material_release_id = #{materialReleaseId,jdbcType=VARCHAR}
  </delete>
 
  <update id="materialReleaseDel" parameterType="java.lang.String">
    update t_material_release set
    is_use=2
    where material_release_id=#{materialReleaseId}
  </update>
  <select id="pieceList" resultType="com.thhy.materials.modules.biz.concret.entity.dto.PieceDto">
    select by_id as byId from  t_piece
    where 1=1
    <if test="byId!=null and byId!='' ">
      and by_id=#{byId}
    </if>
    ORDER BY  by_id desc
  </select>
  <select id="materialRew" resultType="com.thhy.materials.modules.biz.concret.entity.TRawMaterial">
    select Storage as storage,
    Material as material,
    RecAmnt as recamnt,
    PlanAmnt as planamnt,
    FactAmnt as factamnt
     from  t_raw_material
    where  Piece=#{byId}
  </select>
  <insert id="mixingInsert" >
    insert into t_mixing
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mixingId != null">
        mixing_id,
      </if>
      <if test="material != null">
        material,
      </if>
      <if test="spec != null">
        spec,
      </if>
      <if test="producer != null">
        producer,
      </if>
      <if test="stove != null">
        stove,
      </if>
      <if test="inNum != null">
        in_num,
      </if>
      <if test="inDate != null">
        in_date,
      </if>
      <if test="inspectState != null">
        inspect_state,
      </if>
      <if test="reportNumber != null">
        report_number,
      </if>
      <if test="stata != null">
        stata,
      </if>
      <if test="siloId != null">
        silo_id,
      </if>
      <if test="percentage != null">
        percentage,
      </if>
      <if test="inspectDate != null">
        inspect_date,
      </if>
      <if test="types != null">
        types,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="mixingId != null">
        #{mixingId,jdbcType=VARCHAR},
      </if>
      <if test="material != null">
        #{material,jdbcType=VARCHAR},
      </if>
      <if test="spec != null">
        #{spec,jdbcType=VARCHAR},
      </if>
      <if test="producer != null">
        #{producer,jdbcType=VARCHAR},
      </if>
      <if test="stove != null">
        #{stove,jdbcType=VARCHAR},
      </if>
      <if test="inNum != null">
        #{inNum,jdbcType=VARCHAR},
      </if>
      <if test="inDate != null">
        #{inDate,jdbcType=VARCHAR},
      </if>
      <if test="inspectState != null">
        #{inspectState,jdbcType=INTEGER},
      </if>
      <if test="reportNumber != null">
        #{reportNumber,jdbcType=VARCHAR},
      </if>
      <if test="stata != null">
        #{stata},
      </if>
      <if test="siloId != null">
        #{siloId,jdbcType=VARCHAR},
      </if>
      <if test="percentage != null">
        #{percentage,jdbcType=VARCHAR},
      </if>
      <if test="inspectDate != null">
        #{inspectDate,jdbcType=VARCHAR},
      </if>
      <if test="types != null">
        #{types},
      </if>
    </trim>
  </insert>
  <select id="mixingList" resultType="com.thhy.materials.modules.biz.concret.entity.TMixing">
        select
        mixing_id as mixingId,
        material as material,
        spec as spec,
        producer as producer,
        stove as stove,
        in_num as inNum,
        in_date as inDate,
        inspect_state as inspectState,
        report_number as reportNumber,
        stata as stata,
        silo_id as siloId,
        percentage as percentage,
        inspect_date as inspectDate
        from t_mixing where silo_id=#{siloId}
        order by in_date desc limit 0,1
  </select>
  <select id="mixingLists" resultType="com.thhy.materials.modules.biz.concret.entity.TMixing">
        select
        mixing_id as mixingId,
        material as material,
        spec as spec,
        producer as producer,
        stove as stove,
        in_num as inNum,
        in_date as inDate,
        inspect_state as inspectState,
        report_number as reportNumber,
        stata as stata,
        silo_id as siloId,
        percentage as percentage
        from t_mixing where silo_id=#{siloId}
        order by in_date desc limit 0,1
  </select>
  <select id="siloList" resultType="com.thhy.materials.modules.biz.concret.entity.TSilo">
    select
     silo_id as siloId,
     silo_name as siloName,
     types as types
     from t_silo where types=#{types}
  </select>
  <insert id="mixingConsumeIn" keyProperty="mixingSignboardId" useGeneratedKeys="true" parameterType="java.util.Map">
    insert into t_mixing_signboard
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mixingSignboardId != null">
        mixing_signboard_id,
      </if>
      <if test="signboardName != null">
        signboard_name,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="mixingConsume != null">
        mixing_consume,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="mixingSignboardId != null">
        #{mixingSignboardId,jdbcType=VARCHAR},
      </if>
      <if test="signboardName != null">
        #{signboardName,jdbcType=VARCHAR},
      </if>
      <if test="proId != null">
        #{proId,jdbcType=VARCHAR},
      </if>
      <if test="mixingConsume != null">
        #{mixingConsume,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <insert id="mixingConsumeInTwo" >
    insert into t_mixing_consume
    <trim prefix="(" suffix=")" suffixOverrides=",">
        mixing_consume_id,
      <if test="dictId != null">
        dict_id,
      </if>
      <if test="spec != null">
        spec,
      </if>
      <if test="manufacturer != null">
        manufacturer,
      </if>
      <if test="watFull != null">
        wat_full,
      </if>
      <if test="planAmnt != null">
        plan_amnt,
      </if>
      <if test="factAmnt != null">
        fact_amnt,
      </if>
      <if test="saveStamp != null">
        save_stamp,
      </if>
      <if test="construction != null">
        construction,
      </if>
      <if test="mixingSignboardId != null">
        mixing_signboard_id,
      </if>
      <if test="star != null">
        star,
      </if>
      <if test="constructionUnit != null">
          construction_unit,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
<!--      <if test="mixingConsumeId != null">-->
<!--        #{mixingConsumeId,jdbcType=VARCHAR},-->
<!--      </if>-->
      REPLACE(UUID(),'-',''),
      <if test="dictId != null">
        #{dictId,jdbcType=VARCHAR},
      </if>
      <if test="spec != null">
        #{spec,jdbcType=VARCHAR},
      </if>
      <if test="manufacturer != null">
        #{manufacturer,jdbcType=VARCHAR},
      </if>
      <if test="watFull != null">
        #{watFull,jdbcType=VARCHAR},
      </if>
      <if test="planAmnt != null">
        #{planAmnt,jdbcType=VARCHAR},
      </if>
      <if test="factAmnt != null">
        #{factAmnt,jdbcType=VARCHAR},
      </if>
      <if test="saveStamp != null">
        #{saveStamp,jdbcType=VARCHAR},
      </if>
      <if test="construction != null">
        #{construction,jdbcType=VARCHAR},
      </if>
      <if test="mixingSignboardId != null">
        #{mixingSignboardId,jdbcType=VARCHAR},
      </if>
      <if test="star != null">
        #{star},
      </if>
      <if test="constructionUnit != null">
        #{constructionUnit},
      </if>
    </trim>
  </insert>
  <select id="starInt" resultType="java.lang.Integer">
    select star from t_mixing_consume order by star desc limit 0,1
  </select>
  <select id="starIntSig" parameterType="java.lang.String" resultType="java.lang.Integer">
    select star from t_mixing_consume where  mixing_signboard_id=#{mixingSignboardId} order by star desc limit 0,1
  </select>
  <select id="mixingSignboardList" resultType="com.thhy.materials.modules.biz.concret.entity.TMixingSignboard">
    select tms.mixing_signboard_id as mixingSignboardId,
    tms.signboard_name as signboardName,
    tms.pro_id as proId,
    tms.mixing_consume as mixingConsume,
    sp.pro_name as proName,
    sp.construction_unit as constructionUnit
     from  t_mixing_signboard tms
     left join sys_project sp on tms.pro_id=sp.pro_id
    where  1=1
    <if test="signboardName!=null and signboardName!='' ">
        and  tms.signboard_name like concat('%',#{signboardName},'%')
    </if>
    <if test="mixingSignboardId !=null and mixingSignboardId !='' ">
        and tms.mixing_signboard_id=#{mixingSignboardId}
    </if>
  </select>
 
  <select id="mixingConsumes" resultType="com.thhy.materials.modules.biz.concret.entity.TMixingConsume">
    select
    mc.mixing_consume_id as mixingConsumeId,
    sd.dict_name as dictName,
    mc.dict_id as dictId,
    mc.spec as spec,
    mc.manufacturer as manufacturer,
    mc.wat_full as watFull,
    mc.plan_amnt as planAmnt,
    mc.fact_amnt as factAmnt,
    mc.save_stamp as saveStamp,
    mc.construction as construction,
    mc.mixing_signboard_id as mixingSignboardId,
    mc.star as star,
    mc.create_time as createTime,
    mc.construction_unit as constructionUnit
     from t_mixing_consume mc
     left join  sys_dict sd on mc.dict_id=sd.dict_id
     where mc.mixing_signboard_id=#{mixingSignboardId} and mc.star=#{star}
<!--     <if test="strTime!=null and strTime!='' and endTime !=null and endTime!=''">-->
<!--         and mc.create_time between #{strTime} and #{endTime}-->
<!--     </if>-->
  </select>
  <select id="mixingConsumePull" resultType="com.thhy.materials.modules.biz.concret.entity.TMixingSignboard">
    select
     tms.mixing_signboard_id as mixingSignboardId,
     tms.signboard_name as signboardName,
     sp.pro_name as proName,
     sp.construction_unit as constructionUnit
     from t_mixing_signboard tms left join sys_project sp
     on tms.pro_id=sp.pro_id
  </select>
  <select id="siloPull" resultType="com.thhy.materials.modules.biz.concret.entity.TSilo">
    select silo_id as siloId,
silo_name as siloName,
types
    from t_silo
  </select>
  <update id="mixingUpdateType"  parameterType="java.lang.String">
    update t_mixing set types=2 where silo_id=#{siloId}
  </update>
  <select id="siloMixingList" resultType="com.thhy.materials.modules.biz.concret.entity.TMixing">
        SELECT
        tm.mixing_id as mixingId,
        tm.material as material,
        tm.spec as spec,
        tm.producer as producer,
        tm.stove as stove,
        tm.in_num as inNum,
        tm.in_date as inDate,
        tm.inspect_state as inspectState,
        tm.report_number as reportNumber,
        tm.stata as stata,
        tm.silo_id as siloId,
        tm.percentage as percentage,
        tm.inspect_date as inspectDate,
        ts.silo_name as siloName,
        ts.types as types
FROM
    t_silo ts
    LEFT JOIN t_mixing tm ON ts.silo_id=tm.silo_id
    where  tm.types=1
    <if test="types!=null and types!='' ">
        and ts.types=#{types}
    </if>
    <if test="stata!=null and stata!='' ">
        and tm.stata=#{stata}
    </if>
    <if test="strTime!=null and strTime!=null and endTime!=null and endTime!='' ">
      and tm.in_date between #{strTime} and #{endTime}
    </if>
  </select>
  <update id="mixingUpdate" >
    update t_mixing
    <set>
      <if test="material != null">
        material = #{material,jdbcType=VARCHAR},
      </if>
      <if test="spec != null">
        spec = #{spec,jdbcType=VARCHAR},
      </if>
      <if test="producer != null">
        producer = #{producer,jdbcType=VARCHAR},
      </if>
      <if test="stove != null">
        stove = #{stove,jdbcType=VARCHAR},
      </if>
      <if test="inNum != null">
        in_num = #{inNum,jdbcType=VARCHAR},
      </if>
      <if test="inDate != null">
        in_date = #{inDate,jdbcType=VARCHAR},
      </if>
      <if test="inspectState != null">
        inspect_state = #{inspectState,jdbcType=INTEGER},
      </if>
      <if test="reportNumber != null">
        report_number = #{reportNumber,jdbcType=VARCHAR},
      </if>
      <if test="stata != null">
        stata = #{stata},
      </if>
      <if test="siloId != null">
        silo_id = #{siloId},
      </if>
      <if test="percentage != null">
        percentage = #{percentage},
      </if>
      <if test="inspectDate != null">
        inspect_date = #{inspectDate},
      </if>
    </set>
    where mixing_id = #{mixingId,jdbcType=VARCHAR}
  </update>
  <delete id="mixingDel" parameterType="java.lang.String">
    delete from  t_mixing where  mixing_id=#{mixingId}
  </delete>
  <update id="mixingConsumeUpTwo" >
    update t_mixing_consume
    <set>
      <if test="dictId != null">
        dict_id = #{dictId,jdbcType=VARCHAR},
      </if>
      <if test="spec != null">
        spec = #{spec,jdbcType=VARCHAR},
      </if>
      <if test="manufacturer != null">
        manufacturer = #{manufacturer,jdbcType=VARCHAR},
      </if>
      <if test="watFull != null">
        wat_full = #{watFull,jdbcType=VARCHAR},
      </if>
      <if test="planAmnt != null">
        plan_amnt = #{planAmnt,jdbcType=VARCHAR},
      </if>
      <if test="factAmnt != null">
        fact_amnt = #{factAmnt,jdbcType=VARCHAR},
      </if>
      <if test="saveStamp != null">
        save_stamp = #{saveStamp,jdbcType=VARCHAR},
      </if>
      <if test="construction != null">
        construction = #{construction,jdbcType=VARCHAR},
      </if>
      <if test="mixingSignboardId != null">
        mixing_signboard_id = #{mixingSignboardId,jdbcType=VARCHAR},
      </if>
      <if test="star != null">
        star = #{star},
      </if>
    </set>
    where mixing_consume_id = #{mixingConsumeId,jdbcType=VARCHAR}
  </update>
    <delete id="mixingConsumeDel" >
        delete from  t_mixing_consume where  mixing_consume_id=#{mixingConsumeId} and star=#{star}
    </delete>
    <delete id="mixingConsumeDelSign" >
        delete from  t_mixing_consume where  mixing_signboard_id=#{mixingSignboardId} and star=#{star}
    </delete>
</mapper>