hdy
7 天以前 b9df2fc5c64a1d989991655a9e42e4d1f2ec4075
提交 | 用户 | 时间
f47bd7 1 <?xml version="1.0" encoding="UTF-8" ?>
H 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.billion.main.bs.mapper.BsBomChildInfoMapper">
6     
7     <resultMap type="BsBomChildInfo" id="BsBomChildInfoResult">
8         <result property="id"    column="id"    />
9         <result property="productCode"    column="product_code"    />
10         <result property="productName"    column="product_name"    />
11         <result property="locationCode"    column="location_code"    />
12         <result property="locationName"    column="location_name"    />
13         <result property="materialCode"    column="material_code"    />
14         <result property="materialName"    column="material_name"    />
15         <result property="costQty"    column="cost_qty"    />
16         <result property="unit"    column="unit"    />
17         <result property="remark"    column="remark"    />
18         <result property="bomCode"    column="bom_code"    />
19         <result property="delFlag"    column="del_flag"    />
20     </resultMap>
21
22     <sql id="selectBsBomChildInfoVo">
23         select id, product_code, product_name, location_code, location_name, material_code, material_name, cost_qty, unit, remark, bom_code, del_flag from bs_bom_child_info
24     </sql>
25
26     <select id="selectBsBomChildInfoList" parameterType="BsBomChildInfo" resultMap="BsBomChildInfoResult">
27         <include refid="selectBsBomChildInfoVo"/>
28         <where>  
29             <if test="productCode != null  and productCode != ''"> and product_code = #{productCode}</if>
30             <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
31             <if test="locationCode != null  and locationCode != ''"> and location_code = #{locationCode}</if>
32             <if test="locationName != null  and locationName != ''"> and location_name like concat('%', #{locationName}, '%')</if>
33             <if test="materialCode != null  and materialCode != ''"> and material_code = #{materialCode}</if>
34             <if test="materialName != null  and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
35             <if test="costQty != null "> and cost_qty = #{costQty}</if>
36             <if test="unit != null  and unit != ''"> and unit = #{unit}</if>
37             <if test="bomCode != null  and bomCode != ''"> and bom_code = #{bomCode}</if>
38         </where>
39     </select>
40     
41     <select id="selectBsBomChildInfoById" parameterType="Long" resultMap="BsBomChildInfoResult">
42         <include refid="selectBsBomChildInfoVo"/>
43         where id = #{id}
44     </select>
45
46     <insert id="insertBsBomChildInfo" parameterType="BsBomChildInfo">
47         insert into bs_bom_child_info
48         <trim prefix="(" suffix=")" suffixOverrides=",">
49             <if test="id != null">id,</if>
50             <if test="productCode != null">product_code,</if>
51             <if test="productName != null">product_name,</if>
52             <if test="locationCode != null">location_code,</if>
53             <if test="locationName != null">location_name,</if>
54             <if test="materialCode != null">material_code,</if>
55             <if test="materialName != null">material_name,</if>
56             <if test="costQty != null">cost_qty,</if>
57             <if test="unit != null">unit,</if>
58             <if test="remark != null">remark,</if>
59             <if test="bomCode != null">bom_code,</if>
60             <if test="delFlag != null">del_flag,</if>
61          </trim>
62         <trim prefix="values (" suffix=")" suffixOverrides=",">
63             <if test="id != null">#{id},</if>
64             <if test="productCode != null">#{productCode},</if>
65             <if test="productName != null">#{productName},</if>
66             <if test="locationCode != null">#{locationCode},</if>
67             <if test="locationName != null">#{locationName},</if>
68             <if test="materialCode != null">#{materialCode},</if>
69             <if test="materialName != null">#{materialName},</if>
70             <if test="costQty != null">#{costQty},</if>
71             <if test="unit != null">#{unit},</if>
72             <if test="remark != null">#{remark},</if>
73             <if test="bomCode != null">#{bomCode},</if>
74             <if test="delFlag != null">#{delFlag},</if>
75          </trim>
76     </insert>
77
78     <update id="updateBsBomChildInfo" parameterType="BsBomChildInfo">
79         update bs_bom_child_info
80         <trim prefix="SET" suffixOverrides=",">
81             <if test="productCode != null">product_code = #{productCode},</if>
82             <if test="productName != null">product_name = #{productName},</if>
83             <if test="locationCode != null">location_code = #{locationCode},</if>
84             <if test="locationName != null">location_name = #{locationName},</if>
85             <if test="materialCode != null">material_code = #{materialCode},</if>
86             <if test="materialName != null">material_name = #{materialName},</if>
87             <if test="costQty != null">cost_qty = #{costQty},</if>
88             <if test="unit != null">unit = #{unit},</if>
89             <if test="remark != null">remark = #{remark},</if>
90             <if test="bomCode != null">bom_code = #{bomCode},</if>
91             <if test="delFlag != null">del_flag = #{delFlag},</if>
92         </trim>
93         where id = #{id}
94     </update>
95
96     <delete id="deleteBsBomChildInfoById" parameterType="Long">
97         delete from bs_bom_child_info where id = #{id}
98     </delete>
99
100     <delete id="deleteBsBomChildInfoByIds" parameterType="String">
101         delete from bs_bom_child_info where id in 
102         <foreach item="id" collection="array" open="(" separator="," close=")">
103             #{id}
104         </foreach>
105     </delete>
106 </mapper>