JobDictMapper.xml 6.42 KB
<?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.laowu.mapper.JobDictMapper">

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, job_name, enterprise_name, province, city, recruit_id, start_salary, end_salary
    </sql>

    <select id="jobs" resultType="com.laowu.vo.job.JobVO">
        SELECT
            t.id,
            t.job_id,
            t.job_name,
            t.company_name,
            t.start_salary,
            t.end_salary,
            t4.province,
            t3.city,
            t2.recruit_type,
            t6.position_type AS parentType,
            t5.position_type AS sonType,
            CONCAT( t6.position_code, t5.position_code, t.job_id ) AS jobId
        FROM
            job_dict t
            LEFT JOIN recruit_dict t2 ON t.recruit_id = t2.id
            LEFT JOIN city_dict t3 ON t.city_id = t3.id
            LEFT JOIN province_dict t4 ON t3.province_id = t4.id
            LEFT JOIN position_dict t5 ON t.position_id = t5.id
            LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
            left join company_dict t7 ON t.company_id = t7.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL
            AND t5.delete_date IS NULL
            AND t6.delete_date IS NULL
            and t.job_type = #{jobType}
            <if test="recruitId != null and recruitId != ''">
                AND t.recruit_id = #{recruitId}
            </if>
            <if test="cityId != null and cityId != ''">
                AND t.city_id = #{cityId}
            </if>
            <if test="positions != null and positions != ''">
                AND t.position_id IN
                <foreach collection="positions" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </if>
    </select>

    <select id="oneJob" parameterType="long" resultType="com.laowu.vo.job.OneJobVO">
         SELECT
            t.id,
            t.position_id,
            t.job_name,
            t.company_name,
            t.start_salary,
            t.end_salary,
            t4.province,
            t3.city,
            t2.recruit_type,
            t6.position_type AS parentType,
            t5.position_type AS sonType,
            CONCAT( t6.position_code, t5.position_code, t.job_id ) AS jobId,
            t.job_desc,
            t.job_requirement,
            t.company_desc
        FROM
            job_dict t
            LEFT JOIN recruit_dict t2 ON t.recruit_id = t2.id
            LEFT JOIN city_dict t3 ON t.city_id = t3.id
            LEFT JOIN province_dict t4 ON t3.province_id = t4.id
            LEFT JOIN position_dict t5 ON t.position_id = t5.id
            LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
            left join company_name t7 ON t.company_name = t7.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL
            AND t5.delete_date IS NULL
            AND t6.delete_date IS NULL
            and t.id = #{id}
    </select>

    <select id="relativeJobs" resultType="com.laowu.vo.job.JobVO">
        SELECT
        t.id,
        t.job_name,
        t7.company_name,
        t.start_salary,
        t.end_salary,
        t4.province,
        t3.city,
        t2.recruit_type,
        t6.position_type AS parentType,
        t5.position_type AS sonType,
        CONCAT( t6.position_code, t5.position_code, t.job_id ) AS jobId
        FROM
        job_dict t
        LEFT JOIN recruit_dict t2 ON t.recruit_id = t2.id
        LEFT JOIN city_dict t3 ON t.city_id = t3.id
        LEFT JOIN province_dict t4 ON t3.province_id = t4.id
        LEFT JOIN position_dict t5 ON t.position_id = t5.id
        LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
        left JOIN company_dict t7 ON t.company_id = t7.id
        WHERE
        t.delete_date IS NULL
        AND t2.delete_date IS NULL
        AND t3.delete_date IS NULL
        AND t4.delete_date IS NULL
        AND t5.delete_date IS NULL
        AND t6.delete_date IS NULL
        t.position_id =#{positionId}
        limit  3
    </select>

    <select id="jobManagement" resultType="com.laowu.vo.job.JobManagementVO">
        SELECT
            t.id,
            t7.company_logo,
            t7.company_name,
            t.recruit_status,
            t.job_name,
            t4.province,
            t3.city,
            t2.recruit_type,
            t6.position_type AS parentType,
            t5.position_type AS sonType,
            t.job_desc,
            t.start_salary,
            t.end_salary,
            CONCAT( t6.position_code, t5.position_code, t.job_id ) AS jobId
        FROM
            job_dict t
            LEFT JOIN recruit_dict t2 ON t.recruit_id = t2.id
            LEFT JOIN city_dict t3 ON t.city_id = t3.id
            LEFT JOIN province_dict t4 ON t3.province_id = t4.id
            LEFT JOIN position_dict t5 ON t.position_id = t5.id
            LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
            left join company_dict t7 ON t.company_id = t7.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            AND t3.delete_date IS NULL
            AND t4.delete_date IS NULL
            AND t5.delete_date IS NULL
            AND t6.delete_date IS NULL
            and t.job_type = #{jobType}
            <if test="recruitStatus != null and recruitStatus != ''">
                and t.recruit_status = #{recruitStatus}
            </if>
            <if test="recruitId != null and recruitId != ''">
                AND t.recruit_id = #{recruitId}
            </if>
            <if test="cityId != null and cityId != ''">
                AND t.city_id = #{cityId}
            </if>
            <if test="jobName != null and jobName != ''">
                AND ( t.`job_name` LIKE  concat('%', #{jobName}, '%') or t.enterprise_name like  concat('%', #{jobName}, '%'))
            </if>
            <if test="positions != null and positions != ''">
                AND t.position_id IN
                <foreach collection="positions" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </if>
    </select>

</mapper>