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

    <select id="selectSYbglMedicaremanagementList" parameterType="pd" resultType="pd">
        select * from s_ybgl_medicaremanagement where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="commodityCode !=null and commodityCode !='' ">
            and commodityCode = #{commodityCode}
        </if>
        <if test="commodityName !=null and commodityName !='' ">
            and commodityName = #{commodityName}
        </if>
        <if test="thirdPartyCommodityCode !=null and thirdPartyCommodityCode !='' ">
            and thirdPartyCommodityCode = #{thirdPartyCommodityCode}
        </if>
        <if test="channelCode !=null and channelCode !='' ">
            and channelCode = #{channelCode}
        </if>
        <if test="channelName !=null and channelName !='' ">
            and channelName = #{channelName}
        </if>
        <if test="updateTime !=null and updateTime !='' ">
            and updateTime = #{updateTime}
        </if>
        <if test="creator !=null and creator !='' ">
            and creator = #{creator}
        </if>
        <if test="channelCategoryCode !=null and channelCategoryCode !='' ">
            and channelCategoryCode = #{channelCategoryCode}
        </if>
        <if test="medicareMinDosageUnit !=null and medicareMinDosageUnit !='' ">
            and medicareMinDosageUnit = #{medicareMinDosageUnit}
        </if>
        <if test="isSplitUpload !=null and isSplitUpload !='' ">
            and isSplitUpload = #{isSplitUpload}
        </if>
    </select>


    <update id="updateSYbglMedicaremanagement" parameterType="pd" >
        update s_ybgl_medicaremanagement
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="commodityCode !=null and commodityCode !='' ">
            commodityCode = #{commodityCode},
        </if>
        <if test="commodityName !=null and commodityName !='' ">
            commodityName = #{commodityName},
        </if>
        <if test="thirdPartyCommodityCode !=null and thirdPartyCommodityCode !='' ">
            thirdPartyCommodityCode = #{thirdPartyCommodityCode},
        </if>
        <if test="channelCode !=null and channelCode !='' ">
            channelCode = #{channelCode},
        </if>
        <if test="channelName !=null and channelName !='' ">
            channelName = #{channelName},
        </if>
        <if test="updateTime !=null and updateTime !='' ">
            updateTime = #{updateTime},
        </if>
        <if test="creator !=null and creator !='' ">
            creator = #{creator},
        </if>
        <if test="channelCategoryCode !=null and channelCategoryCode !='' ">
            channelCategoryCode = #{channelCategoryCode},
        </if>
        <if test="medicareMinDosageUnit !=null and medicareMinDosageUnit !='' ">
            medicareMinDosageUnit = #{medicareMinDosageUnit},
        </if>
        <if test="isSplitUpload !=null and isSplitUpload !='' ">
            isSplitUpload = #{isSplitUpload},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="commodityCode !=null and commodityCode !='' ">
            commodityCode,
        </if>
        <if test="commodityName !=null and commodityName !='' ">
            commodityName,
        </if>
        <if test="thirdPartyCommodityCode !=null and thirdPartyCommodityCode !='' ">
            thirdPartyCommodityCode,
        </if>
        <if test="channelCode !=null and channelCode !='' ">
            channelCode,
        </if>
        <if test="channelName !=null and channelName !='' ">
            channelName,
        </if>
        <if test="updateTime !=null and updateTime !='' ">
            updateTime,
        </if>
        <if test="creator !=null and creator !='' ">
            creator,
        </if>
        <if test="channelCategoryCode !=null and channelCategoryCode !='' ">
            channelCategoryCode,
        </if>
        <if test="medicareMinDosageUnit !=null and medicareMinDosageUnit !='' ">
            medicareMinDosageUnit,
        </if>
        <if test="isSplitUpload !=null and isSplitUpload !='' ">
            isSplitUpload,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="commodityCode !=null and commodityCode !='' ">
             #{commodityCode},
        </if>
        <if test="commodityName !=null and commodityName !='' ">
             #{commodityName},
        </if>
        <if test="thirdPartyCommodityCode !=null and thirdPartyCommodityCode !='' ">
             #{thirdPartyCommodityCode},
        </if>
        <if test="channelCode !=null and channelCode !='' ">
             #{channelCode},
        </if>
        <if test="channelName !=null and channelName !='' ">
             #{channelName},
        </if>
        <if test="updateTime !=null and updateTime !='' ">
             #{updateTime},
        </if>
        <if test="creator !=null and creator !='' ">
             #{creator},
        </if>
        <if test="channelCategoryCode !=null and channelCategoryCode !='' ">
             #{channelCategoryCode},
        </if>
        <if test="medicareMinDosageUnit !=null and medicareMinDosageUnit !='' ">
             #{medicareMinDosageUnit},
        </if>
        <if test="isSplitUpload !=null and isSplitUpload !='' ">
             #{isSplitUpload},
        </if>
        </trim>

    </insert>

</mapper>
