<?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.CrmSourceMapper">

    <resultMap id="infoMap" type="com.house365.beans.entity.CrmSourceEntity">
        <result property="id" column="id"/>
        <result property="sourceId" column="source_id"/>
        <result property="sourceName" column="source_name"/>
        <result property="status" column="status"/>
        <result property="categoryId" column="category_id"/>
        <result property="categoryName" column="category_name"/>
        <result property="categoryPid" column="category_pid"/>
        <result property="createTime" column="create_time"/>
        <result property="creater" column="creater"/>
    </resultMap>

    <select id="queryByConditions" resultMap="infoMap" parameterType="map">
        SELECT *
        FROM crm_source
        where 1 = 1
        <if test="sourceName != null and sourceName != ''">
            AND source_name LIKE CONCAT('%',#{sourceName},'%')
        </if>
        <if test="sourceId != null and sourceId > 0">
            AND source_id = #{sourceId}
        </if>
    </select>

</mapper>