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

    <select id="selectSKcKnPdrwInventorytaskList" parameterType="pd" resultType="pd">
        select * from s_kc_kn_pdrw_inventorytask where 1=1
        <if test="taskCode !=null and taskCode !='' ">
            and taskCode = #{taskCode}
        </if>
        <if test="haitianTaskId !=null and haitianTaskId !='' ">
            and haitianTaskId = #{haitianTaskId}
        </if>
        <if test="inventoryType !=null and inventoryType !='' ">
            and inventoryType = #{inventoryType}
        </if>
        <if test="inventoryMode !=null and inventoryMode !='' ">
            and inventoryMode = #{inventoryMode}
        </if>
        <if test="storeName !=null and storeName !='' ">
            and storeName = #{storeName}
        </if>
        <if test="storeAttribute !=null and storeAttribute !='' ">
            and storeAttribute = #{storeAttribute}
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            and storeCode = #{storeCode}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
        <if test="completionTime !=null and completionTime !='' ">
            and completionTime = #{completionTime}
        </if>
        <if test="inventoriedProducts !=null and inventoriedProducts !='' ">
            and inventoriedProducts = #{inventoriedProducts}
        </if>
        <if test="discrepancyProducts !=null and discrepancyProducts !='' ">
            and discrepancyProducts = #{discrepancyProducts}
        </if>
        <if test="inventoriedVarietyBatch !=null and inventoriedVarietyBatch !='' ">
            and inventoriedVarietyBatch = #{inventoriedVarietyBatch}
        </if>
        <if test="discrepancyVarietyBatch !=null and discrepancyVarietyBatch !='' ">
            and discrepancyVarietyBatch = #{discrepancyVarietyBatch}
        </if>
        <if test="createTime !=null and createTime !='' ">
            and createTime = #{createTime}
        </if>
    </select>


    <update id="updateSKcKnPdrwInventorytask" parameterType="pd" >
        update s_kc_kn_pdrw_inventorytask
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="taskCode !=null and taskCode !='' ">
            taskCode = #{taskCode},
        </if>
        <if test="haitianTaskId !=null and haitianTaskId !='' ">
            haitianTaskId = #{haitianTaskId},
        </if>
        <if test="inventoryType !=null and inventoryType !='' ">
            inventoryType = #{inventoryType},
        </if>
        <if test="inventoryMode !=null and inventoryMode !='' ">
            inventoryMode = #{inventoryMode},
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName = #{storeName},
        </if>
        <if test="storeAttribute !=null and storeAttribute !='' ">
            storeAttribute = #{storeAttribute},
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            storeCode = #{storeCode},
        </if>
        <if test="status !=null and status !='' ">
            status = #{status},
        </if>
        <if test="completionTime !=null and completionTime !='' ">
            completionTime = #{completionTime},
        </if>
        <if test="inventoriedProducts !=null and inventoriedProducts !='' ">
            inventoriedProducts = #{inventoriedProducts},
        </if>
        <if test="discrepancyProducts !=null and discrepancyProducts !='' ">
            discrepancyProducts = #{discrepancyProducts},
        </if>
        <if test="inventoriedVarietyBatch !=null and inventoriedVarietyBatch !='' ">
            inventoriedVarietyBatch = #{inventoriedVarietyBatch},
        </if>
        <if test="discrepancyVarietyBatch !=null and discrepancyVarietyBatch !='' ">
            discrepancyVarietyBatch = #{discrepancyVarietyBatch},
        </if>
        <if test="createTime !=null and createTime !='' ">
            createTime = #{createTime},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="taskCode !=null and taskCode !='' ">
            taskCode,
        </if>
        <if test="haitianTaskId !=null and haitianTaskId !='' ">
            haitianTaskId,
        </if>
        <if test="inventoryType !=null and inventoryType !='' ">
            inventoryType,
        </if>
        <if test="inventoryMode !=null and inventoryMode !='' ">
            inventoryMode,
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName,
        </if>
        <if test="storeAttribute !=null and storeAttribute !='' ">
            storeAttribute,
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            storeCode,
        </if>
        <if test="status !=null and status !='' ">
            status,
        </if>
        <if test="completionTime !=null and completionTime !='' ">
            completionTime,
        </if>
        <if test="inventoriedProducts !=null and inventoriedProducts !='' ">
            inventoriedProducts,
        </if>
        <if test="discrepancyProducts !=null and discrepancyProducts !='' ">
            discrepancyProducts,
        </if>
        <if test="inventoriedVarietyBatch !=null and inventoriedVarietyBatch !='' ">
            inventoriedVarietyBatch,
        </if>
        <if test="discrepancyVarietyBatch !=null and discrepancyVarietyBatch !='' ">
            discrepancyVarietyBatch,
        </if>
        <if test="createTime !=null and createTime !='' ">
            createTime,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="taskCode !=null and taskCode !='' ">
             #{taskCode},
        </if>
        <if test="haitianTaskId !=null and haitianTaskId !='' ">
             #{haitianTaskId},
        </if>
        <if test="inventoryType !=null and inventoryType !='' ">
             #{inventoryType},
        </if>
        <if test="inventoryMode !=null and inventoryMode !='' ">
             #{inventoryMode},
        </if>
        <if test="storeName !=null and storeName !='' ">
             #{storeName},
        </if>
        <if test="storeAttribute !=null and storeAttribute !='' ">
             #{storeAttribute},
        </if>
        <if test="storeCode !=null and storeCode !='' ">
             #{storeCode},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        <if test="completionTime !=null and completionTime !='' ">
             #{completionTime},
        </if>
        <if test="inventoriedProducts !=null and inventoriedProducts !='' ">
             #{inventoriedProducts},
        </if>
        <if test="discrepancyProducts !=null and discrepancyProducts !='' ">
             #{discrepancyProducts},
        </if>
        <if test="inventoriedVarietyBatch !=null and inventoriedVarietyBatch !='' ">
             #{inventoriedVarietyBatch},
        </if>
        <if test="discrepancyVarietyBatch !=null and discrepancyVarietyBatch !='' ">
             #{discrepancyVarietyBatch},
        </if>
        <if test="createTime !=null and createTime !='' ">
             #{createTime},
        </if>
        </trim>

    </insert>

</mapper>
