Files
shz-backend/ruoyi-bussiness/src/main/resources/mapper/app/InterviewInvitationMapper.xml

89 lines
5.0 KiB
XML
Raw Normal View History

2026-06-24 09:31:29 +08:00
<?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"/>
2026-06-25 13:32:37 +08:00
<result property="interviewerName" column="interviewer_name"/>
2026-06-24 18:18:55 +08:00
<result property="companyName" column="company_name"/>
<result property="jobName" column="job_name"/>
2026-06-24 09:31:29 +08:00
<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"/>
2026-07-15 18:48:32 +08:00
<result property="isRead" column="is_read"/>
2026-06-24 09:31:29 +08:00
</resultMap>
2026-06-24 18:18:55 +08:00
<!-- VO 带公司名和岗位名继承基础映射jobTitle 来自关联查询的实时数据) -->
<resultMap type="com.ruoyi.cms.domain.vo.InterviewInvitationVO" id="InterviewInvitationVOResult" extends="InterviewInvitationResult">
<result property="jobTitle" column="job_title"/>
2026-06-25 13:32:37 +08:00
<result property="applicantName" column="applicant_name"/>
<result property="applicantPhone" column="applicant_phone"/>
2026-06-24 18:18:55 +08:00
</resultMap>
2026-06-24 09:31:29 +08:00
<sql id="selectInterviewInvitationVo">
select id, company_id, job_id, user_id, apply_id, interview_time,
interview_method, meeting_link, meeting_password, interview_location,
2026-06-25 13:32:37 +08:00
contact_phone, interviewer_name, company_name, job_name, status, del_flag,
2026-07-15 18:48:32 +08:00
create_by, create_time, update_by, update_time, remark,is_read
2026-06-24 09:31:29 +08:00
from interview_invitation
</sql>
<select id="getInterviewInvitationList" resultMap="InterviewInvitationResult" parameterType="InterviewInvitation">
<include refid="selectInterviewInvitationVo"/>
<where> del_flag = '0'
2026-06-30 00:04:01 +08:00
<if test="id != null and id != ''"> and id = #{id}</if>
2026-06-24 09:31:29 +08:00
<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>
</where>
order by create_time desc
</select>
2026-06-24 18:18:55 +08:00
<!-- 带公司名和岗位名的列表查询COALESCE 优先用关联表实时数据,兜底用冗余存储 -->
<!-- 注意:不用 t.* 避免 company_name 列名冲突,显式列出除 company_name 外的所有列 -->
2026-06-24 18:18:55 +08:00
<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.create_by, t.create_time, t.update_by, t.update_time, t.remark,
2026-06-24 18:18:55 +08:00
COALESCE(c.name, t.company_name) as company_name,
2026-06-25 13:32:37 +08:00
COALESCE(j.job_title, t.job_name) as job_title,
u.name as applicant_name,
u.phone as applicant_phone
2026-06-24 18:18:55 +08:00
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'
2026-06-25 13:32:37 +08:00
left join app_user u on u.user_id = t.user_id and u.del_flag = '0'
2026-06-24 18:18:55 +08:00
<where> t.del_flag = '0'
2026-06-30 00:04:01 +08:00
<if test="id != null and id != ''"> and t.id = #{id}</if>
2026-06-24 18:18:55 +08:00
<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>
</where>
order by t.create_time desc
</select>
2026-06-24 09:31:29 +08:00
</mapper>