邱宇豪
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
<?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.engineering.mapper.SysProjectMapper">
  <resultMap id="BaseResultMap" type="com.thhy.engineering.modules.biz.engineering.entity.SysProject">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Fri Mar 31 12:43:12 CST 2023.
    -->
      <id column="pro_id" jdbcType="VARCHAR" property="proId" />
      <result column="pro_name" jdbcType="VARCHAR" property="proName" />
      <result column="pro_desc" jdbcType="VARCHAR" property="proDesc" />
      <result column="start_date" jdbcType="TIMESTAMP" property="startDate" />
      <result column="pro_time" jdbcType="INTEGER" property="proTime" />
      <result column="plan_output" jdbcType="INTEGER" property="planOutput" />
      <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
      <result column="create_user" jdbcType="VARCHAR" property="createUser" />
      <result column="pro_number" jdbcType="VARCHAR" property="proNumber" />
      <result column="company_id" jdbcType="VARCHAR" property="companyId" />
      <result column="create_unit" jdbcType="VARCHAR" property="createUnit" />
      <result column="plan_unit" jdbcType="VARCHAR" property="planUnit" />
      <result column="supervision_unit" jdbcType="VARCHAR" property="supervisionUnit" />
      <result column="construction_unit" jdbcType="VARCHAR" property="constructionUnit" />
      <result column="outside_diameter" jdbcType="DOUBLE" property="outsideDiameter" />
      <result column="inner_diameter" jdbcType="DOUBLE" property="innerDiameter" />
      <result column="thickness" jdbcType="DOUBLE" property="thickness" />
      <result column="ring_width" jdbcType="DOUBLE" property="ringWidth" />
      <result column="concrete_strength_grade" jdbcType="VARCHAR" property="concreteStrengthGrade" />
      <result column="impermeability_level" jdbcType="VARCHAR" property="impermeabilityLevel" />
      <result column="waterproof_type" jdbcType="INTEGER" property="waterproofType" />
      <result column="company_name" jdbcType="VARCHAR" property="companyName" />
      <result column="completed_quantity" jdbcType="INTEGER" property="completedQuantity" />
  </resultMap>
 
 
  <select id="proNameByOne" parameterType="java.lang.String" resultType="java.lang.String">
    select pro_id from sys_project where is_use=1
    and pro_name=#{proName}
  </select>
 
  <insert id="projectInsert" useGeneratedKeys="true" keyProperty="pro_id">
    insert into sys_project
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="proId != null">
        pro_id,
      </if>
      <if test="proName != null">
        pro_name,
      </if>
      <if test="proDesc != null">
        pro_desc,
      </if>
      <if test="startDate != null">
        start_date,
      </if>
      <if test="proTime != null">
        pro_time,
      </if>
      <if test="planOutput != null">
        plan_output,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="proNumber != null">
        pro_number,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
        <if test="createUnit != null">
            create_unit,
        </if>
        <if test="planUnit != null">
            plan_unit,
        </if>
        <if test="supervisionUnit != null">
            supervision_unit,
        </if>
        <if test="constructionUnit != null">
            construction_unit,
        </if>
        <if test="outsideDiameter != null">
            outside_diameter,
        </if>
        <if test="innerDiameter != null">
            inner_diameter,
        </if>
        <if test="thickness != null">
            thickness,
        </if>
        <if test="ringWidth != null">
            ring_width,
        </if>
        <if test="concreteStrengthGrade != null">
            concrete_strength_grade,
        </if>
        <if test="impermeabilityLevel != null">
            impermeability_level,
        </if>
        <if test="waterproofType != null">
            waterproof_type,
        </if>
 
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="proId != null">
        #{proId,jdbcType=VARCHAR},
      </if>
      <if test="proName != null">
        #{proName,jdbcType=VARCHAR},
      </if>
      <if test="proDesc != null">
        #{proDesc,jdbcType=VARCHAR},
      </if>
      <if test="startDate != null">
        #{startDate,jdbcType=TIMESTAMP},
      </if>
      <if test="proTime != null">
        #{proTime,jdbcType=INTEGER},
      </if>
      <if test="planOutput != null">
        #{planOutput,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="proNumber != null">
        #{proNumber,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
        <if test="createUnit != null">
            #{createUnit,jdbcType=VARCHAR},
        </if>
        <if test="planUnit != null">
            #{planUnit,jdbcType=VARCHAR},
        </if>
        <if test="supervisionUnit != null">
            #{supervisionUnit,jdbcType=VARCHAR},
        </if>
        <if test="constructionUnit != null">
            #{constructionUnit,jdbcType=VARCHAR},
        </if>
        <if test="outsideDiameter != null">
            #{outsideDiameter,jdbcType=DOUBLE},
        </if>
        <if test="innerDiameter != null">
            #{innerDiameter,jdbcType=DOUBLE},
        </if>
        <if test="thickness != null">
            #{thickness,jdbcType=DOUBLE},
        </if>
        <if test="ringWidth != null">
            #{ringWidth,jdbcType=DOUBLE},
        </if>
        <if test="concreteStrengthGrade != null">
            #{concreteStrengthGrade,jdbcType=VARCHAR},
        </if>
        <if test="impermeabilityLevel != null">
            #{impermeabilityLevel,jdbcType=VARCHAR},
        </if>
        <if test="waterproofType != null">
            #{waterproofType,jdbcType=VARCHAR},
        </if>
    </trim>
  </insert>
  <insert id="proTurnsInsert" >
    insert into sys_pro_turn
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="turn != null">
        turn,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id},
      </if>
      <if test="proId != null">
        #{proId,jdbcType=VARCHAR},
      </if>
      <if test="turn != null">
        #{turn,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <insert id="proSizesInsert">
    insert into sys_pro_sizes
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="sizes != null">
        sizes,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id},
      </if>
      <if test="proId != null">
        #{proId,jdbcType=VARCHAR},
      </if>
      <if test="sizes != null">
        #{sizes,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <insert id="proHasInsert" >
    insert into sys_pro_has
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="hasSteel != null">
        has_steel,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id},
      </if>
      <if test="proId != null">
        #{proId,jdbcType=VARCHAR},
      </if>
      <if test="hasSteel != null">
        #{hasSteel,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <insert id="proGroutingInsert">
    insert into sys_pro_grouting
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="groutingHoles != null">
        grouting_holes,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id},
      </if>
      <if test="proId != null">
        #{proId,jdbcType=VARCHAR},
      </if>
      <if test="groutingHoles != null">
        #{groutingHoles,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <insert id="proBlokInsert" >
    insert into sys_pro_blok
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="proId != null">
        pro_id,
      </if>
      <if test="blockNum != null">
        block_num,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="proId != null">
        #{proId,jdbcType=VARCHAR},
      </if>
      <if test="blockNum != null">
        #{blockNum,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <select id="projectList" resultMap="BaseResultMap">
      select
          sp.*,
          sc.company_name,
          COUNT(tpi.pro_id) completed_quantity
      from sys_project sp
      left join sys_company sc on sp.company_id=sc.company_id
      left join (SELECT pro_id FROM t_pipe_info WHERE check_result in (1,2,3))  tpi on tpi.pro_id = sp.pro_id
      where sp.is_use=1
    <if test="proName!=null and proName!='' ">
        and sp.pro_name like concat('%',#{proName},'%')
    </if>
    <if test="companyId!=null and companyId!='' ">
        and sp.company_id=#{companyId}
    </if>
    GROUP BY sp.pro_id
    order by sp.create_time desc
  </select>
  <select id="proBlokSelect" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.SysProBlok">
        select spb.pro_id as proId,
        spb.block_num as blockNum,
        sd.dict_name as dictName
        from sys_pro_blok spb
        left join sys_dict sd  on spb.block_num=sd.dict_id
        where  spb.pro_id=#{proId}
  </select>
  <select id="proGroutingSelect" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.SysProGrouting">
        select spg.pro_id as proId,
        spg.grouting_holes as groutingHoles,
        sd.dict_name as dictName
        from sys_pro_grouting spg
        left join sys_dict sd  on spg.grouting_holes=sd.dict_id
        where  spg.pro_id=#{proId}
  </select>
  <select id="proHasSelect" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.SysProHas">
        select
        sph.has_steel as hasSteel,
        sph.pro_id as proId,
        sd.dict_name as dictName
        from sys_pro_has sph
        left join sys_dict sd  on sph.has_steel=sd.dict_id
        where  sph.pro_id=#{proId}
  </select>
  <select id="proSizesSelect" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.SysProSizes">
        select sps.pro_id as proId,
        sps.sizes as  sizes,
        sd.dict_name as dictName from sys_pro_sizes sps
        left join sys_dict sd  on sps.sizes=sd.dict_id
        where  sps.pro_id=#{proId}
  </select>
  <select id="proTurnSelect" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.SysProTurn">
        select spt.pro_id as proId,
        spt.turn as turn,
        sd.dict_name as dictName from sys_pro_turn spt
        left join sys_dict sd  on spt.turn=sd.dict_id
        where  spt.pro_id=#{proId}
  </select>
  <select id="projectInfo" parameterType="java.lang.String" resultMap="BaseResultMap">
        select * from sys_project where is_use=1 and pro_id=#{proId}
  </select>
  <update id="projectDel" parameterType="java.lang.String" >
    update sys_project set is_use=2
    where pro_id=#{proId}
  </update>
  <update id="projectUpdate">
    update sys_project
    <set>
      <if test="proName != null">
        pro_name = #{proName,jdbcType=VARCHAR},
      </if>
      <if test="proDesc != null">
        pro_desc = #{proDesc,jdbcType=VARCHAR},
      </if>
      <if test="startDate != null">
        start_date = #{startDate,jdbcType=TIMESTAMP},
      </if>
      <if test="proTime != null">
        pro_time = #{proTime,jdbcType=INTEGER},
      </if>
      <if test="planOutput != null">
        plan_output = #{planOutput,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="createUnit != null">
            create_unit = #{createUnit,jdbcType=VARCHAR},
        </if>
        <if test="planUnit != null">
            plan_unit = #{planUnit,jdbcType=VARCHAR},
        </if>
        <if test="supervisionUnit != null">
            supervision_unit = #{supervisionUnit,jdbcType=VARCHAR},
        </if>
        <if test="constructionUnit != null">
            construction_unit = #{constructionUnit,jdbcType=VARCHAR},
        </if>
        <if test="outsideDiameter != null">
            outside_diameter = #{outsideDiameter,jdbcType=DOUBLE},
        </if>
        <if test="innerDiameter != null">
            inner_diameter = #{innerDiameter,jdbcType=DOUBLE},
        </if>
        <if test="thickness != null">
            thickness = #{thickness,jdbcType=DOUBLE},
        </if>
        <if test="ringWidth != null">
            ring_width = #{ringWidth,jdbcType=DOUBLE},
        </if>
        <if test="concreteStrengthGrade != null">
            concrete_strength_grade = #{concreteStrengthGrade,jdbcType=VARCHAR},
        </if>
        <if test="impermeabilityLevel != null">
            impermeability_level = #{impermeabilityLevel,jdbcType=VARCHAR},
        </if>
        <if test="waterproofType != null">
            waterproof_type = #{waterproofType,jdbcType=VARCHAR},
        </if>
    </set>
    where pro_id = #{proId,jdbcType=VARCHAR}
  </update>
  <delete id="proBlokDel" parameterType="java.lang.String" >
    delete from sys_pro_blok where pro_id=#{proId}
  </delete>
  <delete id="proGroutingDel" parameterType="java.lang.String" >
    delete from sys_pro_grouting where pro_id=#{proId}
  </delete>
  <delete id="proHasDel" parameterType="java.lang.String" >
    delete from sys_pro_has where pro_id=#{proId}
  </delete>
  <delete id="proSizesDel" parameterType="java.lang.String" >
    delete from sys_pro_sizes where pro_id=#{proId}
  </delete>
  <delete id="proTurnsDel" parameterType="java.lang.String" >
    delete from sys_pro_turn where pro_id=#{proId}
  </delete>
<select id="projectPullSize" resultType="com.thhy.engineering.modules.biz.engineering.entity.SysDict">
    select sd.dict_id as dictId,sd.dict_name as dictName from sys_pro_sizes sps left join sys_dict sd
    on sps.sizes=sd.dict_id
    where sps.pro_id=#{proId} and sd.dict_type=#{dictType}
</select>
 
<select id="projectPullReinforcement" resultType="com.thhy.engineering.modules.biz.engineering.entity.SysDict">
    select sd.dict_id as dictId,sd.dict_name as dictName from sys_pro_has sph left join sys_dict sd
    on sph.has_steel=sd.dict_id
    where sph.pro_id=#{proId} and sd.dict_type=#{dictType}
</select>
<select id="projectPullBlock" resultType="com.thhy.engineering.modules.biz.engineering.entity.SysDict">
    select sd.dict_id as dictId,sd.dict_name as dictName from sys_pro_blok spb left join sys_dict sd
    on spb.block_num=sd.dict_id
    where spb.pro_id=#{proId} and sd.dict_type=#{dictType}
</select>
  <select id="newByProject" resultType="com.thhy.engineering.modules.biz.engineering.entity.SysProject">
        select pro_id as proId,pro_name as proName,pro_number as  proNumber
         from sys_project
    where is_use=1
   ORDER BY create_time desc  LIMIT 0,1
  </select>
  <select id="projectListPull" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.ProjectPullDto">
    select
    pro_id as proId,pro_name as proName
    from sys_project where  is_use=1
    <if test="companyId!=null and companyId!='' ">
      and company_id=#{companyId}
    </if>
  </select>
  <select id="projectSizeList" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.ProjectSizeDto">
          SELECT
      sp.pro_id as proId,
      sp.pro_name as proName,
      sps.sizes as sizeId,
      sd.dict_name as sizeName
  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
      <if test="companyId!=null and companyId!='' ">
        and sp.company_id=#{companyId}
      </if>
      <if test="proId!=null and proId!='' ">
        and sp.pro_id=#{proId}
      </if>
      <if test="sizeId!=null and sizeId!='' ">
        and sps.sizes=#{sizeId}
      </if>
      order by sp.create_time,sd.create_time desc
  </select>
  <select id="projectSizeThingJsList" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.ProjectSizeDto">
          SELECT
      sp.pro_id as proId,
      sp.pro_name as proName,
      sps.sizes as sizeId,
      sd.dict_name as sizeName
  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
      <if test="companyId!=null and companyId!='' ">
        and sp.company_id=#{companyId}
      </if>
      order by sp.create_time,sd.create_time desc
  </select>
 
  <select id="proHasList" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.ProjcetHasDto">
  SELECT
        sp.pro_id as proId,
        sph.has_steel as hasSteel,
        sd.dict_name as has,
        sd.colors
    FROM
        sys_project sp
        LEFT JOIN sys_pro_has sph ON sp.pro_id = sph.pro_id
        left join sys_dict sd on sph.has_steel=sd.dict_id
        where sp.is_use=1
        and sp.pro_id=#{proId}
  </select>
 
  <select id="proBlokList" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.engineering.entity.ProSunDto.ProjectBlokDto">
    SELECT
        sp.pro_id as proId,
        spb.block_num as blockNum,
        sd.dict_name as blockName
    FROM
        sys_project sp
        LEFT JOIN sys_pro_blok spb ON sp.pro_id = spb.pro_id
        left join sys_dict sd on spb.block_num=sd.dict_id
        where sp.is_use=1
        and sp.pro_id=#{proId}
  </select>
 
</mapper>