<?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.settings.mapper.BizSourceMapper">

    <resultMap type="cn.ezhizao.project.setting.domain.BizSource" id="BizSourceResult">
        <id column="id" property="id"/>
    </resultMap>


    <select id="getList" parameterType="BizSource" resultMap="BizSourceResult">
        SELECT * FROM biz_source
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            deleted = 0
            <if test="title != null  and title != ''"> AND title like concat('%', #{title}, '%')</if>
            <if test="referrerDataSource != null  and referrerDataSource != ''"> AND referrer_data_source = #{referrerDataSource}</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_source
        <trim prefix=" WHERE" suffix="" suffixOverrides="AND">
            <if test="id != null">
                id = #{id} AND
            </if>
            <!-- 删除条件为其他外键可以在这里加 -->
        </trim>
    </delete>
</mapper>
