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

    <select id="selectSXsglMdlsSalesinventoryinfoList" parameterType="pd" resultType="pd">
        select * from s_xsgl_mdls_salesinventoryinfo where 1=1
        <if test="chainId !=null and chainId !='' ">
            and chainId = #{chainId}
        </if>
        <if test="organizationId !=null and organizationId !='' ">
            and organizationId = #{organizationId}
        </if>
        <if test="organizationName !=null and organizationName !='' ">
            and organizationName = #{organizationName}
        </if>
        <if test="storeId !=null and storeId !='' ">
            and storeId = #{storeId}
        </if>
        <if test="date !=null and date !='' ">
            and date = #{date}
        </if>
        <if test="actualAmount !=null and actualAmount !='' ">
            and actualAmount = #{actualAmount}
        </if>
        <if test="salesBudget !=null and salesBudget !='' ">
            and salesBudget = #{salesBudget}
        </if>
        <if test="grossProfitBudget !=null and grossProfitBudget !='' ">
            and grossProfitBudget = #{grossProfitBudget}
        </if>
        <if test="grossProfitAmount !=null and grossProfitAmount !='' ">
            and grossProfitAmount = #{grossProfitAmount}
        </if>
        <if test="grossProfitMargin !=null and grossProfitMargin !='' ">
            and grossProfitMargin = #{grossProfitMargin}
        </if>
        <if test="nearExpiryQuantity !=null and nearExpiryQuantity !='' ">
            and nearExpiryQuantity = #{nearExpiryQuantity}
        </if>
        <if test="threeMonthInactiveQuantity !=null and threeMonthInactiveQuantity !='' ">
            and threeMonthInactiveQuantity = #{threeMonthInactiveQuantity}
        </if>
        <if test="customerVisits !=null and customerVisits !='' ">
            and customerVisits = #{customerVisits}
        </if>
        <if test="memberSalesAmount !=null and memberSalesAmount !='' ">
            and memberSalesAmount = #{memberSalesAmount}
        </if>
        <if test="memberSalesGrossProfit !=null and memberSalesGrossProfit !='' ">
            and memberSalesGrossProfit = #{memberSalesGrossProfit}
        </if>
        <if test="memberCustomerCount !=null and memberCustomerCount !='' ">
            and memberCustomerCount = #{memberCustomerCount}
        </if>
        <if test="healthSupplements !=null and healthSupplements !='' ">
            and healthSupplements = #{healthSupplements}
        </if>
        <if test="otc !=null and otc !='' ">
            and otc = #{otc}
        </if>
        <if test="others !=null and others !='' ">
            and others = #{others}
        </if>
        <if test="prescription !=null and prescription !='' ">
            and prescription = #{prescription}
        </if>
        <if test="chineseMedicineAndGinseng !=null and chineseMedicineAndGinseng !='' ">
            and chineseMedicineAndGinseng = #{chineseMedicineAndGinseng}
        </if>
        <if test="chineseAndWesternMedicines !=null and chineseAndWesternMedicines !='' ">
            and chineseAndWesternMedicines = #{chineseAndWesternMedicines}
        </if>
        <if test="convenienceFood !=null and convenienceFood !='' ">
            and convenienceFood = #{convenienceFood}
        </if>
        <if test="dailyChemicals !=null and dailyChemicals !='' ">
            and dailyChemicals = #{dailyChemicals}
        </if>
        <if test="servicesAndNonSellableItems !=null and servicesAndNonSellableItems !='' ">
            and servicesAndNonSellableItems = #{servicesAndNonSellableItems}
        </if>
        <if test="maternityProducts !=null and maternityProducts !='' ">
            and maternityProducts = #{maternityProducts}
        </if>
        <if test="disinfectionSupplies !=null and disinfectionSupplies !='' ">
            and disinfectionSupplies = #{disinfectionSupplies}
        </if>
        <if test="categoryA1 !=null and categoryA1 !='' ">
            and categoryA1 = #{categoryA1}
        </if>
        <if test="categoryA2 !=null and categoryA2 !='' ">
            and categoryA2 = #{categoryA2}
        </if>
        <if test="categoryA3 !=null and categoryA3 !='' ">
            and categoryA3 = #{categoryA3}
        </if>
        <if test="categoryA4 !=null and categoryA4 !='' ">
            and categoryA4 = #{categoryA4}
        </if>
        <if test="categoryAA !=null and categoryAA !='' ">
            and categoryAA = #{categoryAA}
        </if>
        <if test="otherMarketingLevels !=null and otherMarketingLevels !='' ">
            and otherMarketingLevels = #{otherMarketingLevels}
        </if>
        <if test="lowProfit !=null and lowProfit !='' ">
            and lowProfit = #{lowProfit}
        </if>
        <if test="marginalProfit !=null and marginalProfit !='' ">
            and marginalProfit = #{marginalProfit}
        </if>
        <if test="negativeProfit !=null and negativeProfit !='' ">
            and negativeProfit = #{negativeProfit}
        </if>
        <if test="elimination !=null and elimination !='' ">
            and elimination = #{elimination}
        </if>
        <if test="oneMonthInactiveStock !=null and oneMonthInactiveStock !='' ">
            and oneMonthInactiveStock = #{oneMonthInactiveStock}
        </if>
        <if test="threeMonthInactiveStock !=null and threeMonthInactiveStock !='' ">
            and threeMonthInactiveStock = #{threeMonthInactiveStock}
        </if>
        <if test="nearExpiryRemainingStock !=null and nearExpiryRemainingStock !='' ">
            and nearExpiryRemainingStock = #{nearExpiryRemainingStock}
        </if>
        <if test="environmentIdentifier !=null and environmentIdentifier !='' ">
            and environmentIdentifier = #{environmentIdentifier}
        </if>
        <if test="recordStatus !=null and recordStatus !='' ">
            and recordStatus = #{recordStatus}
        </if>
        <if test="creatorId !=null and creatorId !='' ">
            and creatorId = #{creatorId}
        </if>
        <if test="createTime !=null and createTime !='' ">
            and createTime = #{createTime}
        </if>
        <if test="updaterId !=null and updaterId !='' ">
            and updaterId = #{updaterId}
        </if>
        <if test="updateTime !=null and updateTime !='' ">
            and updateTime = #{updateTime}
        </if>
    </select>


    <update id="updateSXsglMdlsSalesinventoryinfo" parameterType="pd" >
        update s_xsgl_mdls_salesinventoryinfo
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="chainId !=null and chainId !='' ">
            chainId = #{chainId},
        </if>
        <if test="organizationId !=null and organizationId !='' ">
            organizationId = #{organizationId},
        </if>
        <if test="organizationName !=null and organizationName !='' ">
            organizationName = #{organizationName},
        </if>
        <if test="storeId !=null and storeId !='' ">
            storeId = #{storeId},
        </if>
        <if test="date !=null and date !='' ">
            date = #{date},
        </if>
        <if test="actualAmount !=null and actualAmount !='' ">
            actualAmount = #{actualAmount},
        </if>
        <if test="salesBudget !=null and salesBudget !='' ">
            salesBudget = #{salesBudget},
        </if>
        <if test="grossProfitBudget !=null and grossProfitBudget !='' ">
            grossProfitBudget = #{grossProfitBudget},
        </if>
        <if test="grossProfitAmount !=null and grossProfitAmount !='' ">
            grossProfitAmount = #{grossProfitAmount},
        </if>
        <if test="grossProfitMargin !=null and grossProfitMargin !='' ">
            grossProfitMargin = #{grossProfitMargin},
        </if>
        <if test="nearExpiryQuantity !=null and nearExpiryQuantity !='' ">
            nearExpiryQuantity = #{nearExpiryQuantity},
        </if>
        <if test="threeMonthInactiveQuantity !=null and threeMonthInactiveQuantity !='' ">
            threeMonthInactiveQuantity = #{threeMonthInactiveQuantity},
        </if>
        <if test="customerVisits !=null and customerVisits !='' ">
            customerVisits = #{customerVisits},
        </if>
        <if test="memberSalesAmount !=null and memberSalesAmount !='' ">
            memberSalesAmount = #{memberSalesAmount},
        </if>
        <if test="memberSalesGrossProfit !=null and memberSalesGrossProfit !='' ">
            memberSalesGrossProfit = #{memberSalesGrossProfit},
        </if>
        <if test="memberCustomerCount !=null and memberCustomerCount !='' ">
            memberCustomerCount = #{memberCustomerCount},
        </if>
        <if test="healthSupplements !=null and healthSupplements !='' ">
            healthSupplements = #{healthSupplements},
        </if>
        <if test="otc !=null and otc !='' ">
            otc = #{otc},
        </if>
        <if test="others !=null and others !='' ">
            others = #{others},
        </if>
        <if test="prescription !=null and prescription !='' ">
            prescription = #{prescription},
        </if>
        <if test="chineseMedicineAndGinseng !=null and chineseMedicineAndGinseng !='' ">
            chineseMedicineAndGinseng = #{chineseMedicineAndGinseng},
        </if>
        <if test="chineseAndWesternMedicines !=null and chineseAndWesternMedicines !='' ">
            chineseAndWesternMedicines = #{chineseAndWesternMedicines},
        </if>
        <if test="convenienceFood !=null and convenienceFood !='' ">
            convenienceFood = #{convenienceFood},
        </if>
        <if test="dailyChemicals !=null and dailyChemicals !='' ">
            dailyChemicals = #{dailyChemicals},
        </if>
        <if test="servicesAndNonSellableItems !=null and servicesAndNonSellableItems !='' ">
            servicesAndNonSellableItems = #{servicesAndNonSellableItems},
        </if>
        <if test="maternityProducts !=null and maternityProducts !='' ">
            maternityProducts = #{maternityProducts},
        </if>
        <if test="disinfectionSupplies !=null and disinfectionSupplies !='' ">
            disinfectionSupplies = #{disinfectionSupplies},
        </if>
        <if test="categoryA1 !=null and categoryA1 !='' ">
            categoryA1 = #{categoryA1},
        </if>
        <if test="categoryA2 !=null and categoryA2 !='' ">
            categoryA2 = #{categoryA2},
        </if>
        <if test="categoryA3 !=null and categoryA3 !='' ">
            categoryA3 = #{categoryA3},
        </if>
        <if test="categoryA4 !=null and categoryA4 !='' ">
            categoryA4 = #{categoryA4},
        </if>
        <if test="categoryAA !=null and categoryAA !='' ">
            categoryAA = #{categoryAA},
        </if>
        <if test="otherMarketingLevels !=null and otherMarketingLevels !='' ">
            otherMarketingLevels = #{otherMarketingLevels},
        </if>
        <if test="lowProfit !=null and lowProfit !='' ">
            lowProfit = #{lowProfit},
        </if>
        <if test="marginalProfit !=null and marginalProfit !='' ">
            marginalProfit = #{marginalProfit},
        </if>
        <if test="negativeProfit !=null and negativeProfit !='' ">
            negativeProfit = #{negativeProfit},
        </if>
        <if test="elimination !=null and elimination !='' ">
            elimination = #{elimination},
        </if>
        <if test="oneMonthInactiveStock !=null and oneMonthInactiveStock !='' ">
            oneMonthInactiveStock = #{oneMonthInactiveStock},
        </if>
        <if test="threeMonthInactiveStock !=null and threeMonthInactiveStock !='' ">
            threeMonthInactiveStock = #{threeMonthInactiveStock},
        </if>
        <if test="nearExpiryRemainingStock !=null and nearExpiryRemainingStock !='' ">
            nearExpiryRemainingStock = #{nearExpiryRemainingStock},
        </if>
        <if test="environmentIdentifier !=null and environmentIdentifier !='' ">
            environmentIdentifier = #{environmentIdentifier},
        </if>
        <if test="recordStatus !=null and recordStatus !='' ">
            recordStatus = #{recordStatus},
        </if>
        <if test="creatorId !=null and creatorId !='' ">
            creatorId = #{creatorId},
        </if>
        <if test="createTime !=null and createTime !='' ">
            createTime = #{createTime},
        </if>
        <if test="updaterId !=null and updaterId !='' ">
            updaterId = #{updaterId},
        </if>
        <if test="updateTime !=null and updateTime !='' ">
            updateTime = #{updateTime},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="chainId !=null and chainId !='' ">
            chainId,
        </if>
        <if test="organizationId !=null and organizationId !='' ">
            organizationId,
        </if>
        <if test="organizationName !=null and organizationName !='' ">
            organizationName,
        </if>
        <if test="storeId !=null and storeId !='' ">
            storeId,
        </if>
        <if test="date !=null and date !='' ">
            date,
        </if>
        <if test="actualAmount !=null and actualAmount !='' ">
            actualAmount,
        </if>
        <if test="salesBudget !=null and salesBudget !='' ">
            salesBudget,
        </if>
        <if test="grossProfitBudget !=null and grossProfitBudget !='' ">
            grossProfitBudget,
        </if>
        <if test="grossProfitAmount !=null and grossProfitAmount !='' ">
            grossProfitAmount,
        </if>
        <if test="grossProfitMargin !=null and grossProfitMargin !='' ">
            grossProfitMargin,
        </if>
        <if test="nearExpiryQuantity !=null and nearExpiryQuantity !='' ">
            nearExpiryQuantity,
        </if>
        <if test="threeMonthInactiveQuantity !=null and threeMonthInactiveQuantity !='' ">
            threeMonthInactiveQuantity,
        </if>
        <if test="customerVisits !=null and customerVisits !='' ">
            customerVisits,
        </if>
        <if test="memberSalesAmount !=null and memberSalesAmount !='' ">
            memberSalesAmount,
        </if>
        <if test="memberSalesGrossProfit !=null and memberSalesGrossProfit !='' ">
            memberSalesGrossProfit,
        </if>
        <if test="memberCustomerCount !=null and memberCustomerCount !='' ">
            memberCustomerCount,
        </if>
        <if test="healthSupplements !=null and healthSupplements !='' ">
            healthSupplements,
        </if>
        <if test="otc !=null and otc !='' ">
            otc,
        </if>
        <if test="others !=null and others !='' ">
            others,
        </if>
        <if test="prescription !=null and prescription !='' ">
            prescription,
        </if>
        <if test="chineseMedicineAndGinseng !=null and chineseMedicineAndGinseng !='' ">
            chineseMedicineAndGinseng,
        </if>
        <if test="chineseAndWesternMedicines !=null and chineseAndWesternMedicines !='' ">
            chineseAndWesternMedicines,
        </if>
        <if test="convenienceFood !=null and convenienceFood !='' ">
            convenienceFood,
        </if>
        <if test="dailyChemicals !=null and dailyChemicals !='' ">
            dailyChemicals,
        </if>
        <if test="servicesAndNonSellableItems !=null and servicesAndNonSellableItems !='' ">
            servicesAndNonSellableItems,
        </if>
        <if test="maternityProducts !=null and maternityProducts !='' ">
            maternityProducts,
        </if>
        <if test="disinfectionSupplies !=null and disinfectionSupplies !='' ">
            disinfectionSupplies,
        </if>
        <if test="categoryA1 !=null and categoryA1 !='' ">
            categoryA1,
        </if>
        <if test="categoryA2 !=null and categoryA2 !='' ">
            categoryA2,
        </if>
        <if test="categoryA3 !=null and categoryA3 !='' ">
            categoryA3,
        </if>
        <if test="categoryA4 !=null and categoryA4 !='' ">
            categoryA4,
        </if>
        <if test="categoryAA !=null and categoryAA !='' ">
            categoryAA,
        </if>
        <if test="otherMarketingLevels !=null and otherMarketingLevels !='' ">
            otherMarketingLevels,
        </if>
        <if test="lowProfit !=null and lowProfit !='' ">
            lowProfit,
        </if>
        <if test="marginalProfit !=null and marginalProfit !='' ">
            marginalProfit,
        </if>
        <if test="negativeProfit !=null and negativeProfit !='' ">
            negativeProfit,
        </if>
        <if test="elimination !=null and elimination !='' ">
            elimination,
        </if>
        <if test="oneMonthInactiveStock !=null and oneMonthInactiveStock !='' ">
            oneMonthInactiveStock,
        </if>
        <if test="threeMonthInactiveStock !=null and threeMonthInactiveStock !='' ">
            threeMonthInactiveStock,
        </if>
        <if test="nearExpiryRemainingStock !=null and nearExpiryRemainingStock !='' ">
            nearExpiryRemainingStock,
        </if>
        <if test="environmentIdentifier !=null and environmentIdentifier !='' ">
            environmentIdentifier,
        </if>
        <if test="recordStatus !=null and recordStatus !='' ">
            recordStatus,
        </if>
        <if test="creatorId !=null and creatorId !='' ">
            creatorId,
        </if>
        <if test="createTime !=null and createTime !='' ">
            createTime,
        </if>
        <if test="updaterId !=null and updaterId !='' ">
            updaterId,
        </if>
        <if test="updateTime !=null and updateTime !='' ">
            updateTime,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="chainId !=null and chainId !='' ">
             #{chainId},
        </if>
        <if test="organizationId !=null and organizationId !='' ">
             #{organizationId},
        </if>
        <if test="organizationName !=null and organizationName !='' ">
             #{organizationName},
        </if>
        <if test="storeId !=null and storeId !='' ">
             #{storeId},
        </if>
        <if test="date !=null and date !='' ">
             #{date},
        </if>
        <if test="actualAmount !=null and actualAmount !='' ">
             #{actualAmount},
        </if>
        <if test="salesBudget !=null and salesBudget !='' ">
             #{salesBudget},
        </if>
        <if test="grossProfitBudget !=null and grossProfitBudget !='' ">
             #{grossProfitBudget},
        </if>
        <if test="grossProfitAmount !=null and grossProfitAmount !='' ">
             #{grossProfitAmount},
        </if>
        <if test="grossProfitMargin !=null and grossProfitMargin !='' ">
             #{grossProfitMargin},
        </if>
        <if test="nearExpiryQuantity !=null and nearExpiryQuantity !='' ">
             #{nearExpiryQuantity},
        </if>
        <if test="threeMonthInactiveQuantity !=null and threeMonthInactiveQuantity !='' ">
             #{threeMonthInactiveQuantity},
        </if>
        <if test="customerVisits !=null and customerVisits !='' ">
             #{customerVisits},
        </if>
        <if test="memberSalesAmount !=null and memberSalesAmount !='' ">
             #{memberSalesAmount},
        </if>
        <if test="memberSalesGrossProfit !=null and memberSalesGrossProfit !='' ">
             #{memberSalesGrossProfit},
        </if>
        <if test="memberCustomerCount !=null and memberCustomerCount !='' ">
             #{memberCustomerCount},
        </if>
        <if test="healthSupplements !=null and healthSupplements !='' ">
             #{healthSupplements},
        </if>
        <if test="otc !=null and otc !='' ">
             #{otc},
        </if>
        <if test="others !=null and others !='' ">
             #{others},
        </if>
        <if test="prescription !=null and prescription !='' ">
             #{prescription},
        </if>
        <if test="chineseMedicineAndGinseng !=null and chineseMedicineAndGinseng !='' ">
             #{chineseMedicineAndGinseng},
        </if>
        <if test="chineseAndWesternMedicines !=null and chineseAndWesternMedicines !='' ">
             #{chineseAndWesternMedicines},
        </if>
        <if test="convenienceFood !=null and convenienceFood !='' ">
             #{convenienceFood},
        </if>
        <if test="dailyChemicals !=null and dailyChemicals !='' ">
             #{dailyChemicals},
        </if>
        <if test="servicesAndNonSellableItems !=null and servicesAndNonSellableItems !='' ">
             #{servicesAndNonSellableItems},
        </if>
        <if test="maternityProducts !=null and maternityProducts !='' ">
             #{maternityProducts},
        </if>
        <if test="disinfectionSupplies !=null and disinfectionSupplies !='' ">
             #{disinfectionSupplies},
        </if>
        <if test="categoryA1 !=null and categoryA1 !='' ">
             #{categoryA1},
        </if>
        <if test="categoryA2 !=null and categoryA2 !='' ">
             #{categoryA2},
        </if>
        <if test="categoryA3 !=null and categoryA3 !='' ">
             #{categoryA3},
        </if>
        <if test="categoryA4 !=null and categoryA4 !='' ">
             #{categoryA4},
        </if>
        <if test="categoryAA !=null and categoryAA !='' ">
             #{categoryAA},
        </if>
        <if test="otherMarketingLevels !=null and otherMarketingLevels !='' ">
             #{otherMarketingLevels},
        </if>
        <if test="lowProfit !=null and lowProfit !='' ">
             #{lowProfit},
        </if>
        <if test="marginalProfit !=null and marginalProfit !='' ">
             #{marginalProfit},
        </if>
        <if test="negativeProfit !=null and negativeProfit !='' ">
             #{negativeProfit},
        </if>
        <if test="elimination !=null and elimination !='' ">
             #{elimination},
        </if>
        <if test="oneMonthInactiveStock !=null and oneMonthInactiveStock !='' ">
             #{oneMonthInactiveStock},
        </if>
        <if test="threeMonthInactiveStock !=null and threeMonthInactiveStock !='' ">
             #{threeMonthInactiveStock},
        </if>
        <if test="nearExpiryRemainingStock !=null and nearExpiryRemainingStock !='' ">
             #{nearExpiryRemainingStock},
        </if>
        <if test="environmentIdentifier !=null and environmentIdentifier !='' ">
             #{environmentIdentifier},
        </if>
        <if test="recordStatus !=null and recordStatus !='' ">
             #{recordStatus},
        </if>
        <if test="creatorId !=null and creatorId !='' ">
             #{creatorId},
        </if>
        <if test="createTime !=null and createTime !='' ">
             #{createTime},
        </if>
        <if test="updaterId !=null and updaterId !='' ">
             #{updaterId},
        </if>
        <if test="updateTime !=null and updateTime !='' ">
             #{updateTime},
        </if>
        </trim>

    </insert>

</mapper>
