<?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="SKcBbReturnorderitemsMapper" >
    <!-- 通用查询映射结果 -->

    <select id="selectSKcBbReturnorderitemsList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_returnorderitems where 1=1
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="returnOrderNumber !=null and returnOrderNumber !='' ">
            and returnOrderNumber = #{returnOrderNumber}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            and productionBatchNumber = #{productionBatchNumber}
        </if>
        <if test="batch !=null and batch !='' ">
            and batch = #{batch}
        </if>
        <if test="returnQuantity !=null and returnQuantity !='' ">
            and returnQuantity = #{returnQuantity}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            and costAmount = #{costAmount}
        </if>
        <if test="creationDate !=null and creationDate !='' ">
            and creationDate = #{creationDate}
        </if>
        <if test="returnDate !=null and returnDate !='' ">
            and returnDate = #{returnDate}
        </if>
        <if test="returner !=null and returner !='' ">
            and returner = #{returner}
        </if>
    </select>


    <update id="updateSKcBbReturnorderitems" parameterType="pd" >
        update s_kc_bb_returnorderitems
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="returnOrderNumber !=null and returnOrderNumber !='' ">
            returnOrderNumber = #{returnOrderNumber},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            productionBatchNumber = #{productionBatchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
            batch = #{batch},
        </if>
        <if test="returnQuantity !=null and returnQuantity !='' ">
            returnQuantity = #{returnQuantity},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            costAmount = #{costAmount},
        </if>
        <if test="creationDate !=null and creationDate !='' ">
            creationDate = #{creationDate},
        </if>
        <if test="returnDate !=null and returnDate !='' ">
            returnDate = #{returnDate},
        </if>
        <if test="returner !=null and returner !='' ">
            returner = #{returner},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

    <delete id="SKcBbReturnorderitemsRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_kc_bb_returnorderitems where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

    <insert id="addSKcBbReturnorderitems" parameterType="pd" >

        insert into s_kc_bb_returnorderitems
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">

        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="returnOrderNumber !=null and returnOrderNumber !='' ">
            returnOrderNumber,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            productionBatchNumber,
        </if>
        <if test="batch !=null and batch !='' ">
            batch,
        </if>
        <if test="returnQuantity !=null and returnQuantity !='' ">
            returnQuantity,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            costAmount,
        </if>
        <if test="creationDate !=null and creationDate !='' ">
            creationDate,
        </if>
        <if test="returnDate !=null and returnDate !='' ">
            returnDate,
        </if>
        <if test="returner !=null and returner !='' ">
            returner,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="returnOrderNumber !=null and returnOrderNumber !='' ">
             #{returnOrderNumber},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
             #{productionBatchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
             #{batch},
        </if>
        <if test="returnQuantity !=null and returnQuantity !='' ">
             #{returnQuantity},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="costAmount !=null and costAmount !='' ">
             #{costAmount},
        </if>
        <if test="creationDate !=null and creationDate !='' ">
             #{creationDate},
        </if>
        <if test="returnDate !=null and returnDate !='' ">
             #{returnDate},
        </if>
        <if test="returner !=null and returner !='' ">
             #{returner},
        </if>
        </trim>

    </insert>

</mapper>
