<?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="cn.ezhizao.project.business.email.mapper.BizEmailMapper">

    <resultMap type="cn.ezhizao.project.business.email.domain.BizEmail" id="BizEmailResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizEmail" resultMap="BizEmailResult">
        SELECT * FROM biz_email
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="type != null "> AND type = #{type}</if>
            <if test="isStop != null "> AND is_stop = #{isStop}</if>
            <if test="emailAddress != null  and emailAddress != ''"> AND email_address like concat('%', #{emailAddress}, '%')</if>
            <if test="authCode != null  and authCode != ''"> AND auth_code = #{authCode}</if>
            <if test="port != null  and port != ''"> AND port = #{port}</if>
            <if test="protocol != null  and protocol != ''"> AND protocol = #{protocol}</if>
            <if test="host != null  and host != ''"> AND host = #{host}</if>
            <if test="isSsl != null "> AND is_ssl = #{isSsl}</if>
        </trim>
    </select>

    <delete id="physicalDelete">
        DELETE FROM biz_email
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
       <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
