张晓波
2023-10-30 4bc74cce28fd8c01433bed66b4d36da0ba9b3f79
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
<?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.pipeout.mapper.TPipeOutMapper">
  <resultMap id="BaseResultMap" type="com.thhy.materials.modules.biz.pipeout.entity.TPipeOut">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Thu May 18 10:48:54 CST 2023.
    -->
    <id column="pipe_out_id" jdbcType="VARCHAR" property="pipeOutId" />
    <result column="pro_id" jdbcType="VARCHAR" property="proId" />
    <result column="car_id" jdbcType="VARCHAR" property="carId" />
    <result column="in_user_id" jdbcType="VARCHAR" property="inUserId" />
    <result column="str_time" jdbcType="TIMESTAMP" property="strTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="notes" jdbcType="VARCHAR" property="notes" />
    <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="out_user_id" jdbcType="VARCHAR" property="outUserId" />
  </resultMap>
 
 
  <insert id="pipeOutInsert">
    insert into t_pipe_out
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="pipeOutId != null">
        pipe_out_id,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="carId != null">
        car_id,
      </if>
      <if test="inUserId != null">
        in_user_id,
      </if>
      <if test="strTime != null">
        str_time,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="notes != null">
        notes,
      </if>
      <if test="isUse != null">
        is_use,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="outUserId != null">
        out_user_id,
      </if>
        <if test="gdId != null">
            gd_id,
        </if>
        <if test="pipeOutNumber != null">
            pipe_out_number,
        </if>
        <if test="companyId != null">
            company_id,
        </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="pipeOutId != null">
        #{pipeOutId,jdbcType=VARCHAR},
      </if>
      <if test="proId != null">
        #{proId,jdbcType=VARCHAR},
      </if>
      <if test="carId != null">
        #{carId,jdbcType=VARCHAR},
      </if>
      <if test="inUserId != null">
        #{inUserId,jdbcType=VARCHAR},
      </if>
      <if test="strTime != null">
        #{strTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="notes != null">
        #{notes,jdbcType=VARCHAR},
      </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="outUserId != null">
        #{outUserId,jdbcType=VARCHAR},
      </if>
        <if test="gdId != null">
            #{gdId,jdbcType=VARCHAR},
        </if>
        <if test="pipeOutNumber != null">
            #{pipeOutNumber},
        </if>
        <if test="companyId != null">
            #{companyId},
        </if>
    </trim>
  </insert>
 
  <insert id="pipeOutPipeInsert">
    insert into t_pipe_out_pipe
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="pipeOutId != null">
        pipe_out_id,
      </if>
      <if test="pipeId != null">
        pipe_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="pipeOutId != null">
        #{pipeOutId,jdbcType=VARCHAR},
      </if>
      <if test="pipeId != null">
        #{pipeId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <select id="pipeOutList" resultType="com.thhy.materials.modules.biz.pipeout.entity.TPipeOut">
        SELECT
    tpo.pipe_out_id AS pipeOutId,
    tpo.pro_id AS proId,
    tpo.car_id AS carId,
    tpo.in_user_id AS inUserId,
    tpo.str_time AS strTime,
    tpo.end_time AS endTime,
    tpo.notes AS notes,
    tpo.out_user_id AS outUserId,
    sc.car_brand AS carBrand,
    sc.car_driver AS carDriver,
    sc.car_phone AS carPhone,
    sr.reciver_name AS reciverName,
    sr.reciver_phone AS reciverPhone,
    su.real_name AS realName,
    sd.dict_name as carTypeName,
    tpo.create_time as createTime,
      sp.pro_name as proName,
      sr.reciver_unit as reciverUnit
FROM
    t_pipe_out tpo
    LEFT JOIN sys_car sc ON tpo.car_id = sc.car_id
    LEFT JOIN sys_reciver sr ON tpo.in_user_id = sr.id
    LEFT JOIN sys_users su ON tpo.out_user_id = su.user_id
    left join sys_dict sd on  sc.car_type=sd.dict_id
    left join t_pipe_out_pipe tpop on  tpo.pipe_out_id=tpop.pipe_out_id
    left join t_pipe_info tpi on tpop.pipe_id=tpi.pipe_id
      left join t_repo_record_pipe rrp on tpi.pipe_num=rrp.pipe_num
      left join sys_project sp on tpo.pro_id=sp.pro_id
      where tpo.is_use=1
    <if test="proId!=null and proId!='' ">
      and tpo.pro_id=#{proId}
    </if>
    <if test="carBrand!=null and carBrand!='' ">
      and sc.car_brand like concat('%',#{carBrand},'%')
    </if>
    <if test="companyId!=null and companyId!='' ">
      and sc.company_id=#{companyId}
    </if>
    <if test="ringNum!=null and ringNum!='' ">
      and tpi.ring_num like concat('%',#{ringNum},'%')
    </if>
    <if test="pipeNum!=null and pipeNum!='' ">
      and tpi.pipe_num like concat('%',#{pipeNum},'%')
    </if>
    <if test="repoId!=null and repoId!='' ">
        and rrp.repo_id like concat('%',#{repoId},'%')
    </if>
    GROUP BY tpo.pipe_out_id
    order by  tpo.create_time desc
  </select>
  <select id="pipeOutInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.pipeout.entity.TPipeOut">
SELECT
    tpo.pipe_out_id AS pipeOutId,
    tpo.pro_id AS proId,
    tpo.car_id AS carId,
    tpo.in_user_id AS inUserId,
    tpo.str_time AS strTime,
    tpo.end_time AS endTime,
    tpo.notes AS notes,
    tpo.out_user_id AS outUserId,
    sc.car_brand AS carBrand,
    sc.car_driver AS carDriver,
    sc.car_phone AS carPhone,
    sr.reciver_name AS reciverName,
    sr.reciver_phone AS reciverPhone,
    tpo.out_user_id AS outUserId,
    su.real_name AS realName,
    tpo.gd_id as gdId,
    sp.pro_name as proName,
    concat(gd.gd_name,':',gd.gd_imei) as gdName,
    scc.company_name AS companyName,
    tpo.pipe_out_number as pipeOutNumber,
    sr.reciver_unit as reciverUnit
FROM
    t_pipe_out tpo
    LEFT JOIN sys_car sc ON tpo.car_id = sc.car_id
    LEFT JOIN sys_reciver sr ON tpo.in_user_id = sr.id
    LEFT JOIN sys_users su ON tpo.out_user_id = su.user_id
    LEFT JOIN t_gps_device gd ON gd.gd_id = tpo.gd_id
    left join sys_project sp on tpo.pro_id=sp.pro_id
    LEFT JOIN sys_company scc ON scc.company_id = sp.company_id
    where tpo.is_use=1 and tpo.pipe_out_id=#{pipeOutId}
  </select>
 
 
  <update id="pipeInfoUpdate" >
    update t_pipe_info set
    go_in=2,
    out_repo_time=#{format1}
    where pipe_id=#{pipeId}
  </update>
 
  <select id="pipeOutPipeInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.pipeout.entity.TPipeInfo">
        SELECT
    tpi.ring_num as ringNum,
    tpi.pipe_num as pipeNum,
    tpi.pipe_id as pipeId,
    tpi.block_num as blockNum,
    sd.dict_name AS sizeName,
    sd1.dict_name AS reinforcementName,
    sd2.dict_name AS blockNumName,
    sd3.dict_name AS turnName
FROM
    t_pipe_out_pipe tpop
    LEFT JOIN t_pipe_info tpi ON tpop.pipe_id = tpi.pipe_id
    LEFT JOIN sys_dict sd ON tpi.size = sd.dict_id
    LEFT JOIN sys_dict sd1 ON tpi.reinforcement = sd1.dict_id
    LEFT JOIN sys_dict sd2 ON tpi.block_num = sd2.dict_id
    LEFT JOIN sys_dict sd3 ON tpi.turn = sd3.dict_id
    where tpop.pipe_out_id=#{pipeOutId}
  </select>
  <select id="pipeSelectPipeId" parameterType="java.lang.String" resultType="java.lang.String">
    select pipe_id as pipeId from t_pipe_out_pipe tpop
    where  pipe_out_id=#{pipeOutId}
  </select>
  <update id="pipeInfoUpIn" parameterType="java.lang.String">
    update t_pipe_info set
    go_in=1,
    out_repo_time=null
    where pipe_id=#{pipeId}
  </update>
  <delete id="pipeOutPipeDel" parameterType="java.lang.String">
    delete from  t_pipe_out_pipe where pipe_out_id=#{pipeOutId}
  </delete>
  <update id="pipeOutDel" parameterType="java.lang.String">
    update t_pipe_out set
    is_use=2
    where pipe_out_id=#{pipeOutId}
  </update>
  <update id="pipeOutUpdate" >
    update t_pipe_out
    <set>
      <if test="proId != null">
        pro_id = #{proId,jdbcType=VARCHAR},
      </if>
      <if test="carId != null">
        car_id = #{carId,jdbcType=VARCHAR},
      </if>
      <if test="inUserId != null">
        in_user_id = #{inUserId,jdbcType=VARCHAR},
      </if>
      <if test="strTime != null">
        str_time = #{strTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        end_time = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="notes != null">
        notes = #{notes,jdbcType=VARCHAR},
      </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="outUserId != null">
        out_user_id = #{outUserId,jdbcType=VARCHAR},
      </if>
        <if test="gdId != null">
            gd_id = #{gdId,jdbcType=VARCHAR},
        </if>
    </set>
    where pipe_out_id = #{pipeOutId,jdbcType=VARCHAR}
  </update>
  <select id="pipeOutCheck" parameterType="java.lang.String" resultType="java.lang.String">
        select go_in from t_pipe_info  where check_result=1 and pipe_num=#{pipeNum}
  </select>
 
  <select id="pipeInfo" parameterType="java.lang.String"  resultType="com.thhy.materials.modules.biz.pipeout.entity.TPipeInfo">
            SELECT
        tpi.ring_num AS ringNum,
        tpi.pipe_num AS pipeNum,
        sp.pro_name as proName,
        sd.dict_name as sizeName,
        sd1.dict_name as blockNumName,
        tpi.pipe_id as pipeId
    FROM
        t_pipe_info tpi
        LEFT JOIN sys_project sp ON tpi.pro_id = sp.pro_id
        left join sys_dict sd  on tpi.size=sd.dict_id
        left join sys_dict sd1  on tpi.block_num=sd1.dict_id
        where tpi.pipe_num=#{pipeNum}
  </select>
 
 
  <select id="pipeOutShippingSum" resultType="java.lang.String">
       SELECT
    count( tpi.pipe_id )
FROM
    t_pipe_info tpi
    LEFT JOIN sys_project sp ON tpi.pro_id = sp.pro_id
WHERE
    tpi.go_in = 2
    <if test="companyId!=null and companyId!='' ">
        and sp.company_id=#{companyId}
    </if>
    <if test="strTime!=null and endTime!=null and strTime!='' and endTime!='' ">
        and tpi.out_repo_time between #{strTime} and #{endTime}
    </if>
      <if test="proId!=null and proId!='' ">
          and sp.pro_id=#{proId}
      </if>
  </select>
  <select id="pipeOutTransportSum" resultType="java.lang.String">
       SELECT
    count( tpi.pipe_id )
FROM
    t_pipe_info tpi
    LEFT JOIN sys_project sp ON tpi.pro_id = sp.pro_id
WHERE
    tpi.go_in = 2
    <if test="companyId!=null and companyId!='' ">
        and sp.company_id=#{companyId}
    </if>
    <if test="strTime!=null and endTime!=null and strTime!='' and endTime!='' ">
        and tpi.out_repo_time between #{strTime} and #{endTime}
    </if>
    <if test="proId!=null and proId!='' ">
      and sp.pro_id=#{proId}
    </if>
  </select>
  <select id="pipeOutCarSum" resultType="java.lang.String">
SELECT
    COUNT( pipe_out_id )
FROM
    (
    SELECT
        pop.pipe_out_id
    FROM
        t_pipe_out_pipe pop
        LEFT JOIN t_pipe_info tpi ON pop.pipe_id = tpi.pipe_id
        LEFT JOIN sys_project sp ON tpi.pro_id = sp.pro_id
    WHERE
        tpi.go_in = 2
    <if test="companyId!=null and companyId!='' ">
      and sp.company_id=#{companyId}
    </if>
    <if test="strTime!=null and endTime!=null and strTime!='' and endTime!='' ">
      and tpi.out_repo_time between #{strTime} and #{endTime}
    </if>
    GROUP BY
    pop.pipe_out_id
    ) s
  </select>
    <select id="pipeOutProduceSum" resultType="java.lang.String">
   SELECT
    COUNT( pipe_id )
FROM
    t_pipe_info tpi
    LEFT JOIN sys_project sp ON tpi.pro_id = sp.pro_id
WHERE
    tpi.check_result = 1
        <if test="companyId!=null and companyId!='' ">
            and sp.company_id=#{companyId}
        </if>
        <if test="strTime!=null and endTime!=null and strTime!='' and endTime!='' ">
            and tpi.check_time between #{strTime} and #{endTime}
        </if>
        <if test="proId!=null and proId!='' ">
            and sp.pro_id=#{proId}
        </if>
    </select>
    <select id="pipeOutRanking" resultType="com.thhy.materials.modules.biz.pipeout.entity.dto.RanKingDto">
            select
    sps.pro_id,
    sps.pro_name,
    sps.sizeName,
    sps.blockName,
    sps.sizes,
    IF(sps.produce!='' or sps.produce!=null ,sps.produce,0) as produce,
    IF(a.goIn!='' or a.goIn!=null ,a.goIn,0) as goIn
 from (SELECT
    sp.pro_id,
    sp.pro_name,
    sp.sizeName,
    sp.blockName,
    sp.sizes,
    sp.block_num,
    IF(b.produce!='' or b.produce!=null ,b.produce,0) as produce
FROM
    (
    SELECT
        a.pro_id,
        a.pro_name,
        a.sizes,
        spb.block_num,
        a.dict_name AS sizeName,
        sd1.dict_name AS blockName
    FROM
        (
        SELECT
            sp.pro_id,
            sp.pro_name,
            sps.sizes,
            sd.dict_name
        FROM
            sys_project sp
            LEFT JOIN sys_pro_sizes sps ON sp.pro_id = sps.pro_id
            LEFT JOIN sys_dict sd ON sps.sizes = sd.dict_id
            WHERE
                sp.is_use = 1
        ) a
        LEFT JOIN sys_pro_blok spb ON a.pro_id = spb.pro_id
    LEFT JOIN sys_dict sd1 ON spb.block_num = sd1.dict_id
    ) sp
    left join
        (
    SELECT
        tpi.pro_id,
        sp.pro_name,
        tpi.size,
        tpi.block_num,
        sd.dict_name AS sizeName,
        sd1.dict_name AS blockName,
        COUNT( tpi.pro_id ) AS produce
    FROM
        t_pipe_info tpi
        LEFT JOIN sys_project sp ON tpi.pro_id = sp.pro_id
        LEFT JOIN sys_dict sd ON tpi.size = sd.dict_id
        LEFT JOIN sys_dict sd1 ON tpi.block_num = sd1.dict_id
    WHERE
        tpi.check_result = 1
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and tpi.check_time between #{strTime} and #{endTime}
        </if>
    GROUP BY
        tpi.pro_id,
        tpi.size,
        tpi.block_num
    ORDER BY
        COUNT( tpi.pro_id ) DESC
    ) b  on sp.pro_id=b.pro_id and sp.sizes=b.size and b.block_num=sp.block_num
 
    ) sps
 
    left join  (
    SELECT
        tpi.pro_id,
        tpi.size,
        tpi.block_num,
        COUNT( tpi.pro_id ) AS goIn
    FROM
        t_pipe_info tpi
        LEFT JOIN sys_project sp ON tpi.pro_id = sp.pro_id
    WHERE
        tpi.go_in = 2
        <if test="strTime!=null and strTime!='' and endTime!=null and endTime!='' ">
            and tpi.out_repo_time between #{strTime} and #{endTime}
        </if>
    GROUP BY
        tpi.pro_id,
        tpi.size,
        tpi.block_num
    ORDER BY
        COUNT( tpi.pro_id ) DESC
    ) a  on sps.pro_id=a.pro_id and sps.sizes=a.size and sps.block_num=a.block_num
    where 1=1
    <if test="proId!=null and proId!='' ">
        and sps.pro_id=#{proId}
    </if>
    <if test="sizes!=null and sizes!='' ">
        and sps.sizes=#{sizes}
    </if>
    order by a.goIn desc
    </select>
 
    <select id="projectSize" resultType="com.thhy.materials.modules.biz.pipeout.entity.dto.ProjectSizeDto">
    SELECT
        sp.pro_id as proId,
        sps.sizes as sizes
    FROM
        sys_project sp
        LEFT JOIN sys_pro_sizes sps ON sp.pro_id = sps.pro_id
        where sp.is_use=1
        <if test="companyId!=null and companyId!='' ">
            and  sp.company_id=#{companyId}
        </if>
        <if test="proId!=null and proId!='' ">
            and sp.pro_id=#{proId}
        </if>
    </select>
    <select id="pipeOutGps" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.pipeout.entity.TPipeOutPosition">
        select voyage_longitude as voyageLongitude,voyage_latitude as voyageLatitude from t_pipe_out_position
        where pipr_out_id=#{piprOutId}
    </select>
    <insert id="pipePathInsert" >
        insert into t_pipe_out_path
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="pipeOutId != null">
                pipe_out_id,
            </if>
            <if test="outPath != null">
                out_path,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=VARCHAR},
            </if>
            <if test="pipeOutId != null">
                #{pipeOutId,jdbcType=VARCHAR},
            </if>
            <if test="outPath != null">
                #{outPath,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>
 
    <delete id="pipeOutImgDel" parameterType="java.lang.String">
        delete from  t_pipe_out_path
        where pipe_out_id=#{pipeOutId}
    </delete>
 
    <select id="pipeOutImgInfo" parameterType="java.lang.String" resultType="com.thhy.materials.modules.biz.pipeout.entity.TPipeOutPath">
        select out_path as outPath,
         pipe_out_id as pipeOutId
         from t_pipe_out_path where  pipe_out_id=#{pipeOutId}
 
    </select>
 
    <update id="updateRepoRecord">
        update t_repo_record_pipe set out_repo = 1 and out_repo_time = sysdate() where pipe_num = #{pipeNum}
    </update>
 
    <select id="queryPipeNumByPipeId" resultType="string">
        select pipe_num from t_pipe_info where pipe_id = #{pipeId}
    </select>
    <select id="pipeInfoInList" resultType="com.thhy.materials.modules.biz.pipeout.entity.dto.PipeInfoDto">
        SELECT
    tpi.pipe_id as pipeId,
    tpi.ring_num as ringNum,
    tpi.pipe_num as pipeNum,
    sd.dict_name AS sizeName,
    sd1.dict_name AS reinforcementName,
    sd2.dict_name AS blockNumName
FROM
    t_pipe_info tpi
    LEFT JOIN sys_project sp ON tpi.pro_id = sp.pro_id
    LEFT JOIN sys_dict sd ON tpi.size = sd.dict_id
    LEFT JOIN sys_dict sd1 ON tpi.reinforcement = sd1.dict_id
    LEFT JOIN sys_dict sd2 ON tpi.block_num = sd2.dict_id
WHERE
     tpi.go_in = '1'
    <if test="companyId!=null and companyId!='' ">
      and  sp.company_id =#{companyId}
    </if>
    <if test="ringNum!=null and ringNum!='' ">
        and tpi.ring_num like concat('%',#{ringNum},'%')
    </if>
 
    </select>
 
    <select id="pipeOutNew" resultType="java.lang.String">
        select pipe_out_number from t_pipe_out where is_use=1
        and company_id=#{companyId}
        and pipe_out_number like concat('%',#{dates},'%')
        order by create_time desc limit 0,1
    </select>
 
</mapper>