smart_archives_service/bonus-admin/src/main/resources/mapper/TransferApplyMapper.xml

356 lines
9.4 KiB
XML
Raw Normal View History

2025-09-15 15:43:00 +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.bonus.web.mapper.TransferApplyMapper">
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO da_ky_transfer_apply
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="proId != null and proId != ''">
pro_id,
</if>
<if test="proName != null and proName != ''">
pro_name,
</if>
<if test="singleProName != null and singleProName != ''">
single_pro_name,
</if>
<if test="deptId != null and deptId != ''">
dept_id,
</if>
<if test="deptName != null and deptName != ''">
dept_name,
</if>
<if test="applyUser != null and applyUser != ''">
apply_user,
</if>
<if test="applyTime != null">
apply_time,
</if>
<if test="auditStatus != null and auditStatus != ''">
audit_status,
</if>
<if test="auditOpinion != null and auditOpinion != ''">
audit_opinion,
</if>
<if test="transferStatus != null and transferStatus != ''">
transfer_status,
</if>
<if test="transferTime != null and transferTime != ''">
transfer_time,
</if>
<if test="createUserId != null">
create_user_id,
</if>
<if test="createUserName != null and createUserName != ''">
create_user_name,
</if>
<if test="updateUserName != null and updateUserName != ''">
update_user_name,
</if>
<if test="updateUserId != null">
update_user_id,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="proId != null and proId != ''">
#{proId},
</if>
<if test="proName != null and proName != ''">
#{proName},
</if>
<if test="singleProName != null and singleProName != ''">
#{singleProName},
</if>
<if test="deptId != null and deptId != ''">
#{deptId},
</if>
<if test="deptName != null and deptName != ''">
#{deptName},
</if>
<if test="applyUser != null and applyUser != ''">
#{applyUser},
</if>
<if test="applyTime != null">
#{applyTime},
</if>
<if test="auditStatus != null and auditStatus != ''">
#{auditStatus},
</if>
<if test="auditOpinion != null and auditOpinion != ''">
#{auditOpinion},
</if>
<if test="transferStatus != null and transferStatus != ''">
#{transferStatus},
</if>
<if test="transferTime != null and transferTime != ''">
#{transferTime},
</if>
<if test="createUserId != null">
#{createUserId},
</if>
<if test="createUserName != null and createUserName != ''">
#{createUserName},
</if>
<if test="updateUserName != null and updateUserName != ''">
#{updateUserName},
</if>
<if test="updateUserId != null">
#{updateUserId},
</if>
</trim>
</insert>
<insert id="insertTransferFile">
INSERT INTO da_ky_transfer_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="transferApplyId != null">
transfer_apply_id,
</if>
<if test="proFilesContentsId != null and proFilesContentsId != ''">
pro_files_contents_id,
</if>
<if test="proId != null and proId != ''">
pro_id,
</if>
<if test="fileSourceId != null">
file_source_id,
</if>
<if test="fileName != null and fileName != ''">
file_name,
</if>
<if test="filePath != null and filePath != ''">
file_path,
</if>
<if test="transferStatus != null and transferStatus != ''">
transfer_status,
</if>
<if test="transferTime != null">
transfer_time,
</if>
<if test="receiveStatus != null and receiveStatus != ''">
receive_status,
</if>
<if test="receiveTime != null">
receive_time,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="transferApplyId != null">
#{transferApplyId},
</if>
<if test="proFilesContentsId != null and proFilesContentsId != ''">
#{proFilesContentsId},
</if>
<if test="proId != null and proId != ''">
#{proId},
</if>
<if test="fileSourceId != null">
#{fileSourceId},
</if>
<if test="fileName != null and fileName != ''">
#{fileName},
</if>
<if test="filePath != null and filePath != ''">
#{filePath},
</if>
<if test="transferStatus != null and transferStatus != ''">
#{transferStatus},
</if>
<if test="transferTime != null">
#{transferTime},
</if>
<if test="receiveStatus != null and receiveStatus != ''">
#{receiveStatus},
</if>
<if test="receiveTime != null">
#{receiveTime},
</if>
</trim>
</insert>
2025-09-16 17:30:53 +08:00
<insert id="addTransferAuditRecord">
INSERT INTO da_ky_transfer_audit_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
transfer_apply_id,
</if>
<if test="auditStatus != null and auditStatus != ''">
audit_status,
</if>
<if test="auditOpinion != null and auditOpinion != ''">
audit_option,
</if>
<if test="auditUser != null">
audit_user_id,
</if>
<if test="auditUserName != null and auditUserName != ''">
audit_user_name,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id},
</if>
<if test="auditStatus != null and auditStatus != ''">
#{auditStatus},
</if>
<if test="auditOpinion != null and auditOpinion != ''">
#{auditOpinion},
</if>
<if test="auditUser != null">
#{auditUser},
</if>
<if test="auditUserName != null and auditUserName != ''">
#{auditUserName},
</if>
</trim>
</insert>
2025-09-15 15:43:00 +08:00
<update id="edit">
UPDATE da_ky_transfer_apply
<set>
<if test="proId != null and proId != ''">
pro_id = #{proId},
</if>
<if test="proName != null and proName != ''">
pro_name = #{proName},
</if>
<if test="singleProName != null and singleProName != ''">
single_pro_name = #{singleProName},
</if>
<if test="deptId != null and deptId != ''">
dept_id = #{deptId},
</if>
<if test="deptName != null and deptName != ''">
dept_name = #{deptName},
</if>
<if test="applyUser != null and applyUser != ''">
apply_user = #{applyUser},
</if>
<if test="applyTime != null">
apply_time = #{applyTime},
</if>
<if test="auditStatus != null and auditStatus != ''">
audit_status = #{auditStatus},
</if>
<if test="auditOpinion != null and auditOpinion != ''">
audit_opinion = #{auditOpinion},
</if>
<if test="transferStatus != null and transferStatus != ''">
transfer_status = #{transferStatus},
</if>
<if test="transferTime != null and transferTime != ''">
transfer_time = #{transferTime},
</if>
<if test="updateUserName != null and updateUserName != ''">
update_user_name = #{updateUserName},
</if>
<if test="updateUserId != null">
update_user_id = #{updateUserId},
</if>
<if test="delFlag != null and delFlag != ''">
del_flag = #{delFlag},
</if>
</set>
WHERE id = #{id}
</update>
2025-09-16 17:30:53 +08:00
<update id="audit">
UPDATE da_ky_transfer_apply
<set>
<if test="auditStatus != null and auditStatus != ''">
audit_status = #{auditStatus},
</if>
<if test="auditOpinion != null and auditOpinion != ''">
audit_opinion = #{auditOpinion},
</if>
</set>
WHERE id = #{id}
</update>
2025-09-15 15:43:00 +08:00
<delete id="delTransferFiles">
DELETE FROM da_ky_transfer_file
WHERE transfer_apply_id = #{id}
</delete>
<delete id="del">
DELETE FROM da_ky_transfer_apply
WHERE id = #{id}
</delete>
<select id="list" resultType="com.bonus.web.domain.TransferApplyDto">
SELECT
id,
pro_id AS proId,
pro_name AS proName,
single_pro_name AS singleProName,
dept_id AS deptId,
dept_name AS deptName,
apply_user AS applyUser,
apply_time AS applyTime,
audit_status AS auditStatus,
audit_opinion AS auditOpinion,
transfer_status AS transferStatus,
transfer_time AS transferTime,
create_time AS createTime,
update_time AS updateTime,
create_user_id AS createUserId,
create_user_name AS createUserName,
update_user_name AS updateUserName,
update_user_id AS updateUserId,
del_flag AS delFlag
FROM da_ky_transfer_apply
where del_flag = '1'
<if test="proId != null and proId != ''">
and pro_id = #{proId}
</if>
ORDER BY create_time DESC
</select>
<select id="getTransferApply" resultType="com.bonus.web.domain.TransferApplyDto">
SELECT
dept_name AS deptName,
pro_name AS proName,
apply_user AS applyUser,
apply_time AS applyTime,
audit_user AS auditUser,
audit_time AS auditTime,
audit_opinion AS auditOpinion,
case audit_status when '0' then '待审批'
when '1' then '审批通过'
when '2' then '审批驳回'
else '' end AS auditStatus
FROM da_ky_transfer_apply
where del_flag = '1' and id = #{id}
</select>
<select id="getTransferFile" resultType="com.bonus.web.domain.TransferFileDto">
SELECT
dkp.pro_name AS proName,
dkp.single_pro_name AS singleProName,
dktf.file_name AS fileName
FROM da_ky_transfer_file dktf
left join da_ky_project dkp on dkp.id = dktf.pro_id
where dktf.transfer_apply_id = #{id}
</select>
2025-09-16 17:30:53 +08:00
<select id="getDeptSelect" resultType="com.bonus.web.domain.SelectDto">
SELECT
dept_id AS id,
dept_name AS name
FROM
da_ky_sys_dept
WHERE
del_flag = '0'
AND LENGTH(ancestors) - LENGTH(REPLACE(ancestors, ',', '')) + 1 = 3
</select>
2025-09-18 16:28:14 +08:00
<select id="getProSelect" resultType="com.bonus.web.domain.SelectDto">
SELECT
id,
pro_name AS name
FROM
da_ky_project
WHERE
del_flag = '0' and file_status = '1'
</select>
2025-09-15 15:43:00 +08:00
</mapper>