李林
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
<?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.MoStructureComponentMapper">
 
    <resultMap id="moStructureComponentMap" type="com.chinaztt.mes.plan.dto.MoStructureComponentDTO">
        <id property="id" column="id"/>
        <result property="planManufacturingOrderId" column="plan_manufacturing_order_id"/>
        <result property="partId" column="part_id"/>
        <result property="qpa" column="qpa"/>
        <result property="routingOperationId" column="routing_operation_id"/>
        <result property="remark" column="remark"/>
        <result property="partNo" column="part_no"/>
        <result property="partName" column="part_name"/>
        <result property="operationNo" column="operation_no"/>
        <result property="operationName" column="operation_name"/>
        <result property="parent" column="parent"/>
        <result property="discNum" column="disc_num"/>
        <result property="unit" column="unit"/>
        <result property="planningMethod" column="planning_method"/>
        <result property="materialType" column="material_type"/>
        <result property="operationId" column="operation_id"/>
    </resultMap>
 
    <select id="selectListByManufacturingOrderId" resultMap="moStructureComponentMap">
        SELECT pmsc.*,
               bp.part_name,
               bp.part_no,
               bp.unit,
               teo.operation_no,
               teo."name" operation_name
        FROM plan_mo_structure_component pmsc
                 LEFT JOIN basic_part bp ON bp."id" = pmsc.part_id
                 LEFT JOIN technology_routing_operation tro ON tro."id" = pmsc.routing_operation_id
                 LEFT JOIN technology_operation teo ON teo."id" = pmsc.operation_id
        WHERE pmsc.plan_manufacturing_order_id = #{id}
    </select>
 
 
    <select id="selectBomComponents" resultMap="moStructureComponentMap">
        SELECT A.part_id,
               A.qpa,
               b.part_no,
               b.part_name,
               A.parent
        FROM
            technology_bom_component A,
            basic_part b
        WHERE
            A.bom_id = #{bomId}
          AND A.part_id = b.ID
    </select>
 
    <select id="selectMoComponents" resultMap="moStructureComponentMap">
        SELECT
            a.*,
            b.part_no,
            b.part_name,
            b.planning_method,
            b.material_type
        FROM
            plan_mo_structure_component A
                LEFT JOIN basic_part b ON A.part_id = b."id"
        WHERE
            A.plan_manufacturing_order_id = #{moId}
    </select>
 
 
    <select id="selectQpaByManufacturingOrderIdAndPartId" resultMap="moStructureComponentMap">
        SELECT qpa,disc_num,parent
        FROM plan_mo_structure_component
        WHERE plan_manufacturing_order_id = #{id}
          AND part_id = #{partId}
    </select>
</mapper>