懒羊羊
2024-01-04 06205a1b49435f32b17b0a9e9673e9fa8ac28fda
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
<?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.jcdm.main.bs.productBomChild.mapper.BsProductBomChildInfoMapper">
    
    <resultMap type="BsProductBomChildInfo" id="BsProductBomChildInfoResult">
        <result property="id"    column="id"    />
        <result property="opCode"    column="op_code"    />
        <result property="opName"    column="op_name"    />
        <result property="materialCode"    column="material_code"    />
        <result property="materialName"    column="material_name"    />
        <result property="costQty"    column="cost_qty"    />
        <result property="unit"    column="unit"    />
        <result property="spareField1"    column="spare_field_1"    />
        <result property="spareField2"    column="spare_field_2"    />
        <result property="spareField3"    column="spare_field_3"    />
        <result property="remark"    column="remark"    />
        <result property="bomCode"    column="bom_code"    />
        <result property="bomInfoId"    column="bom_info_id"    />
    </resultMap>
 
    <sql id="selectBsProductBomChildInfoVo">
        select id, op_code, op_name, material_code, material_name, cost_qty, unit, spare_field_1, spare_field_2, spare_field_3, remark, bom_code, bom_info_id from bs_product_bom_child_info
    </sql>
 
    <select id="selectBsProductBomChildInfoList" parameterType="BsProductBomChildInfo" resultMap="BsProductBomChildInfoResult">
        <include refid="selectBsProductBomChildInfoVo"/>
        <where>  
            <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
            <if test="materialName != null  and materialName != ''"> and material_name = #{materialName}</if>
            <if test="bomCode != null  and bomCode != ''"> and bom_code = #{bomCode}</if>
            <if test="opCode != null  and opCode != ''"> and op_code = #{opCode}</if>
            <if test="opName != null  and opName != ''"> and op_name = #{opName}</if>
 
        </where>
    </select>
    
    <select id="selectBsProductBomChildInfoById" parameterType="Long" resultMap="BsProductBomChildInfoResult">
        <include refid="selectBsProductBomChildInfoVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBsProductBomChildInfo" parameterType="BsProductBomChildInfo">
        insert into bs_product_bom_child_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="opCode != null">op_code,</if>
            <if test="opName != null">op_name,</if>
            <if test="materialCode != null">material_code,</if>
            <if test="materialName != null">material_name,</if>
            <if test="costQty != null and costQty != ''">cost_qty,</if>
            <if test="unit != null and unit != ''">unit,</if>
            <if test="spareField1 != null">spare_field_1,</if>
            <if test="spareField2 != null">spare_field_2,</if>
            <if test="spareField3 != null">spare_field_3,</if>
            <if test="remark != null">remark,</if>
            <if test="bomCode != null and bomCode != ''">bom_code,</if>
            <if test="bomInfoId != null">bom_info_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="opCode != null">#{opCode},</if>
            <if test="opName != null">#{opName},</if>
            <if test="materialCode != null">#{materialCode},</if>
            <if test="materialName != null">#{materialName},</if>
            <if test="costQty != null and costQty != ''">#{costQty},</if>
            <if test="unit != null and unit != ''">#{unit},</if>
            <if test="spareField1 != null">#{spareField1},</if>
            <if test="spareField2 != null">#{spareField2},</if>
            <if test="spareField3 != null">#{spareField3},</if>
            <if test="remark != null">#{remark},</if>
            <if test="bomCode != null and bomCode != ''">#{bomCode},</if>
            <if test="bomInfoId != null">#{bomInfoId},</if>
         </trim>
    </insert>
 
    <update id="updateBsProductBomChildInfo" parameterType="BsProductBomChildInfo">
        update bs_product_bom_child_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="opCode != null">op_code = #{opCode},</if>
            <if test="opName != null">op_name = #{opName},</if>
            <if test="materialCode != null">material_code = #{materialCode},</if>
            <if test="materialName != null">material_name = #{materialName},</if>
            <if test="costQty != null and costQty != ''">cost_qty = #{costQty},</if>
            <if test="unit != null and unit != ''">unit = #{unit},</if>
            <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
            <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
            <if test="spareField3 != null">spare_field_3 = #{spareField3},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="bomCode != null and bomCode != ''">bom_code = #{bomCode},</if>
            <if test="bomInfoId != null">bom_info_id = #{bomInfoId},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteBsProductBomChildInfoById" parameterType="Long">
        delete from bs_product_bom_child_info where id = #{id}
    </delete>
 
    <delete id="deleteBsProductBomChildInfoByIds" parameterType="String">
        delete from bs_product_bom_child_info where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>