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

    <select id="selectSMdyyglMdysjqMbxsjhList" parameterType="pd" resultType="pd">
        select * from s_mdyygl_mdysjq_mbxsjh where 1=1
        <if test="date !=null and date !='' ">
            and date = #{date}
        </if>
        <if test="chronicSales !=null and chronicSales !='' ">
            and chronicSales = #{chronicSales}
        </if>
        <if test="chronicGoldSingleProductSales !=null and chronicGoldSingleProductSales !='' ">
            and chronicGoldSingleProductSales = #{chronicGoldSingleProductSales}
        </if>
        <if test="chronicMonthlyPromotionProductSales !=null and chronicMonthlyPromotionProductSales !='' ">
            and chronicMonthlyPromotionProductSales = #{chronicMonthlyPromotionProductSales}
        </if>
        <if test="andartangSales !=null and andartangSales !='' ">
            and andartangSales = #{andartangSales}
        </if>
        <if test="fufangDanshenDropPillSales !=null and fufangDanshenDropPillSales !='' ">
            and fufangDanshenDropPillSales = #{fufangDanshenDropPillSales}
        </if>
        <if test="tanglinSales !=null and tanglinSales !='' ">
            and tanglinSales = #{tanglinSales}
        </if>
    </select>


    <update id="updateSMdyyglMdysjqMbxsjh" parameterType="pd" >
        update s_mdyygl_mdysjq_mbxsjh
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="chronicSales !=null and chronicSales !='' ">
            chronicSales = #{chronicSales},
        </if>
        <if test="chronicGoldSingleProductSales !=null and chronicGoldSingleProductSales !='' ">
            chronicGoldSingleProductSales = #{chronicGoldSingleProductSales},
        </if>
        <if test="chronicMonthlyPromotionProductSales !=null and chronicMonthlyPromotionProductSales !='' ">
            chronicMonthlyPromotionProductSales = #{chronicMonthlyPromotionProductSales},
        </if>
        <if test="andartangSales !=null and andartangSales !='' ">
            andartangSales = #{andartangSales},
        </if>
        <if test="fufangDanshenDropPillSales !=null and fufangDanshenDropPillSales !='' ">
            fufangDanshenDropPillSales = #{fufangDanshenDropPillSales},
        </if>
        <if test="tanglinSales !=null and tanglinSales !='' ">
            tanglinSales = #{tanglinSales},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="chronicSales !=null and chronicSales !='' ">
            chronicSales,
        </if>
        <if test="chronicGoldSingleProductSales !=null and chronicGoldSingleProductSales !='' ">
            chronicGoldSingleProductSales,
        </if>
        <if test="chronicMonthlyPromotionProductSales !=null and chronicMonthlyPromotionProductSales !='' ">
            chronicMonthlyPromotionProductSales,
        </if>
        <if test="andartangSales !=null and andartangSales !='' ">
            andartangSales,
        </if>
        <if test="fufangDanshenDropPillSales !=null and fufangDanshenDropPillSales !='' ">
            fufangDanshenDropPillSales,
        </if>
        <if test="tanglinSales !=null and tanglinSales !='' ">
            tanglinSales,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="chronicSales !=null and chronicSales !='' ">
             #{chronicSales},
        </if>
        <if test="chronicGoldSingleProductSales !=null and chronicGoldSingleProductSales !='' ">
             #{chronicGoldSingleProductSales},
        </if>
        <if test="chronicMonthlyPromotionProductSales !=null and chronicMonthlyPromotionProductSales !='' ">
             #{chronicMonthlyPromotionProductSales},
        </if>
        <if test="andartangSales !=null and andartangSales !='' ">
             #{andartangSales},
        </if>
        <if test="fufangDanshenDropPillSales !=null and fufangDanshenDropPillSales !='' ">
             #{fufangDanshenDropPillSales},
        </if>
        <if test="tanglinSales !=null and tanglinSales !='' ">
             #{tanglinSales},
        </if>
        </trim>

    </insert>

</mapper>
