huangjiayang
2025-05-09 6e2533f366a28e5f0147f8c8b62a1593acc2a61c
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
<?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.aps.core.mapper.ApsPlateStandardRequireBomOrderDetailMapper">
    
    <resultMap type="ApsPlateStandardRequireBomOrderDetail" id="ApsPlateStandardRequireBomOrderDetailResult">
        <result property="id"    column="id"    />
        <result property="requireId"    column="require_id"    />
        <result property="requireTrackId"    column="require_track_id"    />
        <result property="bomLineId"    column="bom_line_id"    />
        <result property="bomLineCode"    column="bom_line_code"    />
        <result property="docNo"    column="doc_no"    />
        <result property="beforeProdAmount"    column="before_prod_amount"    />
        <result property="deductionAmount"    column="deduction_amount"    />
        <result property="afterProdAmount"    column="after_prod_amount"    />
        <result property="orgCode"    column="org_code"    />
        <result property="batchNumber"    column="batch_number"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>
 
    <sql id="selectApsPlateStandardRequireBomOrderDetailVo">
        select id, require_id,require_track_id, bom_line_id, bom_line_code, doc_no,
               before_prod_amount, deduction_amount, after_prod_amount,
               org_code, batch_number, del_flag, create_time, create_by, update_by, update_time
        from aps_plate_standard_require_bom_order_detail
    </sql>
 
    <select id="selectApsPlateStandardRequireBomOrderDetailList" parameterType="ApsPlateStandardRequireBomOrderDetail" resultMap="ApsPlateStandardRequireBomOrderDetailResult">
        <include refid="selectApsPlateStandardRequireBomOrderDetailVo"/>
        <where>  
            <if test="requireId != null  and requireId != ''"> and require_id = #{requireId}</if>
            <if test="requireTrackId != null  and requireTrackId != ''"> and require_track_id = #{requireTrackId}</if>
            <if test="bomLineId != null  and bomLineId != ''"> and bom_line_id = #{bomLineId}</if>
            <if test="bomLineCode != null  and bomLineCode != ''"> and bom_line_code = #{bomLineCode}</if>
            <if test="docNo != null  and docNo != ''"> and doc_no = #{docNo}</if>
            <if test="beforeProdAmount != null  and beforeProdAmount != ''"> and before_prod_amount = #{beforeProdAmount}</if>
            <if test="deductionAmount != null  and deductionAmount != ''"> and deduction_amount = #{deductionAmount}</if>
            <if test="afterProdAmount != null  and afterProdAmount != ''"> and after_prod_amount = #{afterProdAmount}</if>
            <if test="orgCode != null  and orgCode != ''"> and org_code = #{orgCode}</if>
            <if test="batchNumber != null  and batchNumber != ''"> and batch_number = #{batchNumber}</if>
        </where>
    </select>
    
    <select id="selectApsPlateStandardRequireBomOrderDetailById" parameterType="Long" resultMap="ApsPlateStandardRequireBomOrderDetailResult">
        <include refid="selectApsPlateStandardRequireBomOrderDetailVo"/>
        where id = #{id}
    </select>
 
    <insert id="insertApsPlateStandardRequireBomOrderDetail" parameterType="ApsPlateStandardRequireBomOrderDetail">
        insert into aps_plate_standard_require_bom_order_detail
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="requireId != null">require_id,</if>
            <if test="requireTrackId != null">require_track_id,</if>
 
            <if test="bomLineId != null">bom_line_id,</if>
            <if test="bomLineCode != null">bom_line_code,</if>
            <if test="docNo != null">doc_no,</if>
            <if test="beforeProdAmount != null">before_prod_amount,</if>
            <if test="deductionAmount != null">deduction_amount,</if>
            <if test="afterProdAmount != null">after_prod_amount,</if>
            <if test="orgCode != null">org_code,</if>
            <if test="batchNumber != null">batch_number,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="requireId != null">#{requireId},</if>
            <if test="requireTrackId != null">#{requireTrackId},</if>
 
            <if test="bomLineId != null">#{bomLineId},</if>
            <if test="bomLineCode != null">#{bomLineCode},</if>
            <if test="docNo != null">#{docNo},</if>
            <if test="beforeProdAmount != null">#{beforeProdAmount},</if>
            <if test="deductionAmount != null">#{deductionAmount},</if>
            <if test="afterProdAmount != null">#{afterProdAmount},</if>
            <if test="orgCode != null">#{orgCode},</if>
            <if test="batchNumber != null">#{batchNumber},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>
 
    <update id="updateApsPlateStandardRequireBomOrderDetail" parameterType="ApsPlateStandardRequireBomOrderDetail">
        update aps_plate_standard_require_bom_order_detail
        <trim prefix="SET" suffixOverrides=",">
            <if test="requireId != null">require_id = #{requireId},</if>
            <if test="requireTrackId != null">require_track_id = #{requireTrackId},</if>
            <if test="bomLineId != null">bom_line_id = #{bomLineId},</if>
            <if test="bomLineCode != null">bom_line_code = #{bomLineCode},</if>
            <if test="docNo != null">doc_no = #{docNo},</if>
            <if test="beforeProdAmount != null">before_prod_amount = #{beforeProdAmount},</if>
            <if test="deductionAmount != null">deduction_amount = #{deductionAmount},</if>
            <if test="afterProdAmount != null">after_prod_amount = #{afterProdAmount},</if>
            <if test="orgCode != null">org_code = #{orgCode},</if>
            <if test="batchNumber != null">batch_number = #{batchNumber},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteApsPlateStandardRequireBomOrderDetailById" parameterType="Long">
        delete from aps_plate_standard_require_bom_order_detail where id = #{id}
    </delete>
 
    <delete id="deleteApsPlateStandardRequireBomOrderDetailByIds" parameterType="String">
        delete from aps_plate_standard_require_bom_order_detail where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="deleteLastPatch" parameterType="String">
        update aps_plate_standard_require_bom_order_detail set del_flag = '1' where batch_number = #{batchNumber}
    </update>
</mapper>