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

    <select id="selectSKcKnLskcStoreproductinventoryList" parameterType="pd" resultType="pd">
        select * from s_kc_kn_lskc_storeproductinventory where 1=1
        <if test="storeShortName !=null and storeShortName !='' ">
            and storeShortName = #{storeShortName}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            and productionBatchNumber = #{productionBatchNumber}
        </if>
        <if test="batch !=null and batch !='' ">
            and batch = #{batch}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            and totalStock = #{totalStock}
        </if>
        <if test="medicalInsuranceStock !=null and medicalInsuranceStock !='' ">
            and medicalInsuranceStock = #{medicalInsuranceStock}
        </if>
        <if test="medicalInsuranceLockedStock !=null and medicalInsuranceLockedStock !='' ">
            and medicalInsuranceLockedStock = #{medicalInsuranceLockedStock}
        </if>
        <if test="pharmacyStock !=null and pharmacyStock !='' ">
            and pharmacyStock = #{pharmacyStock}
        </if>
        <if test="pharmacyLockedStock !=null and pharmacyLockedStock !='' ">
            and pharmacyLockedStock = #{pharmacyLockedStock}
        </if>
        <if test="qualifiedPositionCode !=null and qualifiedPositionCode !='' ">
            and qualifiedPositionCode = #{qualifiedPositionCode}
        </if>
        <if test="qualifiedPositionStock !=null and qualifiedPositionStock !='' ">
            and qualifiedPositionStock = #{qualifiedPositionStock}
        </if>
        <if test="qualifiedPositionDispensedStock !=null and qualifiedPositionDispensedStock !='' ">
            and qualifiedPositionDispensedStock = #{qualifiedPositionDispensedStock}
        </if>
        <if test="pendingAcceptancePositionCode !=null and pendingAcceptancePositionCode !='' ">
            and pendingAcceptancePositionCode = #{pendingAcceptancePositionCode}
        </if>
        <if test="pendingAcceptancePositionStock !=null and pendingAcceptancePositionStock !='' ">
            and pendingAcceptancePositionStock = #{pendingAcceptancePositionStock}
        </if>
        <if test="unqualifiedPositionCode !=null and unqualifiedPositionCode !='' ">
            and unqualifiedPositionCode = #{unqualifiedPositionCode}
        </if>
        <if test="unqualifiedPositionStock !=null and unqualifiedPositionStock !='' ">
            and unqualifiedPositionStock = #{unqualifiedPositionStock}
        </if>
        <if test="expirationDate !=null and expirationDate !='' ">
            and expirationDate = #{expirationDate}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="origin !=null and origin !='' ">
            and origin = #{origin}
        </if>
        <if test="entrustedManufacturer !=null and entrustedManufacturer !='' ">
            and entrustedManufacturer = #{entrustedManufacturer}
        </if>
        <if test="supplierName !=null and supplierName !='' ">
            and supplierName = #{supplierName}
        </if>
        <if test="retailPrice !=null and retailPrice !='' ">
            and retailPrice = #{retailPrice}
        </if>
        <if test="memberPrice !=null and memberPrice !='' ">
            and memberPrice = #{memberPrice}
        </if>
        <if test="dispensedPrice !=null and dispensedPrice !='' ">
            and dispensedPrice = #{dispensedPrice}
        </if>
        <if test="costPrice !=null and costPrice !='' ">
            and costPrice = #{costPrice}
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            and costAmount = #{costAmount}
        </if>
        <if test="salesAttribute !=null and salesAttribute !='' ">
            and salesAttribute = #{salesAttribute}
        </if>
    </select>


    <update id="updateSKcKnLskcStoreproductinventory" parameterType="pd" >
        update s_kc_kn_lskc_storeproductinventory
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName = #{storeShortName},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            productionBatchNumber = #{productionBatchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
            batch = #{batch},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            totalStock = #{totalStock},
        </if>
        <if test="medicalInsuranceStock !=null and medicalInsuranceStock !='' ">
            medicalInsuranceStock = #{medicalInsuranceStock},
        </if>
        <if test="medicalInsuranceLockedStock !=null and medicalInsuranceLockedStock !='' ">
            medicalInsuranceLockedStock = #{medicalInsuranceLockedStock},
        </if>
        <if test="pharmacyStock !=null and pharmacyStock !='' ">
            pharmacyStock = #{pharmacyStock},
        </if>
        <if test="pharmacyLockedStock !=null and pharmacyLockedStock !='' ">
            pharmacyLockedStock = #{pharmacyLockedStock},
        </if>
        <if test="qualifiedPositionCode !=null and qualifiedPositionCode !='' ">
            qualifiedPositionCode = #{qualifiedPositionCode},
        </if>
        <if test="qualifiedPositionStock !=null and qualifiedPositionStock !='' ">
            qualifiedPositionStock = #{qualifiedPositionStock},
        </if>
        <if test="qualifiedPositionDispensedStock !=null and qualifiedPositionDispensedStock !='' ">
            qualifiedPositionDispensedStock = #{qualifiedPositionDispensedStock},
        </if>
        <if test="pendingAcceptancePositionCode !=null and pendingAcceptancePositionCode !='' ">
            pendingAcceptancePositionCode = #{pendingAcceptancePositionCode},
        </if>
        <if test="pendingAcceptancePositionStock !=null and pendingAcceptancePositionStock !='' ">
            pendingAcceptancePositionStock = #{pendingAcceptancePositionStock},
        </if>
        <if test="unqualifiedPositionCode !=null and unqualifiedPositionCode !='' ">
            unqualifiedPositionCode = #{unqualifiedPositionCode},
        </if>
        <if test="unqualifiedPositionStock !=null and unqualifiedPositionStock !='' ">
            unqualifiedPositionStock = #{unqualifiedPositionStock},
        </if>
        <if test="expirationDate !=null and expirationDate !='' ">
            expirationDate = #{expirationDate},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="origin !=null and origin !='' ">
            origin = #{origin},
        </if>
        <if test="entrustedManufacturer !=null and entrustedManufacturer !='' ">
            entrustedManufacturer = #{entrustedManufacturer},
        </if>
        <if test="supplierName !=null and supplierName !='' ">
            supplierName = #{supplierName},
        </if>
        <if test="retailPrice !=null and retailPrice !='' ">
            retailPrice = #{retailPrice},
        </if>
        <if test="memberPrice !=null and memberPrice !='' ">
            memberPrice = #{memberPrice},
        </if>
        <if test="dispensedPrice !=null and dispensedPrice !='' ">
            dispensedPrice = #{dispensedPrice},
        </if>
        <if test="costPrice !=null and costPrice !='' ">
            costPrice = #{costPrice},
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            costAmount = #{costAmount},
        </if>
        <if test="salesAttribute !=null and salesAttribute !='' ">
            salesAttribute = #{salesAttribute},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="storeShortName !=null and storeShortName !='' ">
            storeShortName,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            productionBatchNumber,
        </if>
        <if test="batch !=null and batch !='' ">
            batch,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="totalStock !=null and totalStock !='' ">
            totalStock,
        </if>
        <if test="medicalInsuranceStock !=null and medicalInsuranceStock !='' ">
            medicalInsuranceStock,
        </if>
        <if test="medicalInsuranceLockedStock !=null and medicalInsuranceLockedStock !='' ">
            medicalInsuranceLockedStock,
        </if>
        <if test="pharmacyStock !=null and pharmacyStock !='' ">
            pharmacyStock,
        </if>
        <if test="pharmacyLockedStock !=null and pharmacyLockedStock !='' ">
            pharmacyLockedStock,
        </if>
        <if test="qualifiedPositionCode !=null and qualifiedPositionCode !='' ">
            qualifiedPositionCode,
        </if>
        <if test="qualifiedPositionStock !=null and qualifiedPositionStock !='' ">
            qualifiedPositionStock,
        </if>
        <if test="qualifiedPositionDispensedStock !=null and qualifiedPositionDispensedStock !='' ">
            qualifiedPositionDispensedStock,
        </if>
        <if test="pendingAcceptancePositionCode !=null and pendingAcceptancePositionCode !='' ">
            pendingAcceptancePositionCode,
        </if>
        <if test="pendingAcceptancePositionStock !=null and pendingAcceptancePositionStock !='' ">
            pendingAcceptancePositionStock,
        </if>
        <if test="unqualifiedPositionCode !=null and unqualifiedPositionCode !='' ">
            unqualifiedPositionCode,
        </if>
        <if test="unqualifiedPositionStock !=null and unqualifiedPositionStock !='' ">
            unqualifiedPositionStock,
        </if>
        <if test="expirationDate !=null and expirationDate !='' ">
            expirationDate,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="origin !=null and origin !='' ">
            origin,
        </if>
        <if test="entrustedManufacturer !=null and entrustedManufacturer !='' ">
            entrustedManufacturer,
        </if>
        <if test="supplierName !=null and supplierName !='' ">
            supplierName,
        </if>
        <if test="retailPrice !=null and retailPrice !='' ">
            retailPrice,
        </if>
        <if test="memberPrice !=null and memberPrice !='' ">
            memberPrice,
        </if>
        <if test="dispensedPrice !=null and dispensedPrice !='' ">
            dispensedPrice,
        </if>
        <if test="costPrice !=null and costPrice !='' ">
            costPrice,
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            costAmount,
        </if>
        <if test="salesAttribute !=null and salesAttribute !='' ">
            salesAttribute,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="storeShortName !=null and storeShortName !='' ">
             #{storeShortName},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
             #{productionBatchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
             #{batch},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="totalStock !=null and totalStock !='' ">
             #{totalStock},
        </if>
        <if test="medicalInsuranceStock !=null and medicalInsuranceStock !='' ">
             #{medicalInsuranceStock},
        </if>
        <if test="medicalInsuranceLockedStock !=null and medicalInsuranceLockedStock !='' ">
             #{medicalInsuranceLockedStock},
        </if>
        <if test="pharmacyStock !=null and pharmacyStock !='' ">
             #{pharmacyStock},
        </if>
        <if test="pharmacyLockedStock !=null and pharmacyLockedStock !='' ">
             #{pharmacyLockedStock},
        </if>
        <if test="qualifiedPositionCode !=null and qualifiedPositionCode !='' ">
             #{qualifiedPositionCode},
        </if>
        <if test="qualifiedPositionStock !=null and qualifiedPositionStock !='' ">
             #{qualifiedPositionStock},
        </if>
        <if test="qualifiedPositionDispensedStock !=null and qualifiedPositionDispensedStock !='' ">
             #{qualifiedPositionDispensedStock},
        </if>
        <if test="pendingAcceptancePositionCode !=null and pendingAcceptancePositionCode !='' ">
             #{pendingAcceptancePositionCode},
        </if>
        <if test="pendingAcceptancePositionStock !=null and pendingAcceptancePositionStock !='' ">
             #{pendingAcceptancePositionStock},
        </if>
        <if test="unqualifiedPositionCode !=null and unqualifiedPositionCode !='' ">
             #{unqualifiedPositionCode},
        </if>
        <if test="unqualifiedPositionStock !=null and unqualifiedPositionStock !='' ">
             #{unqualifiedPositionStock},
        </if>
        <if test="expirationDate !=null and expirationDate !='' ">
             #{expirationDate},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="origin !=null and origin !='' ">
             #{origin},
        </if>
        <if test="entrustedManufacturer !=null and entrustedManufacturer !='' ">
             #{entrustedManufacturer},
        </if>
        <if test="supplierName !=null and supplierName !='' ">
             #{supplierName},
        </if>
        <if test="retailPrice !=null and retailPrice !='' ">
             #{retailPrice},
        </if>
        <if test="memberPrice !=null and memberPrice !='' ">
             #{memberPrice},
        </if>
        <if test="dispensedPrice !=null and dispensedPrice !='' ">
             #{dispensedPrice},
        </if>
        <if test="costPrice !=null and costPrice !='' ">
             #{costPrice},
        </if>
        <if test="costAmount !=null and costAmount !='' ">
             #{costAmount},
        </if>
        <if test="salesAttribute !=null and salesAttribute !='' ">
             #{salesAttribute},
        </if>
        </trim>

    </insert>

</mapper>
