<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
        "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="com.house365.beans.entity.RushCustomerEntity">
    <typeAlias alias="rushCustomerEntity"
               type="com.house365.beans.entity.RushCustomerEntity"/>
    <resultMap id="rushCustomer"
               class="com.house365.beans.entity.RushCustomerEntity">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="phone" column="phone"/>
        <result property="bakPhone1" column="bak_phone1"/>
        <result property="bakPhone2" column="bak_phone2"/>
        <result property="bakPhone3" column="bak_phone3"/>
        <result property="sex" column="sex"/>
        <result property="customerType" column="customer_type"/>
        <result property="actSource" column="act_source"/>
        <result property="firstSource" column="first_source"/>
        <result property="latestSource" column="latest_source"/>
        <result property="crmLatestCall" column="crm_latest_call"/>
        <result property="crmLatestCallResult" column="crm_latest_call_result"/>
        <result property="status" column="status"/>
        <result property="createSource" column="create_source"/>
        <result property="createTime" column="create_time"/>
        <result property="creater" column="creater"/>
        <result property="buyIntention" column="buy_intention"/>
        <result property="lastVisitTime" column="last_visit_time"/>
        <result property="lastCallTime" column="last_call_time"/>
        <result property="managerId" column="manager_id"/>
        <result property="managerName" column="manager_name"/>
        <result property="updateTime" column="update_time"/>
        <result property="updater" column="updater"/>
        <result property="cityCode" column="cityCode"/>
        <result property="bizPort" column="biz_port"/>
        <result property="crmId" column="crmId"/>
        <result property="cityName" column="cityName"/>
        <result property="actSourceId" column="act_source_id"/>
        <result property="ruleId" column="rule_id"/>
        <result property="rushStatus" column="rush_status"/>
        <result property="remark" column="remark"/>
        <result property="projectId" column="project_id"/>
        <result property="projectName" column="project_name"/>
        <result property="isDeleted" column="is_deleted"/>
    </resultMap>

    <resultMap id="rushCustomerShow"
               class="com.house365.beans.entity.RushCustomerEntity">
        <result property="id" column="id"/>
        <result property="name" column="name"/>
        <result property="phone" column="phone"/>
        <result property="bakPhone1" column="bak_phone1"/>
        <result property="bakPhone2" column="bak_phone2"/>
        <result property="bakPhone3" column="bak_phone3"/>
        <result property="sex" column="sex"/>
        <result property="customerType" column="customer_type"/>
        <result property="actSource" column="act_source"/>
        <result property="firstSource" column="first_source"/>
        <result property="latestSource" column="latest_source"/>
        <result property="crmLatestCall" column="crm_latest_call"/>
        <result property="crmLatestCallResult" column="crm_latest_call_result"/>
        <result property="status" column="status"/>
        <result property="createSource" column="create_source"/>
        <result property="createTime" column="create_time"/>
        <result property="creater" column="creater"/>
        <result property="buyIntention" column="buy_intention"/>
        <result property="lastVisitTime" column="last_visit_time"/>
        <result property="lastCallTime" column="last_call_time"/>
        <result property="managerId" column="manager_id"/>
        <result property="managerName" column="manager_name"/>
        <result property="updateTime" column="update_time"/>
        <result property="updater" column="updater"/>
        <result property="cityCode" column="cityCode"/>
        <result property="bizPort" column="biz_port"/>
        <result property="crmId" column="crmId"/>
        <result property="cityName" column="cityName"/>
        <result property="actSourceId" column="act_source_id"/>
        <result property="ruleId" column="rule_id"/>
        <result property="rushStatus" column="rush_status"/>
        <result property="remark" column="remark"/>
        <result property="managerCount" column="manager_count"/>
        <result property="projectId" column="project_id"/>
        <result property="projectName" column="project_name"/>
        <result property="isDeleted" column="is_deleted"/>
    </resultMap>

    <!-- 用于select查询公用抽取的列 -->
    <sql id="rushCustomer.columns">
	    <![CDATA[



        id, name, phone, bak_phone1, bak_phone2, bak_phone3, sex, customer_type, act_source, first_source,
        latest_source, crm_latest_call, crm_latest_call_result, status, create_source, create_time, creater,
        buy_intention, last_visit_time, last_call_time, manager_id, manager_name, update_time, updater, cityCode,
        biz_port, crmId, cityName, act_source_id, rule_id, rush_status, remark, project_id, project_name,is_deleted



        ]]>
	</sql>

    <!-- 新增记录 -->
    <insert id="save" parameterClass="rushCustomerEntity">
        <![CDATA[
	        INSERT INTO rush_customer (
	        	id, 
	        	name, 
	        	phone, 
	        	bak_phone1, 
	        	bak_phone2, 
	        	bak_phone3, 
	        	sex, 
	        	customer_type, 
	        	act_source, 
	        	first_source, 
	        	latest_source, 
	        	crm_latest_call, 
	        	crm_latest_call_result, 
	        	status, 
	        	create_source, 
	        	create_time, 
	        	creater, 
	        	buy_intention, 
	        	last_visit_time, 
	        	last_call_time, 
	        	manager_id, 
	        	manager_name, 
	        	update_time, 
	        	updater, 
	        	cityCode, 
	        	biz_port, 
	        	crmId, 
	        	cityName, 
	        	act_source_id, 
	        	rule_id, 
	        	rush_status, 
				remark,
	        	project_id,
	        	project_name,
	        	is_deleted
	        ) VALUES (
	        	#id#, 
	        	#name#, 
	        	#phone#, 
	        	#bakPhone1#, 
	        	#bakPhone2#, 
	        	#bakPhone3#, 
	        	#sex#, 
	        	#customerType#, 
	        	#actSource#, 
	        	#firstSource#, 
	        	#latestSource#, 
	        	#crmLatestCall#, 
	        	#crmLatestCallResult#, 
	        	#status#, 
	        	#createSource#, 
	        	#createTime#, 
	        	#creater#, 
	        	#buyIntention#, 
	        	#lastVisitTime#, 
	        	#lastCallTime#, 
	        	#managerId#, 
	        	#managerName#, 
	        	#updateTime#, 
	        	#updater#, 
	        	#cityCode#, 
	        	#bizPort#, 
	        	#crmId#, 
	        	#cityName#, 
	        	#actSourceId#, 
	        	#ruleId#, 
	        	#rushStatus#, 
	        	#remark#,
	        	#projectId#,
	        	#projectName#,
	        	#isDeleted#
	        )
	    ]]>
        <selectKey resultClass="java.lang.Integer" type="post"
                   keyProperty="id">
            SELECT LAST_INSERT_ID()
        </selectKey>
    </insert>

    <!-- 通过ID修改 -->
    <update id="update" parameterClass="rushCustomerEntity">
	    <![CDATA[



	        UPDATE rush_customer SET
		        name = #name#, 
		        phone = #phone#, 
		        bak_phone1 = #bakPhone1#, 
		        bak_phone2 = #bakPhone2#, 
		        bak_phone3 = #bakPhone3#, 
		        sex = #sex#, 
		        customer_type = #customerType#, 
		        act_source = #actSource#, 
		        first_source = #firstSource#, 
		        latest_source = #latestSource#, 
		        crm_latest_call = #crmLatestCall#, 
		        crm_latest_call_result = #crmLatestCallResult#, 
		        status = #status#, 
		        create_source = #createSource#, 
		        create_time = #createTime#, 
		        creater = #creater#, 
		        buy_intention = #buyIntention#, 
		        last_visit_time = #lastVisitTime#, 
		        last_call_time = #lastCallTime#, 
		        manager_id = #managerId#, 
		        manager_name = #managerName#, 
		        update_time = #updateTime#, 
		        updater = #updater#, 
		        cityCode = #cityCode#, 
		        biz_port = #bizPort#, 
		        crmId = #crmId#, 
		        cityName = #cityName#, 
		        act_source_id = #actSourceId#, 
		        rule_id = #ruleId#, 
		        rush_status = #rushStatus#, 
			    remark = #remark#,
		        project_id = #projectId#,
		        project_name = #projectName#,
		        is_deleted = #isDeleted#
	        WHERE
		        id = #id#



        ]]>
	</update>

    <!-- 通过ID删除 -->
    <delete id="delete">
	    <![CDATA[



	        DELETE FROM rush_customer WHERE
	        id = #id#



        ]]>
	</delete>

    <!-- 通过ID列表批量删除 -->
    <delete id="deleteByIds" parameterClass="java.lang.String">
	    <![CDATA[



	        DELETE FROM rush_customer WHERE
	        id IN ($ids$)



        ]]>
	</delete>

    <!-- 通过ID查询 -->
    <select id="getById" resultMap="rushCustomer">
        SELECT
        <include refid="rushCustomer.columns"/>
        <![CDATA[
	        FROM rush_customer 
	        WHERE 
		        id = #id#
	    ]]>
    </select>

    <!-- 用于分页查询抽取的公共的条件 -->
    <sql id="rushCustomer.queryPage">
        <dynamic prepend="WHERE">
            <!-- 默认不开启实体作为条件 -->
            <!--
            <isNotNull property="entity">
                <isNotEmpty prepend="AND" property="entity.id">
                    <![CDATA[
                    id = #entity.id#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.name">
                    <![CDATA[
                    name = #entity.name#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.phone">
                    <![CDATA[
                    phone = #entity.phone#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.bakPhone1">
                    <![CDATA[
                    bak_phone1 = #entity.bakPhone1#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.bakPhone2">
                    <![CDATA[
                    bak_phone2 = #entity.bakPhone2#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.bakPhone3">
                    <![CDATA[
                    bak_phone3 = #entity.bakPhone3#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.sex">
                    <![CDATA[
                    sex = #entity.sex#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.customerType">
                    <![CDATA[
                    customer_type = #entity.customerType#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.actSource">
                    <![CDATA[
                    act_source = #entity.actSource#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.firstSource">
                    <![CDATA[
                    first_source = #entity.firstSource#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.latestSource">
                    <![CDATA[
                    latest_source = #entity.latestSource#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.crmLatestCall">
                    <![CDATA[
                    crm_latest_call = #entity.crmLatestCall#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.crmLatestCallResult">
                    <![CDATA[
                    crm_latest_call_result = #entity.crmLatestCallResult#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.status">
                    <![CDATA[
                    status = #entity.status#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.createSource">
                    <![CDATA[
                    create_source = #entity.createSource#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.createTime">
                    <![CDATA[
                    create_time = #entity.createTime#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.creater">
                    <![CDATA[
                    creater = #entity.creater#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.buyIntention">
                    <![CDATA[
                    buy_intention = #entity.buyIntention#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.lastVisitTime">
                    <![CDATA[
                    last_visit_time = #entity.lastVisitTime#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.lastCallTime">
                    <![CDATA[
                    last_call_time = #entity.lastCallTime#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.managerId">
                    <![CDATA[
                    manager_id = #entity.managerId#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.managerName">
                    <![CDATA[
                    manager_name = #entity.managerName#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.updateTime">
                    <![CDATA[
                    update_time = #entity.updateTime#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.updater">
                    <![CDATA[
                    updater = #entity.updater#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.cityCode">
                    <![CDATA[
                    cityCode = #entity.cityCode#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.bizPort">
                    <![CDATA[
                    biz_port = #entity.bizPort#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.crmId">
                    <![CDATA[
                    crmId = #entity.crmId#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.cityName">
                    <![CDATA[
                    cityName = #entity.cityName#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.actSourceId">
                    <![CDATA[
                    act_source_id = #entity.actSourceId#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.ruleId">
                    <![CDATA[
                    rule_id = #entity.ruleId#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.rushStatus">
                    <![CDATA[
                    rush_status = #entity.rushStatus#
                    ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="entity.remark">
                    <![CDATA[
                    remark = #entity.remark#
                    ]]>
                </isNotEmpty>
            </isNotNull>
             -->
            <isNotNull property="searchFilters">
                <isNotEmpty prepend="AND" property="searchFilters.id">
                    <![CDATA[
					id $searchFilters.id.operation$ #searchFilters.id.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.name">
                    <![CDATA[
					name $searchFilters.name.operation$ #searchFilters.name.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.phone">
                    <![CDATA[
					phone $searchFilters.phone.operation$ #searchFilters.phone.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.filterName">
                    <![CDATA[
					(phone like #searchFilters.filterName.value# or name like #searchFilters.filterName.value#)
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.bakPhone1">
                    <![CDATA[
					bak_phone1 $searchFilters.bakPhone1.operation$ #searchFilters.bakPhone1.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.bakPhone2">
                    <![CDATA[
					bak_phone2 $searchFilters.bakPhone2.operation$ #searchFilters.bakPhone2.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.bakPhone3">
                    <![CDATA[
					bak_phone3 $searchFilters.bakPhone3.operation$ #searchFilters.bakPhone3.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.sex">
                    <![CDATA[
					sex $searchFilters.sex.operation$ #searchFilters.sex.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.customerType">
                    <![CDATA[
					customer_type $searchFilters.customerType.operation$ #searchFilters.customerType.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.actSource">
                    <![CDATA[
					act_source $searchFilters.actSource.operation$ #searchFilters.actSource.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.firstSource">
                    <![CDATA[
					first_source $searchFilters.firstSource.operation$ #searchFilters.firstSource.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.latestSource">
                    <![CDATA[
					latest_source $searchFilters.latestSource.operation$ #searchFilters.latestSource.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.crmLatestCall">
                    <![CDATA[
					crm_latest_call $searchFilters.crmLatestCall.operation$ #searchFilters.crmLatestCall.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.crmLatestCallResult">
                    <![CDATA[
					crm_latest_call_result $searchFilters.crmLatestCallResult.operation$ #searchFilters.crmLatestCallResult.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.status">
                    <![CDATA[
					status $searchFilters.status.operation$ #searchFilters.status.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.createSource">
                    <![CDATA[
					create_source $searchFilters.createSource.operation$ #searchFilters.createSource.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.createTimeStart">
                    <![CDATA[
					create_time $searchFilters.createTimeStart.operation$ #searchFilters.createTimeStart.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.createTimeEnd">
                    <![CDATA[
					create_time $searchFilters.createTimeEnd.operation$ #searchFilters.createTimeEnd.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.creater">
                    <![CDATA[
					creater $searchFilters.creater.operation$ #searchFilters.creater.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.buyIntention">
                    <![CDATA[
					buy_intention $searchFilters.buyIntention.operation$ #searchFilters.buyIntention.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.lastVisitTime">
                    <![CDATA[
					last_visit_time $searchFilters.lastVisitTime.operation$ #searchFilters.lastVisitTime.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.lastCallTime">
                    <![CDATA[
					last_call_time $searchFilters.lastCallTime.operation$ #searchFilters.lastCallTime.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.managerId">
                    <![CDATA[
					manager_id $searchFilters.managerId.operation$ $searchFilters.managerId.value$
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.managerName">
                    <![CDATA[
					manager_name $searchFilters.managerName.operation$ #searchFilters.managerName.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.updateTime">
                    <![CDATA[
					update_time $searchFilters.updateTime.operation$ #searchFilters.updateTime.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.updater">
                    <![CDATA[
					updater $searchFilters.updater.operation$ #searchFilters.updater.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.cityCode">
                    <![CDATA[
					cityCode $searchFilters.cityCode.operation$ #searchFilters.cityCode.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.bizPort">
                    <![CDATA[
					biz_port $searchFilters.bizPort.operation$ #searchFilters.bizPort.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.crmId">
                    <![CDATA[
					crmId $searchFilters.crmId.operation$ #searchFilters.crmId.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.cityName">
                    <![CDATA[
					cityName $searchFilters.cityName.operation$ #searchFilters.cityName.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.actSourceId">
                    <![CDATA[
					act_source_id $searchFilters.actSourceId.operation$ $searchFilters.actSourceId.value$
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.ruleId">
                    <![CDATA[
					rule_id $searchFilters.ruleId.operation$ #searchFilters.ruleId.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.rushStatus">
                    <![CDATA[
					rush_status $searchFilters.rushStatus.operation$ #searchFilters.rushStatus.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.remark">
                    <![CDATA[
					remark $searchFilters.remark.operation$ #searchFilters.remark.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.projectId">
                    <![CDATA[
					project_id $searchFilters.projectId.operation$ #searchFilters.projectId.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.projectName">
                    <![CDATA[
					project_name $searchFilters.projectName.operation$ #searchFilters.projectName.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.isDeleted">
                    <![CDATA[
					is_deleted $searchFilters.isDeleted.operation$ #searchFilters.isDeleted.value#
		            ]]>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.actIds">
                    act_source_id in
                    <iterate open="(" close=")" conjunction="," property="searchFilters.actIds.value">
                        <![CDATA[#searchFilters.actIds.value[]# ]]>
                    </iterate>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.projectIds">
                    exists(
                    select id from rush_customer_project_rel rcpr
                    where rcpr.rush_customer_id = rc.id
                    and rcpr.project_id in
                    <iterate open="(" close=")" conjunction="," property="searchFilters.projectIds.value">
                        <![CDATA[#searchFilters.projectIds.value[]# ]]>
                    </iterate>
                    )
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.notActIds">
                    act_source_id not in
                    <iterate open="(" close=")" conjunction="," property="searchFilters.notActIds.value">
                        <![CDATA[#searchFilters.notActIds.value[]# ]]>
                    </iterate>
                </isNotEmpty>
                <isNotEmpty prepend="AND" property="searchFilters.notProjectIds">
                    not exists(
                    select id from rush_customer_project_rel rcpr
                    where rcpr.rush_customer_id = rc.id
                    and rcpr.project_id in
                    <iterate open="(" close=")" conjunction="," property="searchFilters.notProjectIds.value">
                        <![CDATA[#searchFilters.notProjectIds.value[]# ]]>
                    </iterate>
                    )
                </isNotEmpty>

            </isNotNull>
        </dynamic>
        <dynamic prepend="ORDER BY">
            <isNotNull property="orderColumn">
                <![CDATA[
				$orderColumn$
				]]>
                <isNotNull property="orderMode">
                    $orderMode$
                </isNotNull>
            </isNotNull>
        </dynamic>
    </sql>

    <!-- 为分页查询符合条件的记录数 -->
    <select id="queryByPage_count" resultClass="int">
        SELECT count(*)
        FROM rush_customer rc
        <include refid="rushCustomer.queryPage"/>
    </select>

    <!-- 分页查询指定页记录 -->
    <select id="queryByPage" resultMap="rushCustomer">
        SELECT
        <include refid="rushCustomer.columns"/>
        <![CDATA[
	        FROM rush_customer rc
	    ]]>
        <include refid="rushCustomer.queryPage"/>
        <![CDATA[
		    LIMIT #paging.startRecord#, #paging.pageSize#
        ]]>
    </select>

    <!-- 查询所有记录 -->
    <select id="queryAll" resultMap="rushCustomer">
        SELECT
        <include refid="rushCustomer.columns"/>
        <![CDATA[
		    FROM rush_customer rc
	    ]]>
        <include refid="rushCustomer.queryPage"/>
    </select>


    <!-- 为分页查询符合条件的记录数 -->
    <select id="queryAllShow_count" resultClass="int">
        SELECT
        count(*)
        FROM rush_customer rc
        <isNotEmpty property="searchFilters.type0">
            ,rush_customer_push_log rcpl
        </isNotEmpty>
        <isNotEmpty property="searchFilters.type1">
            ,rush_customer_push_log rcpl
        </isNotEmpty>
        WHERE
        <isNotEmpty property="searchFilters.type0">
            rc.id = rcpl.rush_customer_id
            AND rc.rush_status = 0
        </isNotEmpty>
        <isNotEmpty property="searchFilters.type1">
            rc.id = rcpl.rush_customer_id
            AND rc.rush_status = 1
        </isNotEmpty>
        <isNotEmpty property="searchFilters.type2">
            rc.rush_status = 0
            AND rc.id not in(select rush_customer_id from rush_customer_push_log)
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.filterName">
            <![CDATA[
				(rc.phone like #searchFilters.filterName.value# or rc.name like #searchFilters.filterName.value#)
			]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.createTimeStart">
            <![CDATA[
				rc.create_time $searchFilters.createTimeStart.operation$ #searchFilters.createTimeStart.value#
			]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.createTimeEnd">
            <![CDATA[
				rc.create_time $searchFilters.createTimeEnd.operation$ #searchFilters.createTimeEnd.value#
			]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.urlPath">
            <![CDATA[
				rcpl.department_id in(select id from department where urlPath $searchFilters.urlPath.operation$ #searchFilters.urlPath.value#)
			]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.cityCode">
            <![CDATA[
                rc.cityCode $searchFilters.cityCode.operation$ #searchFilters.cityCode.value#
            ]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.isDeleted">
            <![CDATA[
                rc.is_deleted $searchFilters.isDeleted.operation$ #searchFilters.isDeleted.value#
            ]]>
        </isNotEmpty>
    </select>
    <select id="queryAllShow" resultMap="rushCustomerShow">
        SELECT
        rc.*,
        (
        select
        count(1)
        from
        rush_customer r
        where
        r.manager_id = rc.manager_id
        and r.status=1
        ) as manager_count
        FROM rush_customer rc
        <isNotEmpty property="searchFilters.type0">
            ,rush_customer_push_log rcpl
        </isNotEmpty>
        <isNotEmpty property="searchFilters.type1">
            ,rush_customer_push_log rcpl
        </isNotEmpty>
        WHERE
        <isNotEmpty property="searchFilters.type0">
            rc.id = rcpl.rush_customer_id
            AND rc.rush_status = 0
        </isNotEmpty>
        <isNotEmpty property="searchFilters.type1">
            rc.id = rcpl.rush_customer_id
            AND rc.rush_status = 1
        </isNotEmpty>
        <isNotEmpty property="searchFilters.type2">
            rc.rush_status = 0
            AND rc.id not in(select rush_customer_id from rush_customer_push_log)
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.filterName">
            <![CDATA[
				(rc.phone like #searchFilters.filterName.value# or rc.name like #searchFilters.filterName.value#)
			]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.createTimeStart">
            <![CDATA[
				rc.create_time $searchFilters.createTimeStart.operation$ #searchFilters.createTimeStart.value#
			]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.createTimeEnd">
            <![CDATA[
				rc.create_time $searchFilters.createTimeEnd.operation$ #searchFilters.createTimeEnd.value#
			]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.urlPath">
            <![CDATA[
				rcpl.department_id in(select id from department where urlPath $searchFilters.urlPath.operation$ #searchFilters.urlPath.value#)
			]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.cityCode">
            <![CDATA[
                rc.cityCode $searchFilters.cityCode.operation$ #searchFilters.cityCode.value#
            ]]>
        </isNotEmpty>
        <isNotEmpty prepend="AND" property="searchFilters.isDeleted">
            <![CDATA[
                rc.is_deleted $searchFilters.isDeleted.operation$ #searchFilters.isDeleted.value#
            ]]>
        </isNotEmpty>
        <dynamic prepend="ORDER BY">
            <isNotNull property="orderColumn">
                <![CDATA[
				$orderColumn$
				]]>
                <isNotNull property="orderMode">
                    $orderMode$
                </isNotNull>
            </isNotNull>
        </dynamic>
        <![CDATA[
		    LIMIT #paging.startRecord#, #paging.pageSize#
        ]]>
    </select>
</sqlMap>