198 lines
8.8 KiB
XML
198 lines
8.8 KiB
XML
<?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="org.jiayunet.mapper.RecruitAnnouncementMapper">
|
|
|
|
<resultMap id="RecruitAnnouncementStatisticsVoMap" type="org.jiayunet.pojo.vo.RecruitAnnouncementStatisticsVo">
|
|
<result column="day_count" property="dayCount"/>
|
|
<result column="month_count" property="monthCount"/>
|
|
<result column="total_count" property="totalCount"/>
|
|
</resultMap>
|
|
|
|
<!-- 查询最后更新时间:按id倒序取第一条的创建时间 -->
|
|
<select id="selectLastCreateTime" resultType="java.time.Instant">
|
|
SELECT create_time
|
|
FROM bg_recruit_announcement
|
|
ORDER BY id DESC
|
|
LIMIT 1
|
|
</select>
|
|
|
|
<!-- 统计公告数量:一次扫描算出日/月/累计三个计数,保证三个数字来自同一快照 -->
|
|
<select id="selectStatistics" resultMap="RecruitAnnouncementStatisticsVoMap">
|
|
SELECT
|
|
IFNULL(SUM(create_time <![CDATA[>=]]> #{dayStart}), 0) AS day_count,
|
|
IFNULL(SUM(create_time <![CDATA[>=]]> #{monthStart}), 0) AS month_count,
|
|
COUNT(*) AS total_count
|
|
FROM bg_recruit_announcement
|
|
</select>
|
|
|
|
<resultMap id="RecruitAnnouncementListItemVoMap" type="org.jiayunet.pojo.vo.RecruitAnnouncementListItemVo">
|
|
<id column="id" property="id"/>
|
|
<result column="company_id" property="companyId"/>
|
|
<result column="company_name" property="companyName"/>
|
|
<result column="logo_url" property="logoUrl"/>
|
|
<result column="title" property="title"/>
|
|
<result column="major_require" property="majorRequire"/>
|
|
<result column="apply_end_time" property="applyEndTime"/>
|
|
<result column="apply_end_desc" property="applyEndDesc"/>
|
|
</resultMap>
|
|
|
|
<!-- 分页查询公告列表:多值维度不在此取,由Java侧按id批量组装 -->
|
|
<select id="selectAnnouncementPage" resultMap="RecruitAnnouncementListItemVoMap">
|
|
SELECT
|
|
ra.id,
|
|
ra.company_id,
|
|
ra.company_name,
|
|
c.logo_url,
|
|
ra.title,
|
|
ra.major_require,
|
|
ra.apply_end_time,
|
|
ra.apply_end_desc
|
|
FROM bg_recruit_announcement ra
|
|
INNER JOIN bg_company c ON ra.company_id = c.id
|
|
WHERE c.status = 1 AND ra.status = 1 and ra.clean_status = 1
|
|
<!-- 关键字:公司名称 / 招聘岗位 -->
|
|
<if test="keyword != null and keyword.length() > 0">
|
|
AND (
|
|
ra.company_name LIKE CONCAT('%', #{keyword}, '%')
|
|
OR ra.recruit_position LIKE CONCAT('%', #{keyword}, '%')
|
|
)
|
|
</if>
|
|
<!-- 筛选条件:发布时间区间 -->
|
|
<if test="publishTimeStart != null">
|
|
AND ra.publish_time <![CDATA[>]]> #{publishTimeStart}
|
|
</if>
|
|
<if test="publishTimeEnd != null">
|
|
AND ra.publish_time <![CDATA[<=]]> #{publishTimeEnd}
|
|
</if>
|
|
<!-- 筛选条件:投递截止时间区间 -->
|
|
<if test="applyEndTimeStart != null">
|
|
AND ra.apply_end_time <![CDATA[>]]> #{applyEndTimeStart}
|
|
</if>
|
|
<if test="applyEndTimeEnd != null">
|
|
AND ra.apply_end_time <![CDATA[<=]]> #{applyEndTimeEnd}
|
|
</if>
|
|
<!-- 筛选条件:公司类型 -->
|
|
<if test="companyTypes != null and companyTypes.size() > 0">
|
|
AND c.company_type IN
|
|
<foreach collection="companyTypes" item="type" open="(" separator="," close=")">
|
|
#{type}
|
|
</foreach>
|
|
</if>
|
|
<!-- 筛选条件:学历要求 -->
|
|
<if test="educationNames != null and educationNames.size() > 0">
|
|
AND ra.id IN (
|
|
SELECT rae.announcement_id
|
|
FROM bg_recruit_announcement_education rae
|
|
WHERE rae.education_name IN
|
|
<foreach collection="educationNames" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<!-- 筛选条件:招聘届数 -->
|
|
<if test="recruitYears != null and recruitYears.size() > 0">
|
|
AND ra.id IN (
|
|
SELECT ray.announcement_id
|
|
FROM bg_recruit_announcement_year ray
|
|
WHERE ray.recruit_year IN
|
|
<foreach collection="recruitYears" item="year" open="(" separator="," close=")">
|
|
#{year}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<!-- 筛选条件:批次 -->
|
|
<if test="batchNames != null and batchNames.size() > 0">
|
|
AND ra.id IN (
|
|
SELECT rab.announcement_id
|
|
FROM bg_recruit_announcement_batch rab
|
|
WHERE rab.batch_name IN
|
|
<foreach collection="batchNames" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<!-- 筛选条件:岗位大类 -->
|
|
<if test="categoryNames != null and categoryNames.size() > 0">
|
|
AND ra.id IN (
|
|
SELECT rac.announcement_id
|
|
FROM bg_recruit_announcement_category rac
|
|
WHERE rac.category_name IN
|
|
<foreach collection="categoryNames" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<!-- 筛选条件:热招城市 -->
|
|
<if test="cityNames != null and cityNames.size() > 0">
|
|
AND ra.id IN (
|
|
SELECT ract.announcement_id
|
|
FROM bg_recruit_announcement_city ract
|
|
WHERE ract.city_name IN
|
|
<foreach collection="cityNames" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<!-- 筛选条件:行业 -->
|
|
<if test="industryNames != null and industryNames.size() > 0">
|
|
AND ra.id IN (
|
|
SELECT rai.announcement_id
|
|
FROM bg_recruit_announcement_industry rai
|
|
WHERE rai.industry_name IN
|
|
<foreach collection="industryNames" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
<!-- 筛选条件:标签 -->
|
|
<if test="tagNames != null and tagNames.size() > 0">
|
|
AND ra.id IN (
|
|
SELECT rat.announcement_id
|
|
FROM bg_recruit_announcement_tag rat
|
|
WHERE rat.tag_name IN
|
|
<foreach collection="tagNames" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
)
|
|
</if>
|
|
ORDER BY ra.id DESC
|
|
</select>
|
|
|
|
<!-- 分页查询推荐公告:命中任一行业或任一岗位大类 -->
|
|
<select id="selectRecommendPage" resultMap="RecruitAnnouncementListItemVoMap">
|
|
SELECT
|
|
ra.id,
|
|
ra.company_name,
|
|
c.logo_url
|
|
FROM bg_recruit_announcement ra
|
|
INNER JOIN bg_company c ON ra.company_id = c.id
|
|
WHERE c.status = 1
|
|
AND ra.status = 1
|
|
AND ra.clean_status = 1
|
|
<!-- 命中任一维度:UNION合并两个维度的公告id,外层保持单个可半连接的IN -->
|
|
AND ra.id IN (
|
|
<trim prefixOverrides="UNION">
|
|
<if test="industryNames != null and industryNames.size() > 0">
|
|
SELECT rai.announcement_id
|
|
FROM bg_recruit_announcement_industry rai
|
|
WHERE rai.industry_name IN
|
|
<foreach collection="industryNames" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
</if>
|
|
<if test="categoryNames != null and categoryNames.size() > 0">
|
|
UNION
|
|
SELECT rac.announcement_id
|
|
FROM bg_recruit_announcement_category rac
|
|
WHERE rac.category_name IN
|
|
<foreach collection="categoryNames" item="name" open="(" separator="," close=")">
|
|
#{name}
|
|
</foreach>
|
|
</if>
|
|
</trim>
|
|
)
|
|
ORDER BY ra.id DESC
|
|
</select>
|
|
|
|
</mapper>
|