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

    <select id="selectSKcKnStoreinventorystatsList" parameterType="pd" resultType="pd">
        select * from s_kc_kn_storeinventorystats where 1=1
        <if test="region !=null and region !='' ">
            and region = #{region}
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            and storeCode = #{storeCode}
        </if>
        <if test="storeName !=null and storeName !='' ">
            and storeName = #{storeName}
        </if>
        <if test="storeAttribute !=null and storeAttribute !='' ">
            and storeAttribute = #{storeAttribute}
        </if>
        <if test="generatedTasks !=null and generatedTasks !='' ">
            and generatedTasks = #{generatedTasks}
        </if>
        <if test="batchTasks !=null and batchTasks !='' ">
            and batchTasks = #{batchTasks}
        </if>
        <if test="totalTasks !=null and totalTasks !='' ">
            and totalTasks = #{totalTasks}
        </if>
        <if test="completedTasks !=null and completedTasks !='' ">
            and completedTasks = #{completedTasks}
        </if>
        <if test="completedBatchTasks !=null and completedBatchTasks !='' ">
            and completedBatchTasks = #{completedBatchTasks}
        </if>
        <if test="completedTotalTasks !=null and completedTotalTasks !='' ">
            and completedTotalTasks = #{completedTotalTasks}
        </if>
    </select>


    <update id="updateSKcKnStoreinventorystats" parameterType="pd" >
        update s_kc_kn_storeinventorystats
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="region !=null and region !='' ">
            region = #{region},
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            storeCode = #{storeCode},
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName = #{storeName},
        </if>
        <if test="storeAttribute !=null and storeAttribute !='' ">
            storeAttribute = #{storeAttribute},
        </if>
        <if test="generatedTasks !=null and generatedTasks !='' ">
            generatedTasks = #{generatedTasks},
        </if>
        <if test="batchTasks !=null and batchTasks !='' ">
            batchTasks = #{batchTasks},
        </if>
        <if test="totalTasks !=null and totalTasks !='' ">
            totalTasks = #{totalTasks},
        </if>
        <if test="completedTasks !=null and completedTasks !='' ">
            completedTasks = #{completedTasks},
        </if>
        <if test="completedBatchTasks !=null and completedBatchTasks !='' ">
            completedBatchTasks = #{completedBatchTasks},
        </if>
        <if test="completedTotalTasks !=null and completedTotalTasks !='' ">
            completedTotalTasks = #{completedTotalTasks},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="region !=null and region !='' ">
            region,
        </if>
        <if test="storeCode !=null and storeCode !='' ">
            storeCode,
        </if>
        <if test="storeName !=null and storeName !='' ">
            storeName,
        </if>
        <if test="storeAttribute !=null and storeAttribute !='' ">
            storeAttribute,
        </if>
        <if test="generatedTasks !=null and generatedTasks !='' ">
            generatedTasks,
        </if>
        <if test="batchTasks !=null and batchTasks !='' ">
            batchTasks,
        </if>
        <if test="totalTasks !=null and totalTasks !='' ">
            totalTasks,
        </if>
        <if test="completedTasks !=null and completedTasks !='' ">
            completedTasks,
        </if>
        <if test="completedBatchTasks !=null and completedBatchTasks !='' ">
            completedBatchTasks,
        </if>
        <if test="completedTotalTasks !=null and completedTotalTasks !='' ">
            completedTotalTasks,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="region !=null and region !='' ">
             #{region},
        </if>
        <if test="storeCode !=null and storeCode !='' ">
             #{storeCode},
        </if>
        <if test="storeName !=null and storeName !='' ">
             #{storeName},
        </if>
        <if test="storeAttribute !=null and storeAttribute !='' ">
             #{storeAttribute},
        </if>
        <if test="generatedTasks !=null and generatedTasks !='' ">
             #{generatedTasks},
        </if>
        <if test="batchTasks !=null and batchTasks !='' ">
             #{batchTasks},
        </if>
        <if test="totalTasks !=null and totalTasks !='' ">
             #{totalTasks},
        </if>
        <if test="completedTasks !=null and completedTasks !='' ">
             #{completedTasks},
        </if>
        <if test="completedBatchTasks !=null and completedBatchTasks !='' ">
             #{completedBatchTasks},
        </if>
        <if test="completedTotalTasks !=null and completedTotalTasks !='' ">
             #{completedTotalTasks},
        </if>
        </trim>

    </insert>

</mapper>
