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

    <select id="selectSKcKnZxyjStorestaleproductsList" parameterType="pd" resultType="pd">
        select * from s_kc_kn_zxyj_storestaleproducts where 1=1
        <if test="storeName !=null and storeName !='' ">
            and storeName = #{storeName}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="lastSaleDate !=null and lastSaleDate !='' ">
            and lastSaleDate = #{lastSaleDate}
        </if>
        <if test="staleDays !=null and staleDays !='' ">
            and staleDays = #{staleDays}
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            and totalStock = #{totalStock}
        </if>
    </select>


    <update id="updateSKcKnZxyjStorestaleproducts" parameterType="pd" >
        update s_kc_kn_zxyj_storestaleproducts
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="storeName !=null and storeName !='' ">
            storeName = #{storeName},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="lastSaleDate !=null and lastSaleDate !='' ">
            lastSaleDate = #{lastSaleDate},
        </if>
        <if test="staleDays !=null and staleDays !='' ">
            staleDays = #{staleDays},
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            totalStock = #{totalStock},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="storeName !=null and storeName !='' ">
            storeName,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="lastSaleDate !=null and lastSaleDate !='' ">
            lastSaleDate,
        </if>
        <if test="staleDays !=null and staleDays !='' ">
            staleDays,
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            totalStock,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="storeName !=null and storeName !='' ">
             #{storeName},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="lastSaleDate !=null and lastSaleDate !='' ">
             #{lastSaleDate},
        </if>
        <if test="staleDays !=null and staleDays !='' ">
             #{staleDays},
        </if>
        <if test="totalStock !=null and totalStock !='' ">
             #{totalStock},
        </if>
        </trim>

    </insert>

</mapper>
