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

    <select id="selectSDaasChannelManagementList" parameterType="pd" resultType="pd">
        select * from s_daas_channel_management where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="channelName !=null and channelName !='' ">
            and channelName = #{channelName}
        </if>
        <if test="channelCode !=null and channelCode !='' ">
            and channelCode = #{channelCode}
        </if>
        <if test="channelType !=null and channelType !='' ">
            and channelType = #{channelType}
        </if>
        <if test="contactPerson !=null and contactPerson !='' ">
            and contactPerson = #{contactPerson}
        </if>
        <if test="contactPhone !=null and contactPhone !='' ">
            and contactPhone = #{contactPhone}
        </if>
        <if test="email !=null and email !='' ">
            and email = #{email}
        </if>
        <if test="address !=null and address !='' ">
            and address = #{address}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            and createdAt = #{createdAt}
        </if>
        <if test="beginTime != null and beginTime!='' and endTime != null and endTime!=''">
            and createdAt between #{beginTime} and #{endTime}
        </if>
        <if test="createdBy !=null and createdBy !='' ">
            and createdBy = #{createdBy}
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            and updatedAt = #{updatedAt}
        </if>
        <if test="updatedBy !=null and updatedBy !='' ">
            and updatedBy = #{updatedBy}
        </if>
        <if test="remarks !=null and remarks !='' ">
            and remarks = #{remarks}
        </if>
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
    </select>


    <update id="updateSDaasChannelManagement" parameterType="pd" >
        update s_daas_channel_management
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="channelName !=null and channelName !='' ">
            channelName = #{channelName},
        </if>
        <if test="channelCode !=null and channelCode !='' ">
            channelCode = #{channelCode},
        </if>
        <if test="channelType !=null and channelType !='' ">
            channelType = #{channelType},
        </if>
        <if test="contactPerson !=null and contactPerson !='' ">
            contactPerson = #{contactPerson},
        </if>
        <if test="contactPhone !=null and contactPhone !='' ">
            contactPhone = #{contactPhone},
        </if>
        <if test="email !=null and email !='' ">
            email = #{email},
        </if>
        <if test="address !=null and address !='' ">
            address = #{address},
        </if>
        <if test="status !=null and status !='' ">
            status = #{status},
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            createdAt = #{createdAt},
        </if>
        <if test="createdBy !=null and createdBy !='' ">
            createdBy = #{createdBy},
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            updatedAt = #{updatedAt},
        </if>
        <if test="updatedBy !=null and updatedBy !='' ">
            updatedBy = #{updatedBy},
        </if>
        <if test="remarks !=null and remarks !='' ">
            remarks = #{remarks},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="channelName !=null and channelName !='' ">
            channelName,
        </if>
        <if test="channelCode !=null and channelCode !='' ">
            channelCode,
        </if>
        <if test="channelType !=null and channelType !='' ">
            channelType,
        </if>
        <if test="contactPerson !=null and contactPerson !='' ">
            contactPerson,
        </if>
        <if test="contactPhone !=null and contactPhone !='' ">
            contactPhone,
        </if>
        <if test="email !=null and email !='' ">
            email,
        </if>
        <if test="address !=null and address !='' ">
            address,
        </if>
        <if test="status !=null and status !='' ">
            status,
        </if>
        <if test="createdAt !=null and createdAt !='' ">
            createdAt,
        </if>
        <if test="createdBy !=null and createdBy !='' ">
            createdBy,
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
            updatedAt,
        </if>
        <if test="updatedBy !=null and updatedBy !='' ">
            updatedBy,
        </if>
        <if test="remarks !=null and remarks !='' ">
            remarks,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="channelName !=null and channelName !='' ">
             #{channelName},
        </if>
        <if test="channelCode !=null and channelCode !='' ">
             #{channelCode},
        </if>
        <if test="channelType !=null and channelType !='' ">
             #{channelType},
        </if>
        <if test="contactPerson !=null and contactPerson !='' ">
             #{contactPerson},
        </if>
        <if test="contactPhone !=null and contactPhone !='' ">
             #{contactPhone},
        </if>
        <if test="email !=null and email !='' ">
             #{email},
        </if>
        <if test="address !=null and address !='' ">
             #{address},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        <if test="createdAt !=null and createdAt !='' ">
             #{createdAt},
        </if>
        <if test="createdBy !=null and createdBy !='' ">
             #{createdBy},
        </if>
        <if test="updatedAt !=null and updatedAt !='' ">
             #{updatedAt},
        </if>
        <if test="updatedBy !=null and updatedBy !='' ">
             #{updatedBy},
        </if>
        <if test="remarks !=null and remarks !='' ">
             #{remarks},
        </if>
        </trim>

    </insert>

</mapper>
