<?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.heketai.website.mapper.JobHunterMapper">
    <resultMap id="BaseResultMap" type="com.heketai.website.entity.JobHunter">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="search_id" jdbcType="INTEGER" property="searchId"/>
        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
        <result column="phone_number" jdbcType="VARCHAR" property="phoneNumber"/>
        <result column="mail" jdbcType="VARCHAR" property="mail"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
    </resultMap>

    <select id="selectByPhoneAndSearchId" resultMap="BaseResultMap">
        select id
              ,search_id
              ,user_name
              ,phone_number
              ,mail
              ,create_time
        from job_hunter
        where search_id = #{searchId}
          and phone_number = #{phoneNumber}

    </select>

        <resultMap id="JobHunterMap" type="com.heketai.website.entity.dto.JobHunterVO">
            <id column="id" jdbcType="INTEGER" property="id"/>
            <result column="search_id" jdbcType="INTEGER" property="searchId"/>
            <result column="user_name" jdbcType="VARCHAR" property="userName"/>
            <result column="phone_number" jdbcType="VARCHAR" property="phoneNumber"/>
            <result column="mail" jdbcType="VARCHAR" property="mail"/>
            <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
            <collection property="jobSearchList" column="search_id"
                        select="com.heketai.website.mapper.JobSearchMapper.selectJobSearchById"/>
        </resultMap>
    <select id="selectJobHunterList" resultMap="JobHunterMap">
        select id
             ,search_id
             ,user_name
             ,phone_number
             ,mail
             ,create_time
        from job_hunter
        where 1 = 1
        order by update_time desc
            limit #{start}, #{size}
    </select>
</mapper>