<?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.liquidnet.service.kylin.mapper.KylinCheckUserMapper">

    <resultMap id="simpleList" type="com.liquidnet.service.kylin.dao.ChildListDao">
        <result column="check_user_id" property="checkUserId"/>
        <result column="name" property="name"/>
        <result column="mobile" property="mobile"/>
    </resultMap>

    <resultMap id="simpleDetails" type="com.liquidnet.service.kylin.dao.ChildDetailsDao">
        <result column="check_user_id" property="checkUserId"/>
        <result column="name" property="name"/>
        <result column="mobile" property="mobile"/>
        <result column="status" property="status"/>
    </resultMap>

    <select id="childSimpleList" parameterType="java.lang.String" resultMap="simpleList">
        SELECT
        check_user_id,
        `name`,
        mobile
        FROM kylin_check_user
        <where>
            merchant_id=#{merchantId} AND `status` = 1
            <if test="mobile !=null and mobile !='' ">
                AND `mobile` LIKE concat('%', #{mobile}, '%')
            </if>
        </where>
    </select>

    <select id="childDetails" parameterType="java.lang.String" resultMap="simpleDetails">
        SELECT
        check_user_id,
        `name`,
        mobile,
        status
        FROM kylin_check_user
        <where>
            merchant_id=#{merchantId} AND `check_user_id` = #{checkUserId}
        </where>
    </select>

</mapper>
