<?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.channel.mapper.BizChannelMapper">

    <resultMap type="cn.ezhizao.project.business.channel.domain.BizChannel" id="BizChannelResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizChannel" resultMap="BizChannelResult">
        SELECT * FROM biz_channel
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="code != null  and code != ''"> AND code = #{code}</if>
            <if test="name != null  and name != ''"> AND name like concat('%', #{name}, '%')</if>
            <if test="contact != null  and contact != ''"> AND contact = #{contact}</if>
            <if test="phone != null  and phone != ''"> AND phone = #{phone}</if>
            <if test="email != null  and email != ''"> AND email = #{email}</if>
            <if test="employeeId != null "> AND employee_id = #{employeeId}</if>
            <if test="owner != null "> AND owner = #{owner}</if>
            <if test="status != null "> AND status = #{status}</if>
            <if test="createTime != null "> AND create_time = #{createTime}</if>
            <if test="tenantId != null "> AND tenant_id = #{tenantId}</if>
        </trim>
    </select>

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