<?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.sqx.modules.sendRecord.dao.SendRecordDao">


    <select id="getRecordList" resultType="com.sqx.modules.app.vo.UserPostPushBrowseVo">
        SELECT p.*,
        s.record_id,
        c.company_name,
        c.company_logo,
        c.company_address,
        c.company_lng,
        c.company_lat,
        c.company_people,
        c.company_legal_person,
        c.company_scope
        FROM
        post_push p,
        company c,
        send_record s
        WHERE s.`post_push_id` = p.`post_push_id`
        AND s.`user_id` =#{sendRecord.userId}
        AND s.`company_id` = c.`company_id`

        <if test="experience!=null and experience.length!=0">
            and
            <foreach collection="experience" item="item" open="(" separator="or" close=")">
                p.experience like concat("%",#{item},"%")
            </foreach>
        </if>
        <if test="industry!=null and industry.length!=0">
            and
            <foreach collection="industry" item="item" open="(" separator="or" close=")">
                p.industry like concat("%",#{item},"%")
            </foreach>
        </if>
        <if test="salaryRange!=null and salaryRange.length!=0">
            and
            <foreach collection="salaryRange" item="item" open="(" separator="or" close=")">
                p.salary_range like concat("%",#{item},"%")
            </foreach>
        </if>

        <if test="companyPeople!=null and companyPeople.length!=0">
            and
            <foreach collection="companyPeople" item="item" open="(" separator="or" close=")">
                c.company_people like concat("%",#{item},"%")
            </foreach>
        </if>
        <if test="education!=null and education.length!=0">
            and
            <foreach collection="education" item="item" open="(" separator="or" close=")">
                p.education like concat("%",#{item},"%")
            </foreach>
        </if>

        order by s.update_time desc
    </select>
    <select id="getCompanyRecordList" resultType="com.sqx.modules.app.vo.ResumesBrowseVo">
        select r.*,
        u.avatar,
        p.station_name,
        s.record_id,
        p.rule_classify_name,
        s.is_see
        from send_record s,
        resumes r,
        post_push p,
        tb_user u
        where s.company_user_id = #{sendRecord.companyUserId}
        and r.user_id = s.user_id
        and u.user_id = r.user_id
        and s.post_push_id = p.post_push_id
        <if test="sendRecord.isSee!=null">
            and s.is_see = #{sendRecord.isSee}
        </if>
        <if test="resumesCompensation!=null and resumesCompensation.length!=0">
            and
            <foreach collection="resumesCompensation" item="item" open="(" separator="or" close=")">
                r.resumes_compensation like concat("%",#{item},"%")
            </foreach>
        </if>
        <if test="resumesEducation!=null and resumesEducation.length!=0">
            and
            <foreach collection="resumesEducation" item="item" open="(" separator="or" close=")">
                r.resumes_education like concat("%",#{item},"%")
            </foreach>
        </if>
        <if test="resumesWorkExperience!=null and resumesWorkExperience.length!=0">
            and
            <foreach collection="resumesWorkExperience" item="item" open="(" separator="or" close=")">
                r.resumes_work_experience like concat("%",#{item},"%")
            </foreach>
        </if>
        <if test="industryName!=null and industryName.length!=0">
            and
            <foreach collection="industryName" item="item" open="(" separator="or" close=")">
                r.industry_name like concat("%",#{item},"%")
            </foreach>
        </if>
        order by s.update_time desc
    </select>
</mapper>