李林
2023-10-07 658d4927d468c47208fd012d9128b09249c07eff
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
<?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.chinaztt.mes.plan.mapper.MoTestStandardMapper">
 
    <resultMap id="planMoTestStandardMap" type="com.chinaztt.mes.plan.entity.MoTestStandard">
        <id property="id" column="id"/>
        <result property="standardNo" column="standard_no"/>
        <result property="standardName" column="standard_name"/>
        <result property="remark" column="remark"/>
        <result property="version" column="version"/>
        <result property="moId" column="mo_id"/>
        <result property="inspectionType" column="inspection_type"/>
        <result property="judgeFormula" column="judge_formula"/>
    </resultMap>
 
    <resultMap id="planMoTestStandardMapDto" type="com.chinaztt.mes.plan.dto.MoTestStandardDTO">
        <id property="id" column="id"/>
        <result property="standardNo" column="standard_no"/>
        <result property="standardName" column="standard_name"/>
        <result property="remark" column="remark"/>
        <result property="version" column="version"/>
        <result property="moId" column="mo_id"/>
        <result property="customerOrderNo" column="customer_order_no"/>
        <result property="moNo" column="mo_no"/>
        <result property="moId" column="mo_id"/>
        <result property="inspectionType" column="inspection_type"/>
    </resultMap>
 
    <insert id="copyParamByTestStandardId">
        INSERT INTO plan_mo_test_standard_param(code, parameter_item, "type", unit, reference_value, "index", mo_test_standard_id, param_type,
                                                judge_formula, value_formula, parameter_format, aisle, "position", wire_core, default_value, is_check)
        SELECT qtsp.code,
               qtsp.parameter_item,
               qtsp."type",
               qtsp.unit,
               qtsp.reference_value,
               qtsp."index",
               #{id},
               qtsp.param_type,
               judge_formula,
               value_formula,
               qtsp.parameter_format,
               qtsp.aisle,
               qtsp."position",
               qtsp.wire_core,
               qtsp.default_value,
               qtsp.is_check
        FROM quality_test_standard_param qtsp
        WHERE qtsp.test_standard_id = #{testStandardId}
          AND qtsp.active = TRUE
    </insert>
 
    <!-- 支持 -->
    <select id="getManufacturingOrderStand" resultMap="planMoTestStandardMapDto">
        SELECT pco.customer_order_no,
               pmo.mo_no,
               pmts.standard_no,
               pmts.standard_name,
               pmts.remark,
               pmts."id",
               pmo.id mo_id,
               pmts.inspection_type
        FROM plan_mo_test_standard pmts
                 LEFT JOIN plan_manufacturing_order pmo ON pmo."id" = pmts.mo_id
                 LEFT JOIN plan_join_model_customer pjmc ON pjmc.model_id = pmo."id" AND pjmc.model = 'plan_manufacturing_order'
                 LEFT JOIN plan_customer_order pco ON pco."id" = pjmc.customer_order_id
        <if test="ew.emptyOfWhere == false">
            ${ew.customSqlSegment}
        </if>
    </select>
 
    <insert id="createMoTestParamByDocTestStandardId">
        INSERT INTO plan_mo_test_standard_param(code, parameter_item, "type", unit, reference_value, "index",
                                                mo_test_standard_id, param_type,
                                                judge_formula, value_formula, parameter_format, aisle, position,
                                                wire_core,extends_part_no, extends_routing_id, extends_routing_no,
                                                extends_operation_id, extends_operation_no, extends_test_standard_id,
                                                extends_test_standard_no,extends_test_standard_param_id,
                                                extends_test_standard_param_no,
                                                technology_document_standard_param_id, default_value,is_check)
        SELECT tdsp.code,
               tdsp.parameter_item,
               tdsp."type",
               tdsp.unit,
               tdsp.reference_value,
               tdsp."index",
               #{id},
               tdsp.param_type,
               tdsp.judge_formula,
               tdsp.value_formula,
               tdsp.parameter_format,
               tdsp.aisle,
               tdsp.position,
               tdsp.wire_core,
               tdsp.extends_part_no,
               tdsp.extends_routing_id,
               tdsp.extends_routing_no,
               tdsp.extends_operation_id,
               tdsp.extends_operation_no,
               tdsp.extends_test_standard_id,
               tdsp.extends_test_standard_no,
               tdsp.extends_test_standard_param_id,
               tdsp.extends_test_standard_param_no,
               tdsp.id,
               tdsp.default_value,
               tdsp.is_check
        FROM technology_document_standard_param tdsp
        WHERE tdsp.test_standard_id = #{docTestStandardId}
    </insert>
 
</mapper>