Houjie
2025-06-13 4a6f839ec9fe6123636e239e3bdacb73a7fffbf4
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
<?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="org.jeecg.modules.tms.mapper.BaseToolsMapper">
    <select id="paraHolesToolsList" resultType="org.jeecg.modules.tms.entity.vo.ParaHolesToolsVo">
        select
            t.id,
            t.classify_id classifyId,
            t.tool_code toolCode,
            t.sign_code signCode,
            t.chinese_name chineseName,
            t.foreign_language_name foreignLanguageName,
            t.standard_level standardLevel,
            t.standard_code standardCode,
            t.tool_model toolModel,
            t.parama_table_name paramaTableName,
            t.tool_picture toolPicture,
            t1.application_type applicationType,
            t1.supplier_id supplierId,
            t1.province_city provinceCity,
            t1.position_code positionCode,
            t1.storage_location storageLocation,
            t1.main_unit mainUnit,
            t1.auxiliary_unit auxiliaryUnit,
            t1.auxiliary_unit_flag auxiliaryUnitFlag,
            t1.price,
            t1.lower_inventory lowerInventory,
            t1.highest_inventory highestInventory,
            t2.diameter,
            t2.cone_angle coneAngle,
            t2.edge_length edgeLength,
            t2.total_length totalLength,
            t2.tool_material toolMaterial,
            t2.part_material partMaterial,
            t2.paintcoat_flag paintcoatFlag,
            t2.tool_pattern toolPattern,
            t2.handle_specifications handleSpecifications,
            t2.cooling_method coolingMethod,
            t2.technical_conditions technicalConditions,
            t2.conditions_info conditionsInfo,
            t2.brand,
            t2.types,
            t2.tolerance_class toleranceClass,
            t2.flute_form fluteForm,
            t2.handle_form handleForm,
            t2.blade_count bladeCount,
            t2.small_diameter smallDiameter,
            t2.chamfer_angle chamferAngle,
            t2.fitter_part fitterPart,
            t2.effective_length effectiveLength,
            t2.drill_diameter_range drillDiameterRange,
            t2.knife_diameter knifeDiameter,
            t2.bore_diameter boreDiameter,
            t2.connector_type connectorType,
            t2.slot_specification slotSpecification,
            t2.scope_of_application scopeOfApplication,
            t2.latest_boring_diameter latestBoringDiameter,
            t2.max_boring_diameter maxBoringDiameter,
            t2.processingmethod processingmethod,
            t2.heads_number headsNumber,
            t2.adapt_holder adaptHolder,
            t2.remark,
            t3.classify_id classifyNum,
            t3.type_name classifyName,
            t4.item_text applicationTypeName
        from tms_base_tools t
                 left join tms_tools_config_property t1 on t1.tool_code = t.id
                 left join tms_para_hole_tools t2 on t2.tool_code = t.id
                 left join tms_tools_classify t3 on t3.id = t.classify_id
                 left join (select * from v_sys_dict where dict_code = 'application_type') t4 on t4.item_value = t1.application_type
            ${ew.customSqlSegment}
    </select>
    <select id="paraCommonToolList" resultType="org.jeecg.modules.tms.entity.vo.ParaCommonToolVo">
        select
            t.id,
            t.id toolCodeId,
            t.classify_id classifyId,
            t.tool_code toolCode,
            t.sign_code signCode,
            t.chinese_name chineseName,
            t.foreign_language_name foreignLanguageName,
            t.standard_level standardLevel,
            t.standard_code standardCode,
            t.tool_model toolModel,
            t.parama_table_name paramaTableName,
            t.tool_picture toolPicture,
            t1.application_type applicationType,
            t1.supplier_id supplierId,
            t1.province_city provinceCity,
            t1.position_code positionCode,
            t1.storage_location storageLocation,
            t1.main_unit mainUnit,
            t1.auxiliary_unit auxiliaryUnit,
            t1.auxiliary_unit_flag auxiliaryUnitFlag,
            t1.price,
            t1.lower_inventory lowerInventory,
            t1.highest_inventory highestInventory,
            t3.classify_id classifyNum,
            t3.type_name classifyName,
            t4.item_text applicationTypeName
        from tms_base_tools t
                 left join tms_tools_config_property t1 on t1.tool_code = t.id
                 left join tms_tools_classify t3 on t3.id = t.classify_id
                 left join (select * from v_sys_dict where dict_code = 'application_type') t4 on t4.item_value = t1.application_type
            ${ew.customSqlSegment}
    </select>
    <select id="paraThreadingToolList" resultType="org.jeecg.modules.tms.entity.vo.ParaThreadingToolVo">
        SELECT
            t.id,
            t.classify_id classifyId,
            t.tool_code toolCode,
            t.sign_code signCode,
            t.chinese_name chineseName,
            t.foreign_language_name foreignLanguageName,
            t.standard_level standardLevel,
            t.standard_code standardCode,
            t.tool_model toolModel,
            t.parama_table_name paramaTableName,
            t.tool_picture toolPicture,
            t1.application_type applicationType,
            t1.supplier_id supplierId,
            t1.province_city provinceCity,
            t1.position_code positionCode,
            t1.storage_location storageLocation,
            t1.main_unit mainUnit,
            t1.auxiliary_unit auxiliaryUnit,
            t1.auxiliary_unit_flag auxiliaryUnitFlag,
            t1.price,
            t1.lower_inventory lowerInventory,
            t1.highest_inventory highestInventory,
            t1.remark,
            t2.thread_code threadCode,
            t2.pitch,
            t2.rotation_direction rotationDirection,
            t2.tolerancezone_level tolerancezoneLevel,
            t2.edge_length edgeLength,
            t2.total_length totalLength,
            t2.tool_material toolMaterial,
            t2.part_material partMaterial,
            t2.paintcoat_flag paintcoatFlag,
            t2.external_dimensions externalDimensions,
            t2.handle_specifications handleSpecifications,
            t2.technical_conditions technicalConditions,
            t2.conditions_info conditionsInfo,
            t2.brand,
            t2.types,
            t2.screw_hole_type screwHoleType,
            t2.cooling_method coolingMethod,
            t2.thread_standard threadStandard,
            t2.flute_solt_type fluteSoltType,
            t2.guiding_size guidingSize,
            t2.thread_type threadType,
            t2.connection_aperture connectionAperture,
            t2.connecting_keyway connectingKeyway,
            t3.classify_id classifyNum,
            t3.type_name classifyName,
            t4.item_text applicationTypeName
        FROM
            tms_base_tools t
                LEFT JOIN tms_tools_config_property t1 ON t1.tool_code = t.id
                LEFT JOIN tms_para_threading_tool t2 ON t2.tool_code = t.id
                LEFT JOIN tms_tools_classify t3 ON t3.id = t.classify_id
                left join (select * from v_sys_dict where dict_code = 'application_type') t4 on t4.item_value = t1.application_type
            ${ew.customSqlSegment}
    </select>
    <select id="paraMillToolList" resultType="org.jeecg.modules.tms.entity.vo.ParaMillToolVo">
        SELECT
            t.id,
            t.classify_id classifyId,
            t.tool_code toolCode,
            t.sign_code signCode,
            t.chinese_name chineseName,
            t.foreign_language_name foreignLanguageName,
            t.standard_level standardLevel,
            t.standard_code standardCode,
            t.tool_model toolModel,
            t.parama_table_name paramaTableName,
            t.tool_picture toolPicture,
            t1.application_type applicationType,
            t1.supplier_id supplierId,
            t1.province_city provinceCity,
            t1.position_code positionCode,
            t1.storage_location storageLocation,
            t1.main_unit mainUnit,
            t1.auxiliary_unit auxiliaryUnit,
            t1.auxiliary_unit_flag auxiliaryUnitFlag,
            t1.price,
            t1.lower_inventory lowerInventory,
            t1.highest_inventory highestInventory,
            t2.diameter,
            t2.nose_angle_r noseAngleR,
            t2.number_of_teeth numberOfTeeth,
            t2.edge_length edgeLength,
            t2.total_length totalLength,
            t2.tool_material toolMaterial,
            t2.part_material partMaterial,
            t2.paintcoat_flag paintcoatFlag,
            t2.tool_pattern toolPattern,
            t2.clamping_specifications clampingSpecifications,
            t2.cooling_method coolingMethod,
            t2.technical_conditions technicalConditions,
            t2.conditions_info conditionsInfo,
            t2.brand,
            t2.neck_diameter neckDiameter,
            t2.handle_form handleForm,
            t2.nose_angle_c noseAngleC,
            t2.angle_inside_r angleInsideR,
            t2.small_diameter smallDiameter,
            t2.tool_angle toolAngle,
            t2.handle_length handleLength,
            t2.main_angle_k mainAngleK,
            t2.deepest_depth deepestDepth,
            t2.adapt_blade adaptBlade,
            t2.handle_neck_form handleNeckForm,
            t2.handle_neck_length handleNeckLength,
            t2.size_specifications sizeSpecifications,
            t2.milling_head_form millingHeadForm,
            t2.overhanging_length overhangingLength,
            t2.cutting_edge_form cuttingEdgeForm,
            t2.number_patterns numberPatterns,
            t2.pitch,
            t2.recently_diameter recentlyDiameter,
            t3.classify_id classifyNum,
            t3.type_name classifyName,
            t4.item_text applicationTypeName
        FROM
            tms_base_tools t
                LEFT JOIN tms_tools_config_property t1 ON t1.tool_code = t.id
                LEFT JOIN tms_para_mill_tool t2 ON t2.tool_code = t.id
                LEFT JOIN tms_tools_classify t3 ON t3.id = t.classify_id
                left join (select * from v_sys_dict where dict_code = 'application_type') t4 on t4.item_value = t1.application_type
            ${ew.customSqlSegment}
    </select>
    <select id="paraTurningToolsList" resultType="org.jeecg.modules.tms.entity.vo.ParaTurningToolsVo">
        SELECT
            t.id,
            t.classify_id classifyId,
            t.tool_code toolCode,
            t.sign_code signCode,
            t.chinese_name chineseName,
            t.foreign_language_name foreignLanguageName,
            t.standard_level standardLevel,
            t.standard_code standardCode,
            t.tool_model toolModel,
            t.parama_table_name paramaTableName,
            t.tool_picture toolPicture,
            t1.application_type applicationType,
            t1.supplier_id supplierId,
            t1.province_city provinceCity,
            t1.position_code positionCode,
            t1.storage_location storageLocation,
            t1.main_unit mainUnit,
            t1.auxiliary_unit auxiliaryUnit,
            t1.auxiliary_unit_flag auxiliaryUnitFlag,
            t1.price,
            t1.lower_inventory lowerInventory,
            t1.highest_inventory highestInventory,
            t2.head_specifications headSpecifications,
            t2.matching_number matchingNumber,
            t2.lead_angle leadAngle,
            t2.cross_sectional_size crossSectionalSize,
            t2.total_length totalLength,
            t2.cutting_direction cuttingDirection,
            t2.tool_material toolMaterial,
            t2.part_material partMaterial,
            t2.tool_pattern toolPattern,
            t2.paintcoat_flag paintcoatFlag,
            t2.technical_conditions technicalConditions,
            t2.conditions_info conditionsInfo,
            t2.brand,
            t2.conditions_info,
            t2.types,
            t2.knife_size knifeSize,
            t2.cooling_method coolingMethod,
            t2.holder_category holderCategory,
            t2.tool_diameter toolDiameter,
            t2.fastening_form fasteningForm,
            t2.boring_bar_diameter boringBarDiameter,
            t2.blade_length bladeLength,
            t2.blade_shape bladeShape,
            t2.blade_posterior bladePosterior,
            t2.bar_direction barDirection,
            t2.blade_height bladeHeight,
            t2.blade_wide bladeWide,
            t2.blade_size bladeSize,
            t2.knife_clip_model knifeClipModel,
            t2.clamping_method clampingMethod,
            t2.slot_width slotWidth,
            t2.small_diameter smallDiameter,
            t2.max_diameter maxDiameter,
            t2.max_depth maxDepth,
            t2.knife_bar_form knifeBarForm,
            t2.blade_thickness bladeThickness,
            t2.min_diameter minDiameter,
            t3.classify_id classifyNum,
            t3.type_name classifyName,
            t4.item_text applicationTypeName
        FROM
            tms_base_tools t
                LEFT JOIN tms_tools_config_property t1 ON t1.tool_code = t.id
                LEFT JOIN tms_para_turning_tools t2 ON t2.tool_code = t.id
                LEFT JOIN tms_tools_classify t3 ON t3.id = t.classify_id
                left join (select * from v_sys_dict where dict_code = 'application_type') t4 on t4.item_value = t1.application_type
            ${ew.customSqlSegment}
    </select>
    <select id="paraBladeList" resultType="org.jeecg.modules.tms.entity.vo.ParaBladeVo">
        SELECT
            t.id,
            t.classify_id classifyId,
            t.tool_code toolCode,
            t.sign_code signCode,
            t.chinese_name chineseName,
            t.foreign_language_name foreignLanguageName,
            t.standard_level standardLevel,
            t.standard_code standardCode,
            t.tool_model toolModel,
            t.parama_table_name paramaTableName,
            t.tool_picture toolPicture,
            t1.application_type applicationType,
            t1.supplier_id supplierId,
            t1.province_city provinceCity,
            t1.position_code positionCode,
            t1.storage_location storageLocation,
            t1.main_unit mainUnit,
            t1.auxiliary_unit auxiliaryUnit,
            t1.auxiliary_unit_flag auxiliaryUnitFlag,
            t1.price,
            t1.lower_inventory lowerInventory,
            t1.highest_inventory highestInventory,
            t1.remark,
            t2.blade_shape bladeShape,
            t2.blade_length bladeLength,
            t2.cutting_edge_count cuttingEdgeCount,
            t2.blade_thickness bladeThickness,
            t2.clamping_type clampingType,
            t2.nose_angle_r noseAngleR,
            t2.tool_material toolMaterial,
            t2.part_material partMaterial,
            t2.paintcoat_flag paintcoatFlag,
            t2.technical_conditions technicalConditions,
            t2.conditions_info conditionsInfo,
            t2.brand,
            t2.types,
            t2.coating_material coatingMaterial,
            t2.processing_classify processingClassify,
            t2.blade_posterior bladePosterior,
            t2.cutting_direction cuttingDirection,
            t2.blade_wide bladeWide,
            t2.blade_size bladeSize,
            t2.in_out_thread inOutThread,
            t2.thread_standard threadStandard,
            t2.dental_angle dentalAngle,
            t2.pitch,
            t2.min_internal_thread minInternalThread,
            t3.classify_id classifyNum,
            t3.type_name classifyName,
            t4.item_text applicationTypeName
        FROM
            tms_base_tools t
                LEFT JOIN tms_tools_config_property t1 ON t1.tool_code = t.id
                LEFT JOIN tms_para_blade t2 ON t2.tool_code = t.id
                LEFT JOIN tms_tools_classify t3 ON t3.id = t.classify_id
                left join (select * from v_sys_dict where dict_code = 'application_type') t4 on t4.item_value = t1.application_type
            ${ew.customSqlSegment}
    </select>
 
    <select id="pageWithLedgerAndConfig" resultType="org.jeecg.modules.tms.entity.vo.StocktakingPoundVo">
        SELECT
        t.id,
        t.create_time AS createTime,
        t.tool_code AS toolCode,
        t2.tool_model AS toolModel,
        t2.parama_table_name AS paramaTableName,
        t.tool_id AS toolId,
        t3.position_code AS positionCode,
        t3.application_type AS applicationType,
        t3.chinese_name AS chineseName,
        t3.supplier_id AS supplierId,
        t3.storage_location AS storageLocation,
        t3.main_unit AS mainUnit,
        t1.available_count AS availableCount,
        t1.total_count AS totalCount,
        t3.warehouse_id AS warehouseId,
        t4.classify_id AS classifyId,
        t3.province_city AS provinceCity,
        <!-- 动态字段选择,使用表别名(需确保表已关联) -->
        <choose>
            <when test="ew.paramNameValuePairs.paramaTableName == '1'">
                c.tool_material AS toolMaterial,
                c.part_material AS partMaterial
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '2'">
                h.tool_material AS toolMaterial,
                h.part_material AS partMaterial
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '3'">
                th.tool_material AS toolMaterial,
                th.part_material AS partMaterial
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '4'">
                m.tool_material AS toolMaterial,
                m.part_material AS partMaterial
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '5'">
                tr.tool_material AS toolMaterial,
                tr.part_material AS partMaterial
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '6'">
                b.tool_material AS toolMaterial,
                b.part_material AS partMaterial
            </when>
            <!-- 默认情况:paramaTableName 为空或未传递时,关联 tms_para_common_tool 表 -->
            <otherwise>
                c.tool_material AS toolMaterial,
                c.part_material AS partMaterial
            </otherwise>
        </choose>
        FROM tms_tool_ledger_detail t
        left join tms_tool_ledger t1 ON  t1.tool_id= t.tool_Code
        left join tms_tools_classify t4 on t4.id = t1.classify_id
        left join tms_base_tools t2 on t2.id = t.tool_code
        left join tms_tools_config_property t3 on t3.tool_code = t.tool_code
 
 
        <!-- 动态表关联,确保所有情况都有对应的 LEFT JOIN -->
        <choose>
            <when test="ew.paramNameValuePairs.paramaTableName == '1'">
                LEFT JOIN tms_para_common_tool c ON c.tool_code = t.id
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '2'">
                LEFT JOIN tms_para_hole_tools h ON h.tool_code = t.id
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '3'">
                LEFT JOIN tms_para_threading_tool th ON th.tool_code = t.id
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '4'">
                LEFT JOIN tms_para_mill_tool m ON m.tool_code = t.id
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '5'">
                LEFT JOIN tms_para_turning_tools tr ON tr.tool_code = t.id
            </when>
            <when test="ew.paramNameValuePairs.paramaTableName == '6'">
                LEFT JOIN tms_para_blade b ON b.tool_code = t.id
            </when>
            <!-- 默认情况:添加 LEFT JOIN tms_para_common_tool c -->
            <otherwise>
                LEFT JOIN tms_para_common_tool c ON c.tool_code = t.id
            </otherwise>
        </choose>
 
        <where>
            <if test="ew.paramNameValuePairs.toolId != null and ew.paramNameValuePairs.toolId != ''">
                AND t.tool_id LIKE CONCAT('%', #{ew.paramNameValuePairs.toolId}, '%')
            </if>
        </where>
 
        ORDER BY t.create_time DESC
    </select>
 
 
    <select id="pageWithSharpedAndConfig" resultType="org.jeecg.modules.tms.entity.vo.SharpeeningVo">
        SELECT
        t.id,
        t.create_time AS createTime,
        t.tool_code AS toolCode,
        t2.tool_model AS toolModel,
        t2.parama_table_name AS paramaTableName,
        t.tool_id AS toolId,
        t3.position_code AS positionCode,
        t3.application_type AS applicationType,
        t3.chinese_name AS chineseName,
        t3.supplier_id AS supplierId,
        t3.storage_location AS storageLocation,
        t3.main_unit AS mainUnit,
        t3.warehouse_id AS warehouseId,
        t4.classify_id AS classifyId,
        t3.province_city AS provinceCity
        FROM tms_tool_ledger_detail t
        left join tms_tool_ledger t1 ON  t1.tool_id= t.tool_Code
        left join tms_tools_classify t4 on t4.id = t1.classify_id
        left join tms_base_tools t2 on t2.id = t.tool_code
        left join tms_tools_config_property t3 on t3.tool_code = t.tool_code
--         FROM tms_base_tools t
--         LEFT JOIN tms_tool_ledger t1 ON t1.tool_id = t.id
--         LEFT JOIN tms_tools_config_property t3 ON t3.tool_code = t.id
 
 
        <where>
            <if test="ew.paramNameValuePairs.toolId != null and ew.paramNameValuePairs.toolId != ''">
                AND t.tool_id LIKE CONCAT('%', #{ew.paramNameValuePairs.toolId}, '%')
            </if>
        </where>
 
        ORDER BY t.create_time DESC
    </select>
 
</mapper>