Blame view

JobDictMapper.xml 6.42 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
<?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>