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

    <select id="selectSKcBbRequisitionorderitemsList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_requisitionorderitems where 1=1
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="storeShortName !=null and storeShortName !='' ">
            and storeShortName = #{storeShortName}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="requisitionOrderNumber !=null and requisitionOrderNumber !='' ">
            and requisitionOrderNumber = #{requisitionOrderNumber}
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            and dosageForm = #{dosageForm}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="supplier !=null and supplier !='' ">
            and supplier = #{supplier}
        </if>
        <if test="quantity !=null and quantity !='' ">
            and quantity = #{quantity}
        </if>
        <if test="requisitionDate !=null and requisitionDate !='' ">
            and requisitionDate = #{requisitionDate}
        </if>
        <if test="origin !=null and origin !='' ">
            and origin = #{origin}
        </if>
        <if test="requisitioner !=null and requisitioner !='' ">
            and requisitioner = #{requisitioner}
        </if>
    </select>


    <update id="updateSKcBbRequisitionorderitems" parameterType="pd" >
        update s_kc_bb_requisitionorderitems
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName = #{storeShortName},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="requisitionOrderNumber !=null and requisitionOrderNumber !='' ">
            requisitionOrderNumber = #{requisitionOrderNumber},
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            dosageForm = #{dosageForm},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier = #{supplier},
        </if>
        <if test="quantity !=null and quantity !='' ">
            quantity = #{quantity},
        </if>
        <if test="requisitionDate !=null and requisitionDate !='' ">
            requisitionDate = #{requisitionDate},
        </if>
        <if test="origin !=null and origin !='' ">
            origin = #{origin},
        </if>
        <if test="requisitioner !=null and requisitioner !='' ">
            requisitioner = #{requisitioner},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="requisitionOrderNumber !=null and requisitionOrderNumber !='' ">
            requisitionOrderNumber,
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
            dosageForm,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier,
        </if>
        <if test="quantity !=null and quantity !='' ">
            quantity,
        </if>
        <if test="requisitionDate !=null and requisitionDate !='' ">
            requisitionDate,
        </if>
        <if test="origin !=null and origin !='' ">
            origin,
        </if>
        <if test="requisitioner !=null and requisitioner !='' ">
            requisitioner,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="storeShortName !=null and storeShortName !='' ">
             #{storeShortName},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="requisitionOrderNumber !=null and requisitionOrderNumber !='' ">
             #{requisitionOrderNumber},
        </if>
        <if test="dosageForm !=null and dosageForm !='' ">
             #{dosageForm},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="supplier !=null and supplier !='' ">
             #{supplier},
        </if>
        <if test="quantity !=null and quantity !='' ">
             #{quantity},
        </if>
        <if test="requisitionDate !=null and requisitionDate !='' ">
             #{requisitionDate},
        </if>
        <if test="origin !=null and origin !='' ">
             #{origin},
        </if>
        <if test="requisitioner !=null and requisitioner !='' ">
             #{requisitioner},
        </if>
        </trim>

    </insert>

</mapper>
