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

    <select id="selectSMdyyglMdysjqChiefmainsalesplanList" parameterType="pd" resultType="pd">
        select * from s_mdyygl_mdysjq_chiefmainsalesplan where 1=1
        <if test="date !=null and date !='' ">
            and date = #{date}
        </if>
        <if test="aaSalesPlan !=null and aaSalesPlan !='' ">
            and aaSalesPlan = #{aaSalesPlan}
        </if>
        <if test="a1SalesPlan !=null and a1SalesPlan !='' ">
            and a1SalesPlan = #{a1SalesPlan}
        </if>
        <if test="a2SalesPlan !=null and a2SalesPlan !='' ">
            and a2SalesPlan = #{a2SalesPlan}
        </if>
    </select>


    <update id="updateSMdyyglMdysjqChiefmainsalesplan" parameterType="pd" >
        update s_mdyygl_mdysjq_chiefmainsalesplan
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="aaSalesPlan !=null and aaSalesPlan !='' ">
            aaSalesPlan = #{aaSalesPlan},
        </if>
        <if test="a1SalesPlan !=null and a1SalesPlan !='' ">
            a1SalesPlan = #{a1SalesPlan},
        </if>
        <if test="a2SalesPlan !=null and a2SalesPlan !='' ">
            a2SalesPlan = #{a2SalesPlan},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="aaSalesPlan !=null and aaSalesPlan !='' ">
            aaSalesPlan,
        </if>
        <if test="a1SalesPlan !=null and a1SalesPlan !='' ">
            a1SalesPlan,
        </if>
        <if test="a2SalesPlan !=null and a2SalesPlan !='' ">
            a2SalesPlan,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="aaSalesPlan !=null and aaSalesPlan !='' ">
             #{aaSalesPlan},
        </if>
        <if test="a1SalesPlan !=null and a1SalesPlan !='' ">
             #{a1SalesPlan},
        </if>
        <if test="a2SalesPlan !=null and a2SalesPlan !='' ">
             #{a2SalesPlan},
        </if>
        </trim>

    </insert>

</mapper>
