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

    <select id="selectSKcBbJxcspmxStoreinventorychangesList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_jxcspmx_storeinventorychanges where 1=1
        <if test="storeCode !=null and storeCode !='' ">
            and storeCode = #{storeCode}
        </if>
        <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="dosageForm !=null and dosageForm !='' ">
            and dosageForm = #{dosageForm}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            and batchNumber = #{batchNumber}
        </if>
        <if test="batch !=null and batch !='' ">
            and batch = #{batch}
        </if>
        <if test="storageArea !=null and storageArea !='' ">
            and storageArea = #{storageArea}
        </if>
        <if test="isDispensed !=null and isDispensed !='' ">
            and isDispensed = #{isDispensed}
        </if>
        <if test="dispenseFactor !=null and dispenseFactor !='' ">
            and dispenseFactor = #{dispenseFactor}
        </if>
        <if test="sourceDocumentNumber !=null and sourceDocumentNumber !='' ">
            and sourceDocumentNumber = #{sourceDocumentNumber}
        </if>
        <if test="documentNumber !=null and documentNumber !='' ">
            and documentNumber = #{documentNumber}
        </if>
        <if test="documentType !=null and documentType !='' ">
            and documentType = #{documentType}
        </if>
        <if test="inventoryChangeQuantity !=null and inventoryChangeQuantity !='' ">
            and inventoryChangeQuantity = #{inventoryChangeQuantity}
        </if>
        <if test="inventoryBeforeChange !=null and inventoryBeforeChange !='' ">
            and inventoryBeforeChange = #{inventoryBeforeChange}
        </if>
        <if test="costUnitPrice !=null and costUnitPrice !='' ">
            and costUnitPrice = #{costUnitPrice}
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            and costAmount = #{costAmount}
        </if>
        <if test="instantRemainingInventory !=null and instantRemainingInventory !='' ">
            and instantRemainingInventory = #{instantRemainingInventory}
        </if>
        <if test="documentTime !=null and documentTime !='' ">
            and documentTime = #{documentTime}
        </if>
        <if test="inventoryChangeTime !=null and inventoryChangeTime !='' ">
            and inventoryChangeTime = #{inventoryChangeTime}
        </if>
    </select>


    <update id="updateSKcBbJxcspmxStoreinventorychanges" parameterType="pd" >
        update s_kc_bb_jxcspmx_storeinventorychanges
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="storeCode !=null and storeCode !='' ">
            storeCode = #{storeCode},
        </if>
        <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="dosageForm !=null and dosageForm !='' ">
            dosageForm = #{dosageForm},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber = #{batchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
            batch = #{batch},
        </if>
        <if test="storageArea !=null and storageArea !='' ">
            storageArea = #{storageArea},
        </if>
        <if test="isDispensed !=null and isDispensed !='' ">
            isDispensed = #{isDispensed},
        </if>
        <if test="dispenseFactor !=null and dispenseFactor !='' ">
            dispenseFactor = #{dispenseFactor},
        </if>
        <if test="sourceDocumentNumber !=null and sourceDocumentNumber !='' ">
            sourceDocumentNumber = #{sourceDocumentNumber},
        </if>
        <if test="documentNumber !=null and documentNumber !='' ">
            documentNumber = #{documentNumber},
        </if>
        <if test="documentType !=null and documentType !='' ">
            documentType = #{documentType},
        </if>
        <if test="inventoryChangeQuantity !=null and inventoryChangeQuantity !='' ">
            inventoryChangeQuantity = #{inventoryChangeQuantity},
        </if>
        <if test="inventoryBeforeChange !=null and inventoryBeforeChange !='' ">
            inventoryBeforeChange = #{inventoryBeforeChange},
        </if>
        <if test="costUnitPrice !=null and costUnitPrice !='' ">
            costUnitPrice = #{costUnitPrice},
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            costAmount = #{costAmount},
        </if>
        <if test="instantRemainingInventory !=null and instantRemainingInventory !='' ">
            instantRemainingInventory = #{instantRemainingInventory},
        </if>
        <if test="documentTime !=null and documentTime !='' ">
            documentTime = #{documentTime},
        </if>
        <if test="inventoryChangeTime !=null and inventoryChangeTime !='' ">
            inventoryChangeTime = #{inventoryChangeTime},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="storeCode !=null and storeCode !='' ">
            storeCode,
        </if>
        <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="dosageForm !=null and dosageForm !='' ">
            dosageForm,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber,
        </if>
        <if test="batch !=null and batch !='' ">
            batch,
        </if>
        <if test="storageArea !=null and storageArea !='' ">
            storageArea,
        </if>
        <if test="isDispensed !=null and isDispensed !='' ">
            isDispensed,
        </if>
        <if test="dispenseFactor !=null and dispenseFactor !='' ">
            dispenseFactor,
        </if>
        <if test="sourceDocumentNumber !=null and sourceDocumentNumber !='' ">
            sourceDocumentNumber,
        </if>
        <if test="documentNumber !=null and documentNumber !='' ">
            documentNumber,
        </if>
        <if test="documentType !=null and documentType !='' ">
            documentType,
        </if>
        <if test="inventoryChangeQuantity !=null and inventoryChangeQuantity !='' ">
            inventoryChangeQuantity,
        </if>
        <if test="inventoryBeforeChange !=null and inventoryBeforeChange !='' ">
            inventoryBeforeChange,
        </if>
        <if test="costUnitPrice !=null and costUnitPrice !='' ">
            costUnitPrice,
        </if>
        <if test="costAmount !=null and costAmount !='' ">
            costAmount,
        </if>
        <if test="instantRemainingInventory !=null and instantRemainingInventory !='' ">
            instantRemainingInventory,
        </if>
        <if test="documentTime !=null and documentTime !='' ">
            documentTime,
        </if>
        <if test="inventoryChangeTime !=null and inventoryChangeTime !='' ">
            inventoryChangeTime,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="storeCode !=null and storeCode !='' ">
             #{storeCode},
        </if>
        <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="dosageForm !=null and dosageForm !='' ">
             #{dosageForm},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
             #{batchNumber},
        </if>
        <if test="batch !=null and batch !='' ">
             #{batch},
        </if>
        <if test="storageArea !=null and storageArea !='' ">
             #{storageArea},
        </if>
        <if test="isDispensed !=null and isDispensed !='' ">
             #{isDispensed},
        </if>
        <if test="dispenseFactor !=null and dispenseFactor !='' ">
             #{dispenseFactor},
        </if>
        <if test="sourceDocumentNumber !=null and sourceDocumentNumber !='' ">
             #{sourceDocumentNumber},
        </if>
        <if test="documentNumber !=null and documentNumber !='' ">
             #{documentNumber},
        </if>
        <if test="documentType !=null and documentType !='' ">
             #{documentType},
        </if>
        <if test="inventoryChangeQuantity !=null and inventoryChangeQuantity !='' ">
             #{inventoryChangeQuantity},
        </if>
        <if test="inventoryBeforeChange !=null and inventoryBeforeChange !='' ">
             #{inventoryBeforeChange},
        </if>
        <if test="costUnitPrice !=null and costUnitPrice !='' ">
             #{costUnitPrice},
        </if>
        <if test="costAmount !=null and costAmount !='' ">
             #{costAmount},
        </if>
        <if test="instantRemainingInventory !=null and instantRemainingInventory !='' ">
             #{instantRemainingInventory},
        </if>
        <if test="documentTime !=null and documentTime !='' ">
             #{documentTime},
        </if>
        <if test="inventoryChangeTime !=null and inventoryChangeTime !='' ">
             #{inventoryChangeTime},
        </if>
        </trim>

    </insert>

</mapper>
