<?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="com.house365.ws.dao.mapper.CustomerSourceMapper">

    <resultMap id="infoMap" type="com.house365.beans.entity.CustomerSourceEntity">
        <result property="id" column="id"/>
        <result property="sourceName" column="source_name"/>
        <result property="sort" column="sort" />
        <result property="createTime" column="create_time"/>
        <result property="creater" column="creater"/>
        <result property="city" column="city"/>
        <result property="source" column="source"/>
        <result property="status" column="status"/>
        <result property="type" column="type"/>
    </resultMap>

    <select id="queryByConditions" resultMap="infoMap" parameterType="map">
        SELECT *
        FROM customer_source
        where 1 = 1
        <if test="type != null and type >= 0">
            AND type = #{type}
        </if>
        <if test="city != null and city != ''">
            AND city = #{city}
        </if>
        <if test="status != null and status >= 0">
            AND status = #{status}
        </if>
        <if test="typeList != null and typeList.size() > 0 ">
            AND type in
            <foreach collection="typeList" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        order by  create_time
    </select>

</mapper>