懒羊羊
2024-01-31 e57a8990ae56f657a59c435a0613c5f7a8728003
提交 | 用户 | 时间
e57a89 1 <?xml version="1.0" encoding="UTF-8" ?>
2 <!DOCTYPE mapper
3 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5 <mapper namespace="com.jcdm.main.bs.productBomChild.mapper.BsProductBomChildInfoMapper">
6     
7     <resultMap type="BsProductBomChildInfo" id="BsProductBomChildInfoResult">
8         <result property="id"    column="id"    />
9         <result property="opCode"    column="op_code"    />
10         <result property="opName"    column="op_name"    />
11         <result property="materialCode"    column="material_code"    />
12         <result property="materialName"    column="material_name"    />
13         <result property="costQty"    column="cost_qty"    />
14         <result property="unit"    column="unit"    />
15         <result property="spareField1"    column="spare_field_1"    />
16         <result property="spareField2"    column="spare_field_2"    />
17         <result property="spareField3"    column="spare_field_3"    />
18         <result property="remark"    column="remark"    />
19         <result property="bomCode"    column="bom_code"    />
20         <result property="bomInfoId"    column="bom_info_id"    />
21     </resultMap>
22
23     <sql id="selectBsProductBomChildInfoVo">
24         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
25     </sql>
26
27     <select id="selectBsProductBomChildInfoList" parameterType="BsProductBomChildInfo" resultMap="BsProductBomChildInfoResult">
28         <include refid="selectBsProductBomChildInfoVo"/>
29         <where>  
30             <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
31             <if test="materialName != null  and materialName != ''"> and material_name = #{materialName}</if>
32             <if test="bomCode != null  and bomCode != ''"> and bom_code = #{bomCode}</if>
33             <if test="opCode != null  and opCode != ''"> and op_code = #{opCode}</if>
34             <if test="opName != null  and opName != ''"> and op_name = #{opName}</if>
35
36         </where>
37     </select>
38     
39     <select id="selectBsProductBomChildInfoById" parameterType="Long" resultMap="BsProductBomChildInfoResult">
40         <include refid="selectBsProductBomChildInfoVo"/>
41         where id = #{id}
42     </select>
43         
44     <insert id="insertBsProductBomChildInfo" parameterType="BsProductBomChildInfo">
45         insert into bs_product_bom_child_info
46         <trim prefix="(" suffix=")" suffixOverrides=",">
47             <if test="id != null">id,</if>
48             <if test="opCode != null">op_code,</if>
49             <if test="opName != null">op_name,</if>
50             <if test="materialCode != null">material_code,</if>
51             <if test="materialName != null">material_name,</if>
52             <if test="costQty != null and costQty != ''">cost_qty,</if>
53             <if test="unit != null and unit != ''">unit,</if>
54             <if test="spareField1 != null">spare_field_1,</if>
55             <if test="spareField2 != null">spare_field_2,</if>
56             <if test="spareField3 != null">spare_field_3,</if>
57             <if test="remark != null">remark,</if>
58             <if test="bomCode != null and bomCode != ''">bom_code,</if>
59             <if test="bomInfoId != null">bom_info_id,</if>
60          </trim>
61         <trim prefix="values (" suffix=")" suffixOverrides=",">
62             <if test="id != null">#{id},</if>
63             <if test="opCode != null">#{opCode},</if>
64             <if test="opName != null">#{opName},</if>
65             <if test="materialCode != null">#{materialCode},</if>
66             <if test="materialName != null">#{materialName},</if>
67             <if test="costQty != null and costQty != ''">#{costQty},</if>
68             <if test="unit != null and unit != ''">#{unit},</if>
69             <if test="spareField1 != null">#{spareField1},</if>
70             <if test="spareField2 != null">#{spareField2},</if>
71             <if test="spareField3 != null">#{spareField3},</if>
72             <if test="remark != null">#{remark},</if>
73             <if test="bomCode != null and bomCode != ''">#{bomCode},</if>
74             <if test="bomInfoId != null">#{bomInfoId},</if>
75          </trim>
76     </insert>
77
78     <update id="updateBsProductBomChildInfo" parameterType="BsProductBomChildInfo">
79         update bs_product_bom_child_info
80         <trim prefix="SET" suffixOverrides=",">
81             <if test="opCode != null">op_code = #{opCode},</if>
82             <if test="opName != null">op_name = #{opName},</if>
83             <if test="materialCode != null">material_code = #{materialCode},</if>
84             <if test="materialName != null">material_name = #{materialName},</if>
85             <if test="costQty != null and costQty != ''">cost_qty = #{costQty},</if>
86             <if test="unit != null and unit != ''">unit = #{unit},</if>
87             <if test="spareField1 != null">spare_field_1 = #{spareField1},</if>
88             <if test="spareField2 != null">spare_field_2 = #{spareField2},</if>
89             <if test="spareField3 != null">spare_field_3 = #{spareField3},</if>
90             <if test="remark != null">remark = #{remark},</if>
91             <if test="bomCode != null and bomCode != ''">bom_code = #{bomCode},</if>
92             <if test="bomInfoId != null">bom_info_id = #{bomInfoId},</if>
93         </trim>
94         where id = #{id}
95     </update>
96
97     <delete id="deleteBsProductBomChildInfoById" parameterType="Long">
98         delete from bs_product_bom_child_info where id = #{id}
99     </delete>
100
101     <delete id="deleteBsProductBomChildInfoByIds" parameterType="String">
102         delete from bs_product_bom_child_info where id in 
103         <foreach item="id" collection="array" open="(" separator="," close=")">
104             #{id}
105         </foreach>
106     </delete>
107 </mapper>