张晓波
2023-09-19 164694c47c35d6654df69b533e8dbf8b5423efc5
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
<?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="company_name" jdbcType="VARCHAR" property="companyName" />
  </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>
    </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>
    </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 from sys_project sp
    left join sys_company sc on sp.company_id=sc.company_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>
    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>
    </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>