Blame view

JobDictMapper.xml 7.27 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?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,
涂亚平 committed
18 19 20 21
            t.company_id,
            t7.company_name,
            t7.company_logo,
            t.recruit_status,
涂亚平 committed
22 23
            t.start_salary,
            t.end_salary,
涂亚平 committed
24
            t4.city as province,
涂亚平 committed
25
            t3.city,
涂亚平 committed
26
            t.city_id,
涂亚平 committed
27
            t4.id as city_parent_id,
涂亚平 committed
28 29 30
            t.recruit_id,
            t.job_desc,
            t.job_requirement,
涂亚平 committed
31
            t2.recruit_type,
涂亚平 committed
32
            t5.id as position_id,
涂亚平 committed
33
            t6.id as parent_position_id,
涂亚平 committed
34 35
            t6.position_type AS parentType,
            t5.position_type AS sonType,
36
            t.job_id AS jobId
涂亚平 committed
37 38 39 40
        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
涂亚平 committed
41
            LEFT JOIN city_dict t4 ON t3.parent_id = t4.id
涂亚平 committed
42 43 44 45 46 47 48 49 50 51
            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
涂亚平 committed
52 53 54 55 56 57 58
        and t4.parent_id is null
        and t.job_type = #{jobType}
            <if test="recruitId.size>0">
                AND t.recruit_id in
                <foreach collection="recruitId" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
涂亚平 committed
59
            </if>
涂亚平 committed
60 61 62 63 64
            <if test="cityId.size>0">
                AND t.city_id IN
                <foreach collection="cityId" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
涂亚平 committed
65
            </if>
涂亚平 committed
66
            <if test="positions.size >0">
涂亚平 committed
67 68 69 70 71
                AND t.position_id IN
                <foreach collection="positions" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </if>
涂亚平 committed
72 73 74 75 76 77
            <if test="jobName != null and jobName != ''">
                AND ( t.`job_name` LIKE  concat('%', #{jobName}, '%') or t.enterprise_name like  concat('%', #{jobName}, '%'))
            </if>
            <if test="recruitStatus != null and recruitStatus != ''">
                and t.recruit_status = #{recruitStatus}
            </if>
涂亚平 committed
78 79 80 81 82 83 84
    </select>

    <select id="oneJob" parameterType="long" resultType="com.laowu.vo.job.OneJobVO">
         SELECT
            t.id,
            t.position_id,
            t.job_name,
涂亚平 committed
85
            t7.company_name,
涂亚平 committed
86 87
            t.start_salary,
            t.end_salary,
涂亚平 committed
88
            t4.city as province,
涂亚平 committed
89 90 91 92
            t3.city,
            t2.recruit_type,
            t6.position_type AS parentType,
            t5.position_type AS sonType,
93
            t.job_id AS jobId,
涂亚平 committed
94 95
            t.job_desc,
            t.job_requirement,
涂亚平 committed
96 97
            t7.company_desc,
            t.company_id
涂亚平 committed
98 99 100 101
        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
涂亚平 committed
102
            LEFT JOIN city_dict t4 ON t3.parent_id = t4.id
涂亚平 committed
103 104
            LEFT JOIN position_dict t5 ON t.position_id = t5.id
            LEFT JOIN position_dict t6 ON t5.parent_id = t6.id
涂亚平 committed
105
            left join company_dict t7 ON t.company_id = t7.id
涂亚平 committed
106 107 108 109 110 111 112
        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
涂亚平 committed
113
                    and t4.parent_id is null
涂亚平 committed
114 115 116 117 118 119 120 121 122 123
            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,
涂亚平 committed
124
        t4.city as province,
涂亚平 committed
125 126 127 128
        t3.city,
        t2.recruit_type,
        t6.position_type AS parentType,
        t5.position_type AS sonType,
129
        t.job_id AS jobId
涂亚平 committed
130 131 132 133
        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
涂亚平 committed
134
        LEFT JOIN city_dict t4 ON t3.parent_id = t4.id
涂亚平 committed
135 136 137 138 139 140 141 142 143 144
        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
涂亚平 committed
145 146
        and t4.parent_id is null
        and t.position_id =#{positionId}
涂亚平 committed
147 148 149 150 151 152 153 154 155 156
        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,
涂亚平 committed
157
            t4.city as province,
涂亚平 committed
158 159 160 161 162 163 164
            t3.city,
            t2.recruit_type,
            t6.position_type AS parentType,
            t5.position_type AS sonType,
            t.job_desc,
            t.start_salary,
            t.end_salary,
165
            t.job_id AS jobId
涂亚平 committed
166 167 168 169
        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
涂亚平 committed
170
            LEFT JOIN city_dict t4 ON t3.parent_id = t4.id
涂亚平 committed
171 172 173 174 175 176 177 178 179 180
            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
涂亚平 committed
181 182
        and t4.parent_id is null
        and t.job_type = #{jobType}
涂亚平 committed
183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203
            <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>