621 lines
36 KiB
XML
621 lines
36 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.dromara.rs.mapper.RsOverseasApplicationMapper">
|
|
|
|
<resultMap type="RsOverseasApplication" id="RsOverseasApplicationResult">
|
|
<id property="applicationId" column="application_id"/>
|
|
<result property="serialNumber" column="serial_number"/>
|
|
<result property="applicantId" column="applicant_id"/>
|
|
<result property="applicantName" column="applicant_name"/>
|
|
<result property="gender" column="gender"/>
|
|
<result property="birthDate" column="birth_date"/>
|
|
<result property="photo" column="photo"/>
|
|
<result property="idNumber" column="id_number"/>
|
|
<result property="politicalStatus" column="political_status"/>
|
|
<result property="registeredAddress" column="registered_address"/>
|
|
<result property="department" column="department"/>
|
|
<result property="position" column="position"/>
|
|
<result property="professionalTitle" column="professional_title"/>
|
|
<result property="administrativeLevel" column="administrative_level"/>
|
|
<result property="personnelCategory" column="personnel_category"/>
|
|
<result property="registrationUnit" column="registration_unit"/>
|
|
<result property="unitLeaderSignature" column="unit_leader_signature"/>
|
|
<result property="officePhone" column="office_phone"/>
|
|
<result property="mobilePhone" column="mobile_phone"/>
|
|
<result property="contactPhone" column="contact_phone"/>
|
|
<result property="contactEmail" column="contact_email"/>
|
|
<result property="documentName" column="document_name"/>
|
|
<result property="documentNumber" column="document_number"/>
|
|
<result property="destinationCountry" column="destination_country"/>
|
|
<result property="exitReason" column="exit_reason"/>
|
|
<result property="visitRelationship" column="visit_relationship"/>
|
|
<result property="remarks" column="remarks"/>
|
|
<result property="purpose" column="purpose"/>
|
|
<result property="purposeDetail" column="purpose_detail"/>
|
|
<result property="destination" column="destination"/>
|
|
<result property="destinationCity" column="destination_city"/>
|
|
<result property="startDate" column="start_date"/>
|
|
<result property="endDate" column="end_date"/>
|
|
<result property="duration" column="duration"/>
|
|
<result property="invitation" column="invitation"/>
|
|
<result property="itinerary" column="itinerary"/>
|
|
<result property="accommodationPlan" column="accommodation_plan"/>
|
|
<result property="transportationPlan" column="transportation_plan"/>
|
|
<result property="status" column="status"/>
|
|
<result property="approvalStatus" column="approval_status"/>
|
|
<result property="currentApprover" column="current_approver"/>
|
|
<result property="approvalLevel" column="approval_level"/>
|
|
<result property="applyTime" column="apply_time"/>
|
|
<result property="approvalTime" column="approval_time"/>
|
|
<result property="adminRemark" column="admin_remark"/>
|
|
<result property="applicantRemark" column="applicant_remark"/>
|
|
<result property="emergencyContact" column="emergency_contact"/>
|
|
<result property="attachmentIds" column="attachment_ids"/>
|
|
<result property="signature" column="signature"/>
|
|
<result property="stampedRegistrationFilePath" column="stamped_registration_file_path"/>
|
|
<result property="stampedRegistrationFileName" column="stamped_registration_file_name"/>
|
|
<result property="stampedFileOssId" column="stamped_file_oss_id"/>
|
|
<result property="stampedFileUploadTime" column="stamped_file_upload_time"/>
|
|
<result property="stampedFileUploadStatus" column="stamped_file_upload_status"/>
|
|
<result property="partyRetentionFilePath" column="party_retention_file_path"/>
|
|
<result property="partyRetentionFileName" column="party_retention_file_name"/>
|
|
<result property="partyRetentionUploadTime" column="party_retention_upload_time"/>
|
|
<result property="partyRetentionUploadStatus" column="party_retention_upload_status"/>
|
|
<result property="partyRetentionFileOssId" column="party_retention_file_oss_id"/>
|
|
<result property="tenantId" column="tenant_id"/>
|
|
<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="deleted" column="deleted"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="RsOverseasApplicationVoResult" type="org.dromara.rs.domain.vo.RsOverseasApplicationVo" extends="RsOverseasApplicationResult">
|
|
<result property="statusText" column="status_text"/>
|
|
<result property="approvalStatusText" column="approval_status_text"/>
|
|
<result property="taskId" column="task_id"/>
|
|
<result property="purposeText" column="purpose_text"/>
|
|
<result property="approvalLevelText" column="approval_level_text"/>
|
|
<result property="genderText" column="gender_text"/>
|
|
<result property="politicalStatusText" column="political_status_text"/>
|
|
<result property="administrativeLevelText" column="administrative_level_text"/>
|
|
<result property="personnelCategoryText" column="personnel_category_text"/>
|
|
</resultMap>
|
|
|
|
<sql id="selectOverseasApplicationVo">
|
|
select oa.application_id, oa.serial_number, oa.applicant_id, oa.applicant_name,
|
|
oa.gender, oa.birth_date, oa.photo, oa.id_number, oa.political_status, oa.registered_address,
|
|
oa.department, oa.position, oa.professional_title, oa.administrative_level, oa.personnel_category,
|
|
oa.registration_unit, oa.unit_leader_signature, oa.office_phone, oa.mobile_phone,
|
|
oa.contact_phone, oa.contact_email, oa.document_name, oa.document_number,
|
|
oa.destination_country, oa.exit_reason, oa.visit_relationship, oa.remarks,
|
|
oa.purpose, oa.purpose_detail, oa.destination, oa.destination_city,
|
|
oa.start_date, oa.end_date, oa.duration, oa.invitation, oa.itinerary,
|
|
oa.accommodation_plan, oa.transportation_plan, oa.status, oa.approval_status, oa.current_approver, oa.approval_level,
|
|
oa.apply_time, oa.approval_time, oa.admin_remark, oa.applicant_remark,
|
|
oa.emergency_contact, oa.attachment_ids, oa.signature,
|
|
oa.stamped_registration_file_path, oa.stamped_registration_file_name,
|
|
oa.stamped_file_upload_time, oa.stamped_file_upload_status, oa.stamped_file_oss_id,
|
|
oa.party_retention_file_path, oa.party_retention_file_name,
|
|
oa.party_retention_upload_time, oa.party_retention_upload_status, oa.party_retention_file_oss_id,
|
|
oa.tenant_id, oa.create_by, oa.create_time, oa.update_by, oa.update_time, oa.deleted,
|
|
CASE
|
|
WHEN oa.status IS NULL OR oa.status = '' THEN '草稿'
|
|
WHEN oa.status = '0' THEN '待审核'
|
|
WHEN oa.status = '1' THEN '已通过'
|
|
WHEN oa.status = '2' THEN '已拒绝'
|
|
WHEN oa.status = '3' THEN '已取消'
|
|
WHEN oa.status = '4' THEN '已完成'
|
|
ELSE '未知状态'
|
|
END as status_text,
|
|
CASE
|
|
WHEN oa.approval_status IS NULL OR oa.approval_status = '' THEN '草稿'
|
|
WHEN oa.approval_status = 'draft' THEN '草稿'
|
|
WHEN oa.approval_status = 'waiting' THEN '待审批'
|
|
WHEN oa.approval_status = 'finish' THEN '已完成'
|
|
WHEN oa.approval_status = 'cancel' THEN '已取消'
|
|
WHEN oa.approval_status = 'back' THEN '已退回'
|
|
ELSE '未知状态'
|
|
END as approval_status_text,
|
|
CASE oa.purpose
|
|
WHEN 'academic_exchange' THEN '学术交流'
|
|
WHEN 'conference' THEN '学术会议'
|
|
WHEN 'training' THEN '培训学习'
|
|
WHEN 'cooperation' THEN '合作项目'
|
|
WHEN 'research' THEN '科研访问'
|
|
WHEN 'other' THEN '其他'
|
|
ELSE oa.purpose
|
|
END as purpose_text,
|
|
CASE oa.approval_level
|
|
WHEN '1' THEN '部门负责人'
|
|
WHEN '2' THEN '人事处'
|
|
WHEN '3' THEN '纪委'
|
|
WHEN '4' THEN '学院分管领导'
|
|
WHEN '5' THEN '学院党委书记'
|
|
ELSE '未知级别'
|
|
END as approval_level_text,
|
|
CASE oa.gender
|
|
WHEN '0' THEN '男'
|
|
WHEN '1' THEN '女'
|
|
ELSE '未知'
|
|
END as gender_text,
|
|
CASE oa.political_status
|
|
WHEN '1' THEN '中共党员'
|
|
WHEN '2' THEN '中共预备党员'
|
|
WHEN '3' THEN '共青团员'
|
|
WHEN '4' THEN '民革党员'
|
|
WHEN '5' THEN '民盟盟员'
|
|
WHEN '6' THEN '民建会员'
|
|
WHEN '7' THEN '民进会员'
|
|
WHEN '8' THEN '农工党党员'
|
|
WHEN '9' THEN '致公党党员'
|
|
WHEN '10' THEN '九三学社社员'
|
|
WHEN '11' THEN '台盟盟员'
|
|
WHEN '12' THEN '无党派人士'
|
|
WHEN '13' THEN '群众'
|
|
ELSE oa.political_status
|
|
END as political_status_text,
|
|
CASE oa.administrative_level
|
|
WHEN '0' THEN '无'
|
|
WHEN '1' THEN '一级巡视员'
|
|
WHEN '2' THEN '二级巡视员'
|
|
WHEN '3' THEN '一级调研员'
|
|
WHEN '4' THEN '二级调研员'
|
|
WHEN '5' THEN '三级调研员'
|
|
WHEN '6' THEN '四级调研员'
|
|
WHEN '7' THEN '一级主任科员'
|
|
WHEN '8' THEN '二级主任科员'
|
|
WHEN '9' THEN '三级主任科员'
|
|
WHEN '10' THEN '四级主任科员'
|
|
WHEN '11' THEN '一级科员'
|
|
WHEN '12' THEN '二级科员'
|
|
ELSE oa.administrative_level
|
|
END as administrative_level_text,
|
|
CASE oa.personnel_category
|
|
WHEN '1' THEN '1-厅局级'
|
|
WHEN '2' THEN '2-县处级'
|
|
WHEN '3' THEN '3-乡科级'
|
|
WHEN '4' THEN '4-一般干部'
|
|
WHEN '5' THEN '5-其他重要岗位人员'
|
|
ELSE oa.personnel_category
|
|
END as personnel_category_text,
|
|
ft.id as task_id
|
|
from rs_overseas_application oa
|
|
<!-- 🔴 关联工作流任务表:查询当前用户的待办任务ID(用于前端显示审批按钮) -->
|
|
LEFT JOIN (
|
|
SELECT t.id, i.business_id
|
|
FROM flow_task t
|
|
INNER JOIN flow_instance i ON t.instance_id = i.id
|
|
WHERE t.del_flag = '0'
|
|
AND i.del_flag = '0'
|
|
AND t.node_type = 1
|
|
) ft ON CAST(ft.business_id AS SIGNED) = oa.application_id
|
|
</sql>
|
|
|
|
<select id="selectOverseasApplicationList" parameterType="org.dromara.rs.domain.query.RsOverseasApplicationQuery" resultMap="RsOverseasApplicationVoResult">
|
|
<include refid="selectOverseasApplicationVo"/>
|
|
<where>
|
|
oa.deleted = '0'
|
|
<if test="applicantName != null and applicantName != ''">
|
|
AND oa.applicant_name like concat('%', #{applicantName}, '%')
|
|
</if>
|
|
<if test="department != null and department != ''">
|
|
AND oa.department like concat('%', #{department}, '%')
|
|
</if>
|
|
<if test="purpose != null and purpose != ''">
|
|
AND oa.purpose = #{purpose}
|
|
</if>
|
|
<if test="exitReason != null and exitReason != ''">
|
|
AND oa.exit_reason = #{exitReason}
|
|
</if>
|
|
<if test="destination != null and destination != ''">
|
|
AND oa.destination like concat('%', #{destination}, '%')
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
AND oa.status = #{status}
|
|
</if>
|
|
<if test="approvalLevel != null and approvalLevel != ''">
|
|
AND oa.approval_level = #{approvalLevel}
|
|
</if>
|
|
<if test="currentApprover != null and currentApprover != ''">
|
|
AND oa.current_approver like concat('%', #{currentApprover}, '%')
|
|
</if>
|
|
<if test="applicantId != null">
|
|
AND oa.applicant_id = #{applicantId}
|
|
</if>
|
|
<if test="applyTimeBegin != null">
|
|
AND oa.apply_time >= #{applyTimeBegin}
|
|
</if>
|
|
<if test="applyTimeEnd != null">
|
|
AND oa.apply_time <= #{applyTimeEnd}
|
|
</if>
|
|
<if test="startDateBegin != null">
|
|
AND oa.start_date >= #{startDateBegin}
|
|
</if>
|
|
<if test="startDateEnd != null">
|
|
AND oa.start_date <= #{startDateEnd}
|
|
</if>
|
|
<if test="tenantId != null and tenantId != ''">
|
|
AND oa.tenant_id = #{tenantId}
|
|
</if>
|
|
<!-- 🔴 新增:部门负责人权限过滤 - 只能查看本部门员工提交的申请 -->
|
|
<if test="applicantDeptId != null">
|
|
AND EXISTS (
|
|
SELECT 1 FROM sys_user u
|
|
WHERE u.user_id = oa.applicant_id
|
|
AND u.dept_id = #{applicantDeptId}
|
|
AND u.del_flag = '0'
|
|
)
|
|
</if>
|
|
</where>
|
|
order by oa.apply_time desc, oa.create_time desc
|
|
</select>
|
|
|
|
<select id="selectMyOverseasApplicationList" parameterType="org.dromara.rs.domain.query.RsOverseasApplicationQuery" resultMap="RsOverseasApplicationVoResult">
|
|
<include refid="selectOverseasApplicationVo"/>
|
|
<where>
|
|
oa.deleted = '0'
|
|
<!-- 排除已通过的申请(status='1'),已通过的申请显示在出国记录中 -->
|
|
AND oa.status != '1'
|
|
<if test="applicantName != null and applicantName != ''">
|
|
AND oa.applicant_name like concat('%', #{applicantName}, '%')
|
|
</if>
|
|
<if test="department != null and department != ''">
|
|
AND oa.department like concat('%', #{department}, '%')
|
|
</if>
|
|
<if test="purpose != null and purpose != ''">
|
|
AND oa.purpose = #{purpose}
|
|
</if>
|
|
<if test="exitReason != null and exitReason != ''">
|
|
AND oa.exit_reason = #{exitReason}
|
|
</if>
|
|
<if test="destination != null and destination != ''">
|
|
AND oa.destination like concat('%', #{destination}, '%')
|
|
</if>
|
|
<if test="status != null and status != ''">
|
|
AND oa.status = #{status}
|
|
</if>
|
|
<if test="approvalLevel != null and approvalLevel != ''">
|
|
AND oa.approval_level = #{approvalLevel}
|
|
</if>
|
|
<if test="currentApprover != null and currentApprover != ''">
|
|
AND oa.current_approver like concat('%', #{currentApprover}, '%')
|
|
</if>
|
|
<if test="applicantId != null">
|
|
AND oa.applicant_id = #{applicantId}
|
|
</if>
|
|
<if test="applyTimeBegin != null">
|
|
AND oa.apply_time >= #{applyTimeBegin}
|
|
</if>
|
|
<if test="applyTimeEnd != null">
|
|
AND oa.apply_time <= #{applyTimeEnd}
|
|
</if>
|
|
<if test="startDateBegin != null">
|
|
AND oa.start_date >= #{startDateBegin}
|
|
</if>
|
|
<if test="startDateEnd != null">
|
|
AND oa.start_date <= #{startDateEnd}
|
|
</if>
|
|
<if test="tenantId != null and tenantId != ''">
|
|
AND oa.tenant_id = #{tenantId}
|
|
</if>
|
|
</where>
|
|
order by oa.apply_time desc, oa.create_time desc
|
|
</select>
|
|
|
|
|
|
<select id="selectOverseasApplicationById" parameterType="Long" resultMap="RsOverseasApplicationVoResult">
|
|
<include refid="selectOverseasApplicationVo"/>
|
|
where oa.application_id = #{applicationId} and oa.deleted = '0'
|
|
</select>
|
|
|
|
<select id="selectOverseasApplicationsByApplicantId" parameterType="Long" resultMap="RsOverseasApplicationVoResult">
|
|
<include refid="selectOverseasApplicationVo"/>
|
|
where oa.applicant_id = #{applicantId} and oa.deleted = '0'
|
|
order by oa.apply_time desc
|
|
</select>
|
|
|
|
<select id="selectOverseasApplicationsByStatus" parameterType="String" resultMap="RsOverseasApplicationVoResult">
|
|
<include refid="selectOverseasApplicationVo"/>
|
|
where oa.status = #{status} and oa.deleted = '0'
|
|
order by oa.apply_time desc
|
|
</select>
|
|
|
|
<select id="selectPendingApplicationsByApprover" parameterType="String" resultMap="RsOverseasApplicationVoResult">
|
|
<include refid="selectOverseasApplicationVo"/>
|
|
where oa.current_approver = #{currentApprover} and oa.status = '0' and oa.deleted = '0'
|
|
order by oa.apply_time asc
|
|
</select>
|
|
|
|
<select id="selectPendingApplicationsByLevel" parameterType="String" resultMap="RsOverseasApplicationVoResult">
|
|
<include refid="selectOverseasApplicationVo"/>
|
|
where oa.approval_level = #{approvalLevel} and oa.status = '0' and oa.deleted = '0'
|
|
order by oa.apply_time asc
|
|
</select>
|
|
|
|
<!-- 插入出国申请 - 包含所有字段 -->
|
|
<insert id="insertOverseasApplication" parameterType="RsOverseasApplication" useGeneratedKeys="true" keyProperty="applicationId">
|
|
insert into rs_overseas_application
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="serialNumber != null and serialNumber != ''">serial_number,</if>
|
|
<if test="applicantId != null">applicant_id,</if>
|
|
<if test="applicantName != null and applicantName != ''">applicant_name,</if>
|
|
<if test="gender != null and gender != ''">gender,</if>
|
|
<if test="birthDate != null">birth_date,</if>
|
|
<if test="photo != null and photo != ''">photo,</if>
|
|
<if test="idNumber != null and idNumber != ''">id_number,</if>
|
|
<if test="politicalStatus != null and politicalStatus != ''">political_status,</if>
|
|
<if test="registeredAddress != null and registeredAddress != ''">registered_address,</if>
|
|
<if test="department != null and department != ''">department,</if>
|
|
<if test="position != null and position != ''">position,</if>
|
|
<if test="professionalTitle != null and professionalTitle != ''">professional_title,</if>
|
|
<if test="administrativeLevel != null and administrativeLevel != ''">administrative_level,</if>
|
|
<if test="personnelCategory != null and personnelCategory != ''">personnel_category,</if>
|
|
<if test="registrationUnit != null and registrationUnit != ''">registration_unit,</if>
|
|
<if test="unitLeaderSignature != null and unitLeaderSignature != ''">unit_leader_signature,</if>
|
|
<if test="officePhone != null and officePhone != ''">office_phone,</if>
|
|
<if test="mobilePhone != null and mobilePhone != ''">mobile_phone,</if>
|
|
<if test="contactPhone != null and contactPhone != ''">contact_phone,</if>
|
|
<if test="contactEmail != null and contactEmail != ''">contact_email,</if>
|
|
<if test="documentName != null and documentName != ''">document_name,</if>
|
|
<if test="documentNumber != null and documentNumber != ''">document_number,</if>
|
|
<if test="destinationCountry != null and destinationCountry != ''">destination_country,</if>
|
|
<if test="exitReason != null and exitReason != ''">exit_reason,</if>
|
|
<if test="visitRelationship != null and visitRelationship != ''">visit_relationship,</if>
|
|
<if test="remarks != null and remarks != ''">remarks,</if>
|
|
<if test="purpose != null and purpose != ''">purpose,</if>
|
|
<if test="purposeDetail != null and purposeDetail != ''">purpose_detail,</if>
|
|
<if test="destination != null and destination != ''">destination,</if>
|
|
<if test="destinationCity != null and destinationCity != ''">destination_city,</if>
|
|
<if test="startDate != null">start_date,</if>
|
|
<if test="endDate != null">end_date,</if>
|
|
<if test="duration != null">duration,</if>
|
|
<if test="invitation != null and invitation != ''">invitation,</if>
|
|
<if test="itinerary != null and itinerary != ''">itinerary,</if>
|
|
<if test="accommodationPlan != null and accommodationPlan != ''">accommodation_plan,</if>
|
|
<if test="transportationPlan != null and transportationPlan != ''">transportation_plan,</if>
|
|
<if test="status != null and status != ''">status,</if>
|
|
<if test="currentApprover != null and currentApprover != ''">current_approver,</if>
|
|
<if test="approvalLevel != null and approvalLevel != ''">approval_level,</if>
|
|
<if test="applyTime != null">apply_time,</if>
|
|
<if test="approvalTime != null">approval_time,</if>
|
|
<if test="adminRemark != null and adminRemark != ''">admin_remark,</if>
|
|
<if test="applicantRemark != null and applicantRemark != ''">applicant_remark,</if>
|
|
<if test="emergencyContact != null">emergency_contact,</if>
|
|
<if test="signature != null and signature != ''">signature,</if>
|
|
<if test="stampedRegistrationFilePath != null and stampedRegistrationFilePath != ''">stamped_registration_file_path,</if>
|
|
<if test="stampedRegistrationFileName != null and stampedRegistrationFileName != ''">stamped_registration_file_name,</if>
|
|
<if test="stampedFileUploadTime != null">stamped_file_upload_time,</if>
|
|
<if test="stampedFileUploadStatus != null and stampedFileUploadStatus != ''">stamped_file_upload_status,</if>
|
|
<if test="tenantId != null and tenantId != ''">tenant_id,</if>
|
|
<if test="deleted != null and deleted != ''">deleted,</if>
|
|
<if test="createBy != null">create_by,</if>
|
|
<if test="createTime != null">create_time,</if>
|
|
<if test="updateBy != null">update_by,</if>
|
|
<if test="updateTime != null">update_time,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="serialNumber != null and serialNumber != ''">#{serialNumber},</if>
|
|
<if test="applicantId != null">#{applicantId},</if>
|
|
<if test="applicantName != null and applicantName != ''">#{applicantName},</if>
|
|
<if test="gender != null and gender != ''">#{gender},</if>
|
|
<if test="birthDate != null">#{birthDate},</if>
|
|
<if test="photo != null and photo != ''">#{photo},</if>
|
|
<if test="idNumber != null and idNumber != ''">#{idNumber},</if>
|
|
<if test="politicalStatus != null and politicalStatus != ''">#{politicalStatus},</if>
|
|
<if test="registeredAddress != null and registeredAddress != ''">#{registeredAddress},</if>
|
|
<if test="department != null and department != ''">#{department},</if>
|
|
<if test="position != null and position != ''">#{position},</if>
|
|
<if test="professionalTitle != null and professionalTitle != ''">#{professionalTitle},</if>
|
|
<if test="administrativeLevel != null and administrativeLevel != ''">#{administrativeLevel},</if>
|
|
<if test="personnelCategory != null and personnelCategory != ''">#{personnelCategory},</if>
|
|
<if test="registrationUnit != null and registrationUnit != ''">#{registrationUnit},</if>
|
|
<if test="unitLeaderSignature != null and unitLeaderSignature != ''">#{unitLeaderSignature},</if>
|
|
<if test="officePhone != null and officePhone != ''">#{officePhone},</if>
|
|
<if test="mobilePhone != null and mobilePhone != ''">#{mobilePhone},</if>
|
|
<if test="contactPhone != null and contactPhone != ''">#{contactPhone},</if>
|
|
<if test="contactEmail != null and contactEmail != ''">#{contactEmail},</if>
|
|
<if test="documentName != null and documentName != ''">#{documentName},</if>
|
|
<if test="documentNumber != null and documentNumber != ''">#{documentNumber},</if>
|
|
<if test="destinationCountry != null and destinationCountry != ''">#{destinationCountry},</if>
|
|
<if test="exitReason != null and exitReason != ''">#{exitReason},</if>
|
|
<if test="visitRelationship != null and visitRelationship != ''">#{visitRelationship},</if>
|
|
<if test="remarks != null and remarks != ''">#{remarks},</if>
|
|
<if test="purpose != null and purpose != ''">#{purpose},</if>
|
|
<if test="purposeDetail != null and purposeDetail != ''">#{purposeDetail},</if>
|
|
<if test="destination != null and destination != ''">#{destination},</if>
|
|
<if test="destinationCity != null and destinationCity != ''">#{destinationCity},</if>
|
|
<if test="startDate != null">#{startDate},</if>
|
|
<if test="endDate != null">#{endDate},</if>
|
|
<if test="duration != null">#{duration},</if>
|
|
<if test="invitation != null and invitation != ''">#{invitation},</if>
|
|
<if test="itinerary != null and itinerary != ''">#{itinerary},</if>
|
|
<if test="accommodationPlan != null and accommodationPlan != ''">#{accommodationPlan},</if>
|
|
<if test="transportationPlan != null and transportationPlan != ''">#{transportationPlan},</if>
|
|
<if test="status != null and status != ''">#{status},</if>
|
|
<if test="currentApprover != null and currentApprover != ''">#{currentApprover},</if>
|
|
<if test="approvalLevel != null and approvalLevel != ''">#{approvalLevel},</if>
|
|
<if test="applyTime != null">#{applyTime},</if>
|
|
<if test="approvalTime != null">#{approvalTime},</if>
|
|
<if test="adminRemark != null and adminRemark != ''">#{adminRemark},</if>
|
|
<if test="applicantRemark != null and applicantRemark != ''">#{applicantRemark},</if>
|
|
<if test="emergencyContact != null">#{emergencyContact},</if>
|
|
<if test="signature != null and signature != ''">#{signature},</if>
|
|
<if test="stampedRegistrationFilePath != null and stampedRegistrationFilePath != ''">#{stampedRegistrationFilePath},</if>
|
|
<if test="stampedRegistrationFileName != null and stampedRegistrationFileName != ''">#{stampedRegistrationFileName},</if>
|
|
<if test="stampedFileUploadTime != null">#{stampedFileUploadTime},</if>
|
|
<if test="stampedFileUploadStatus != null and stampedFileUploadStatus != ''">#{stampedFileUploadStatus},</if>
|
|
<if test="tenantId != null and tenantId != ''">#{tenantId},</if>
|
|
<if test="deleted != null and deleted != ''">#{deleted},</if>
|
|
<if test="createBy != null">#{createBy},</if>
|
|
<if test="createTime != null">#{createTime},</if>
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<!-- 更新出国申请 - 包含所有字段 -->
|
|
<update id="updateOverseasApplication" parameterType="RsOverseasApplication">
|
|
update rs_overseas_application
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="serialNumber != null and serialNumber != ''">serial_number = #{serialNumber},</if>
|
|
<if test="applicantId != null">applicant_id = #{applicantId},</if>
|
|
<if test="applicantName != null and applicantName != ''">applicant_name = #{applicantName},</if>
|
|
<if test="gender != null and gender != ''">gender = #{gender},</if>
|
|
<if test="birthDate != null">birth_date = #{birthDate},</if>
|
|
<if test="photo != null">photo = #{photo},</if>
|
|
<if test="idNumber != null">id_number = #{idNumber},</if>
|
|
<if test="politicalStatus != null and politicalStatus != ''">political_status = #{politicalStatus},</if>
|
|
<if test="registeredAddress != null">registered_address = #{registeredAddress},</if>
|
|
<if test="department != null and department != ''">department = #{department},</if>
|
|
<if test="position != null">position = #{position},</if>
|
|
<if test="professionalTitle != null">professional_title = #{professionalTitle},</if>
|
|
<if test="administrativeLevel != null">administrative_level = #{administrativeLevel},</if>
|
|
<if test="personnelCategory != null">personnel_category = #{personnelCategory},</if>
|
|
<if test="registrationUnit != null">registration_unit = #{registrationUnit},</if>
|
|
<if test="unitLeaderSignature != null">unit_leader_signature = #{unitLeaderSignature},</if>
|
|
<if test="officePhone != null">office_phone = #{officePhone},</if>
|
|
<if test="mobilePhone != null">mobile_phone = #{mobilePhone},</if>
|
|
<if test="contactPhone != null">contact_phone = #{contactPhone},</if>
|
|
<if test="contactEmail != null">contact_email = #{contactEmail},</if>
|
|
<if test="documentName != null">document_name = #{documentName},</if>
|
|
<if test="documentNumber != null">document_number = #{documentNumber},</if>
|
|
<if test="destinationCountry != null">destination_country = #{destinationCountry},</if>
|
|
<if test="exitReason != null">exit_reason = #{exitReason},</if>
|
|
<if test="visitRelationship != null">visit_relationship = #{visitRelationship},</if>
|
|
<if test="remarks != null">remarks = #{remarks},</if>
|
|
<if test="purpose != null">purpose = #{purpose},</if>
|
|
<if test="purposeDetail != null">purpose_detail = #{purposeDetail},</if>
|
|
<if test="destination != null">destination = #{destination},</if>
|
|
<if test="destinationCity != null">destination_city = #{destinationCity},</if>
|
|
<if test="startDate != null">start_date = #{startDate},</if>
|
|
<if test="endDate != null">end_date = #{endDate},</if>
|
|
<if test="duration != null">duration = #{duration},</if>
|
|
<if test="invitation != null">invitation = #{invitation},</if>
|
|
<if test="itinerary != null">itinerary = #{itinerary},</if>
|
|
<if test="accommodationPlan != null">accommodation_plan = #{accommodationPlan},</if>
|
|
<if test="transportationPlan != null">transportation_plan = #{transportationPlan},</if>
|
|
<if test="status != null and status != ''">status = #{status},</if>
|
|
<if test="currentApprover != null">current_approver = #{currentApprover},</if>
|
|
<if test="approvalLevel != null">approval_level = #{approvalLevel},</if>
|
|
<if test="applyTime != null">apply_time = #{applyTime},</if>
|
|
<if test="approvalTime != null">approval_time = #{approvalTime},</if>
|
|
<if test="adminRemark != null">admin_remark = #{adminRemark},</if>
|
|
<if test="applicantRemark != null">applicant_remark = #{applicantRemark},</if>
|
|
<if test="emergencyContact != null">emergency_contact = #{emergencyContact},</if>
|
|
<if test="signature != null">signature = #{signature},</if>
|
|
<if test="stampedRegistrationFilePath != null">stamped_registration_file_path = #{stampedRegistrationFilePath},</if>
|
|
<if test="stampedRegistrationFileName != null">stamped_registration_file_name = #{stampedRegistrationFileName},</if>
|
|
<if test="stampedFileUploadTime != null">stamped_file_upload_time = #{stampedFileUploadTime},</if>
|
|
<if test="stampedFileUploadStatus != null">stamped_file_upload_status = #{stampedFileUploadStatus},</if>
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
</trim>
|
|
where application_id = #{applicationId}
|
|
</update>
|
|
|
|
<!-- 删除出国申请(逻辑删除) -->
|
|
<update id="deleteOverseasApplicationById" parameterType="Long">
|
|
update rs_overseas_application set deleted = '1' where application_id = #{applicationId}
|
|
</update>
|
|
|
|
<!-- 批量删除出国申请(逻辑删除) -->
|
|
<update id="deleteOverseasApplicationByIds" parameterType="Long">
|
|
update rs_overseas_application set deleted = '1' where application_id in
|
|
<foreach item="applicationId" collection="array" open="(" separator="," close=")">
|
|
#{applicationId}
|
|
</foreach>
|
|
</update>
|
|
|
|
<!-- 🔧 新增:查询申请人的部门ID -->
|
|
<select id="selectApplicantDeptId" parameterType="Long" resultType="Long">
|
|
SELECT u.dept_id
|
|
FROM sys_user u
|
|
WHERE u.user_id = #{applicantId}
|
|
AND u.deleted = '0'
|
|
</select>
|
|
|
|
<!-- 🔧 新增:根据部门ID查询部门负责人ID -->
|
|
<select id="selectDeptHeadByDeptId" parameterType="Long" resultType="Long">
|
|
SELECT d.leader
|
|
FROM sys_dept d
|
|
WHERE d.dept_id = #{deptId}
|
|
AND d.deleted = '0'
|
|
AND d.status = '0'
|
|
AND d.leader IS NOT NULL
|
|
</select>
|
|
|
|
<!-- 🔧 新增:查询上级部门负责人ID -->
|
|
<select id="selectParentDeptHead" parameterType="Long" resultType="Long">
|
|
SELECT parent_dept.leader
|
|
FROM sys_dept current_dept
|
|
INNER JOIN sys_dept parent_dept ON current_dept.parent_id = parent_dept.dept_id
|
|
WHERE current_dept.dept_id = #{deptId}
|
|
AND current_dept.deleted = '0'
|
|
AND parent_dept.deleted = '0'
|
|
AND parent_dept.status = '0'
|
|
AND parent_dept.leader IS NOT NULL
|
|
</select>
|
|
|
|
<!-- 🔧 新增:根据用户ID查询用户姓名 -->
|
|
<select id="selectUserNameById" parameterType="Long" resultType="String">
|
|
SELECT u.nick_name
|
|
FROM sys_user u
|
|
WHERE u.user_id = #{userId}
|
|
AND u.deleted = '0'
|
|
</select>
|
|
|
|
<!-- 🔧 新增:根据权限标识查询拥有该权限的用户ID列表 -->
|
|
<select id="selectUserIdsByPermission" parameterType="String" resultType="Long">
|
|
SELECT DISTINCT u.user_id
|
|
FROM sys_user u
|
|
INNER JOIN sys_user_role ur ON u.user_id = ur.user_id
|
|
INNER JOIN sys_role r ON ur.role_id = r.role_id
|
|
INNER JOIN sys_role_menu rm ON r.role_id = rm.role_id
|
|
INNER JOIN sys_menu m ON rm.menu_id = m.menu_id
|
|
WHERE m.perms = #{permissionCode}
|
|
AND m.del_flag = '0'
|
|
AND m.status = '0'
|
|
AND r.del_flag = '0'
|
|
AND r.status = '0'
|
|
AND u.deleted = '0'
|
|
AND u.status = '0'
|
|
ORDER BY u.user_name ASC, u.create_time DESC
|
|
</select>
|
|
|
|
<!-- 🔧 新增:根据用户ID查询其拥有的出国审批权限列表 -->
|
|
<select id="selectApprovalPermissionsByUserId" parameterType="Long" resultType="String">
|
|
SELECT DISTINCT m.perms
|
|
FROM sys_menu m
|
|
INNER JOIN sys_role_menu rm ON m.menu_id = rm.menu_id
|
|
INNER JOIN sys_role r ON rm.role_id = r.role_id
|
|
INNER JOIN sys_user_role ur ON r.role_id = ur.role_id
|
|
WHERE ur.user_id = #{userId}
|
|
AND m.perms LIKE 'rs:overseas:approve%'
|
|
AND m.status = '0'
|
|
AND r.del_flag = '0'
|
|
AND r.status = '0'
|
|
ORDER BY m.perms, m.create_time DESC
|
|
</select>
|
|
|
|
<!-- 🔴 新增:查询待审批申请列表(支持部门过滤) -->
|
|
<select id="selectPendingApplications" resultType="org.dromara.rs.domain.RsOverseasApplication">
|
|
SELECT a.*
|
|
FROM rs_overseas_application a
|
|
INNER JOIN sys_user u ON a.applicant_id = u.user_id
|
|
WHERE a.status = '0'
|
|
AND a.deleted = '0'
|
|
AND a.approval_level IN
|
|
<foreach collection="approvalLevels" item="level" open="(" separator="," close=")">
|
|
#{level}
|
|
</foreach>
|
|
<!-- 🔴 关键:部门过滤逻辑(仅对部门负责人生效) -->
|
|
<if test="deptId != null">
|
|
AND u.dept_id = #{deptId}
|
|
</if>
|
|
ORDER BY a.apply_time DESC, a.create_time DESC
|
|
</select>
|
|
|
|
</mapper> |