Files
shz-backend/ruoyi-bussiness/src/main/resources/mapper/app/InterviewInvitationMapper.xml
2026-07-20 19:09:12 +08:00

98 lines
5.6 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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.ruoyi.cms.mapper.InterviewInvitationMapper">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="InterviewInvitation" id="InterviewInvitationResult">
<result property="id" column="id"/>
<result property="companyId" column="company_id"/>
<result property="jobId" column="job_id"/>
<result property="userId" column="user_id"/>
<result property="applyId" column="apply_id"/>
<result property="interviewTime" column="interview_time"/>
<result property="interviewMethod" column="interview_method"/>
<result property="meetingLink" column="meeting_link"/>
<result property="meetingPassword" column="meeting_password"/>
<result property="interviewLocation" column="interview_location"/>
<result property="contactPhone" column="contact_phone"/>
<result property="interviewerName" column="interviewer_name"/>
<result property="companyName" column="company_name"/>
<result property="jobName" column="job_name"/>
<result property="status" column="status"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
<result property="isRead" column="is_read"/>
</resultMap>
<!-- VO 带公司名和岗位名继承基础映射jobTitle 来自关联查询的实时数据) -->
<resultMap type="com.ruoyi.cms.domain.vo.InterviewInvitationVO" id="InterviewInvitationVOResult" extends="InterviewInvitationResult">
<result property="jobTitle" column="job_title"/>
<result property="applicantName" column="applicant_name"/>
<result property="applicantPhone" column="applicant_phone"/>
</resultMap>
<sql id="selectInterviewInvitationVo">
select id, company_id, job_id, user_id, apply_id, interview_time,
interview_method, meeting_link, meeting_password, interview_location,
contact_phone, interviewer_name, company_name, job_name, status, del_flag,
create_by, create_time, update_by, update_time, remark,is_read
from interview_invitation
</sql>
<select id="getInterviewInvitationList" resultMap="InterviewInvitationResult" parameterType="InterviewInvitation">
<include refid="selectInterviewInvitationVo"/>
<where> del_flag = '0'
<if test="id != null and id != ''"> and id = #{id}</if>
<if test="companyId != null and companyId != ''"> and company_id = #{companyId}</if>
<if test="jobId != null and jobId != ''"> and job_id = #{jobId}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="applyId != null and applyId != ''"> and apply_id = #{applyId}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="isRead != null and isRead != ''"> and is_read = #{isRead}</if>
</where>
order by create_time desc
</select>
<!-- 带公司名和岗位名的列表查询COALESCE 优先用关联表实时数据,兜底用冗余存储 -->
<!-- 注意:不用 t.* 避免 company_name 列名冲突,显式列出除 company_name 外的所有列 -->
<select id="getInterviewInvitationVOList" resultMap="InterviewInvitationVOResult" parameterType="InterviewInvitation">
select t.id, t.company_id, t.job_id, t.user_id, t.apply_id,
t.interview_time, t.interview_method, t.meeting_link,
t.meeting_password, t.interview_location,
t.contact_phone, t.interviewer_name,
t.job_name, t.status, t.del_flag,t.is_read,
t.create_by, t.create_time, t.update_by, t.update_time, t.remark,
COALESCE(c.name, t.company_name) as company_name,
COALESCE(j.job_title, t.job_name) as job_title,
u.name as applicant_name,
u.phone as applicant_phone
from interview_invitation t
left join company c on c.company_id = t.company_id and c.del_flag = '0'
left join job j on j.job_id = t.job_id and j.del_flag = '0'
left join app_user u on u.user_id = t.user_id and u.del_flag = '0'
<where> t.del_flag = '0'
<if test="id != null and id != ''"> and t.id = #{id}</if>
<if test="companyId != null and companyId != ''"> and t.company_id = #{companyId}</if>
<if test="jobId != null and jobId != ''"> and t.job_id = #{jobId}</if>
<if test="userId != null and userId != ''"> and t.user_id = #{userId}</if>
<if test="applyId != null and applyId != ''"> and t.apply_id = #{applyId}</if>
<if test="status != null and status != ''"> and t.status = #{status}</if>
<if test="isRead != null and isRead != ''"> and t.is_read = #{isRead}</if>
</where>
order by t.create_time desc
</select>
<select id="selectMsyyhbs" resultType="com.ruoyi.cms.domain.vo.InviteCountDTO">
select count(1) total,sum(case when t.status='accepted' and is_show='0' then 1 else 0 END) jss,
sum(case when t.status='rejected' then 1 else 0 END) jjs from interview_invitation t
INNER join company cp on t.company_id=cp.company_id
where cp.code=#{idCard}
</select>
</mapper>