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

    <select id="selectSKcKnKqydStoreorderdetailsList" parameterType="pd" resultType="pd">
        select * from s_kc_kn_kqyd_storeorderdetails where 1=1
        <if test="storeShortName !=null and storeShortName !='' ">
            and storeShortName = #{storeShortName}
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            and storeCode = #{storeCode}
        </if>
        <if test="omsOrderNumber !=null and omsOrderNumber !='' ">
            and omsOrderNumber = #{omsOrderNumber}
        </if>
        <if test="mainOrderNumber !=null and mainOrderNumber !='' ">
            and mainOrderNumber = #{mainOrderNumber}
        </if>
        <if test="orderProcessCode !=null and orderProcessCode !='' ">
            and orderProcessCode = #{orderProcessCode}
        </if>
        <if test="orderTime !=null and orderTime !='' ">
            and orderTime = #{orderTime}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            and batchNumber = #{batchNumber}
        </if>
        <if test="batch !=null and batch !='' ">
            and batch = #{batch}
        </if>
        <if test="quantity !=null and quantity !='' ">
            and quantity = #{quantity}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
    </select>


    <update id="updateSKcKnKqydStoreorderdetails" parameterType="pd" >
        update s_kc_kn_kqyd_storeorderdetails
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName = #{storeShortName},
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            storeCode = #{storeCode},
        </if>
        <if test="omsOrderNumber !=null and omsOrderNumber !='' ">
            omsOrderNumber = #{omsOrderNumber},
        </if>
        <if test="mainOrderNumber !=null and mainOrderNumber !='' ">
            mainOrderNumber = #{mainOrderNumber},
        </if>
        <if test="orderProcessCode !=null and orderProcessCode !='' ">
            orderProcessCode = #{orderProcessCode},
        </if>
        <if test="orderTime !=null and orderTime !='' ">
            orderTime = #{orderTime},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber = #{batchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
            batch = #{batch},
        </if>
        <if test="quantity !=null and quantity !='' ">
            quantity = #{quantity},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName,
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            storeCode,
        </if>
        <if test="omsOrderNumber !=null and omsOrderNumber !='' ">
            omsOrderNumber,
        </if>
        <if test="mainOrderNumber !=null and mainOrderNumber !='' ">
            mainOrderNumber,
        </if>
        <if test="orderProcessCode !=null and orderProcessCode !='' ">
            orderProcessCode,
        </if>
        <if test="orderTime !=null and orderTime !='' ">
            orderTime,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber,
        </if>
        <if test="batch !=null and batch !='' ">
            batch,
        </if>
        <if test="quantity !=null and quantity !='' ">
            quantity,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
             #{storeShortName},
        </if>
        <if test="storeCode !=null and storeCode !='' ">
             #{storeCode},
        </if>
        <if test="omsOrderNumber !=null and omsOrderNumber !='' ">
             #{omsOrderNumber},
        </if>
        <if test="mainOrderNumber !=null and mainOrderNumber !='' ">
             #{mainOrderNumber},
        </if>
        <if test="orderProcessCode !=null and orderProcessCode !='' ">
             #{orderProcessCode},
        </if>
        <if test="orderTime !=null and orderTime !='' ">
             #{orderTime},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
             #{batchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
             #{batch},
        </if>
        <if test="quantity !=null and quantity !='' ">
             #{quantity},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        </trim>

    </insert>

</mapper>
