李林
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
<?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.production.mapper.ProductMainMapper">
 
    <resultMap id="productMainMap" type="com.chinaztt.mes.production.dto.ProductMainDTO">
        <id property="id" column="id"/>
        <result property="productNo" column="product_no"/>
        <result property="workstationId" column="workstation_id"/>
        <result property="operationTaskId" column="operation_task_id"/>
    </resultMap>
 
    <resultMap id="productMainListMap" type="com.chinaztt.mes.production.dto.ProductMainListDTO">
        <result property="id" column="id"/>
        <result property="productNo" column="product_no"/>
        <result property="workstationId" column="workstation_id"/>
        <result property="operationTaskId" column="operation_task_id"/>
        <result property="operationName" column="operation_name"/>
        <result property="state" column="state"/>
        <result property="partId" column="part_id"/>
        <result property="partNo" column="part_no"/>
        <result property="partName" column="part_name"/>
        <result property="unit" column="unit"/>
        <result property="productQty" column="product_qty"/>
        <result property="productMainId" column="product_main_id"/>
        <result property="outBatchNo" column="out_batch_no"/>
        <result property="systemNo" column="system_no"/>
        <result property="sortNo" column="sort_no"/>
        <result property="startMeterMark" column="start_meter_mark"/>
        <result property="endMeterMark" column="end_meter_mark"/>
        <result property="reelNumber" column="reel_number"/>
        <result property="ifsBatchNo" column="ifs_batch_no"/>
        <result property="ifsSync" column="ifs_sync"/>
        <result property="segmentDesc" column="segment_desc"/>
        <result property="scrapQty" column="scrap_qty"/>
        <result property="shiftState" column="shift_state"/>
        <result property="remark" column="remark"/>
        <result property="reelWeight" column="reel_weight"/>
        <result property="grossWeight" column="gross_weight"/>
        <result property="netWeight" column="net_weight"/>
        <result property="outputId" column="output_id"/>
        <result property="printNum" column="print_num"/>
    </resultMap>
 
    <select id="getProductMain" resultMap="productMainMap">
        select opm."id",opm.product_no,opm.workstation_id,opm.operation_task_id
        from production_product_main opm
        <if test="ew.emptyOfWhere == false">
            <where>
                ${ew.SqlSegment}
            </where>
        </if>
    </select>
 
    <select id="getList" resultMap="productMainListMap">
        select temp.* from(
        SELECT
        po.id as output_id,
        pm.id as product_main_id,
        pm.product_no as product_no,
        pm.workstation_id as workstation_id,
        pm.operation_task_id as operation_task_id,
        pm.state as state,
        po.part_id as part_id,
        pm.id as id,
        po.product_qty as product_qty,
        po.out_batch_no as out_batch_no,
        po.system_no as system_no,
        po.sort_no as sort_no,
        po.start_meter_mark as start_meter_mark,
        po.end_meter_mark as end_meter_mark,
        po.reel_number as reel_number,
        po.ifs_batch_no as ifs_batch_no,
        po.ifs_sync as ifs_sync,
        po.segment_desc as segment_desc,
        po.scrap_qty as scrap_qty,
        po.remark as remark,
        po.reel_weight as reel_weight,
        po.gross_weight as gross_weight,
        po.net_weight as net_weight,
        po.print_num,
        p.part_no,
        p.part_name,
        p.unit,
        o.name operation_name,
        po.state shift_state
        FROM
        production_product_main pm
        LEFT JOIN production_product_output po ON pm."id" = po.product_main_id
        LEFT JOIN basic_part p ON po.part_id = p.id
        LEFT JOIN production_operation_task ot ON pm.operation_task_id = ot.id
        LEFT JOIN technology_routing_operation ro ON ro.ID = ot.routing_operation_id
        LEFT JOIN technology_operation o ON o.ID = ro.operation_id
        ORDER BY
        pm."id" DESC) temp
        <if test="ew.emptyOfWhere == false">
            ${ew.customSqlSegment}
        </if>
    </select>
</mapper>