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>
|
2025-09-19 16:52:48 +08:00
|
|
|
<if test="auditUser != null">
|
|
|
|
|
audit_user = #{auditUserName},
|
|
|
|
|
</if>
|
|
|
|
|
audit_time = now()
|
2025-09-16 17:30:53 +08:00
|
|
|
</set>
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
2025-09-19 15:29:49 +08:00
|
|
|
<update id="updateTransferRecordFile">
|
|
|
|
|
UPDATE da_ky_transfer_file
|
|
|
|
|
SET file_name = #{fileName}
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
2025-09-25 17:43:24 +08:00
|
|
|
<update id="transferReceive">
|
|
|
|
|
UPDATE da_ky_transfer_file
|
|
|
|
|
SET receive_status = #{receiveStatus},
|
|
|
|
|
receive_time = now()
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
2025-09-25 17:55:19 +08:00
|
|
|
<update id="updateTransferStatus">
|
|
|
|
|
UPDATE da_ky_transfer_apply
|
|
|
|
|
SET transfer_status = '1'
|
|
|
|
|
WHERE id = #{transferApplyId}
|
|
|
|
|
</update>
|
2025-09-28 14:08:28 +08:00
|
|
|
<update id="updateTransferRecordFilesStatus">
|
|
|
|
|
UPDATE da_ky_transfer_file
|
|
|
|
|
SET transfer_status = #{transferStatus},
|
|
|
|
|
transfer_time = now()
|
|
|
|
|
WHERE id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
<update id="setTransferTime">
|
|
|
|
|
UPDATE da_ky_transfer_apply
|
|
|
|
|
SET transfer_time = now()
|
|
|
|
|
WHERE id = #{transferApplyId}
|
|
|
|
|
</update>
|
2025-09-28 15:52:07 +08:00
|
|
|
<update id="updateReceiveStatus">
|
|
|
|
|
UPDATE da_ky_transfer_apply
|
|
|
|
|
SET receive_status = '1'
|
|
|
|
|
WHERE id = #{transferApplyId}
|
|
|
|
|
</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
|
2025-09-19 11:10:21 +08:00
|
|
|
dkta.id,
|
|
|
|
|
dkta.pro_id AS proId,
|
|
|
|
|
dkta.pro_name AS proName,
|
|
|
|
|
dkta.single_pro_name AS singleProName,
|
|
|
|
|
dkta.dept_id AS deptId,
|
2025-09-28 15:09:40 +08:00
|
|
|
( SELECT CASE
|
|
|
|
|
WHEN
|
|
|
|
|
d.ancestors IS NULL
|
|
|
|
|
OR d.ancestors = '' THEN
|
|
|
|
|
d.dept_name ELSE CONCAT(
|
|
|
|
|
(SELECT
|
|
|
|
|
GROUP_CONCAT(
|
|
|
|
|
dt.dept_name
|
|
|
|
|
ORDER BY
|
|
|
|
|
INSTR(
|
|
|
|
|
CONCAT( ',', d.ancestors, ',' ),
|
|
|
|
|
CONCAT( ',', dt.dept_id, ',' )) SEPARATOR ' / ')
|
|
|
|
|
FROM
|
|
|
|
|
da_ky_sys_dept dt
|
|
|
|
|
WHERE
|
|
|
|
|
FIND_IN_SET( dt.dept_id, d.ancestors )),
|
|
|
|
|
' / ',
|
|
|
|
|
d.dept_name)
|
|
|
|
|
END
|
|
|
|
|
) AS deptName,
|
2025-09-19 11:10:21 +08:00
|
|
|
dkta.apply_user AS applyUser,
|
|
|
|
|
dkta.apply_time AS applyTime,
|
|
|
|
|
dkta.audit_status AS auditStatus,
|
2025-09-28 15:58:56 +08:00
|
|
|
dkta.receive_status AS receiveStatus,
|
2025-09-19 11:10:21 +08:00
|
|
|
dkta.audit_opinion AS auditOpinion,
|
|
|
|
|
dkta.transfer_status AS transferStatus,
|
|
|
|
|
dkta.transfer_time AS transferTime,
|
|
|
|
|
dkta.create_time AS createTime,
|
|
|
|
|
dkta.update_time AS updateTime,
|
|
|
|
|
dkta.create_user_id AS createUserId,
|
|
|
|
|
dkta.create_user_name AS createUserName,
|
|
|
|
|
dkta.update_user_name AS updateUserName,
|
|
|
|
|
dkta.update_user_id AS updateUserId,
|
|
|
|
|
dkta.del_flag AS delFlag
|
|
|
|
|
FROM da_ky_transfer_apply dkta
|
|
|
|
|
left join da_ky_project dkp on dkta.pro_id = dkp.id
|
2025-09-28 15:09:40 +08:00
|
|
|
LEFT JOIN da_ky_sys_dept d ON dkta.dept_id = d.dept_id AND d.del_flag = '0'
|
2025-09-19 11:10:21 +08:00
|
|
|
where dkta.del_flag = '1'
|
|
|
|
|
<if test="proName != null and proName != ''">
|
2025-09-28 15:16:29 +08:00
|
|
|
AND INSTR(dkta.pro_name, #{proName}) > 0
|
|
|
|
|
</if>
|
|
|
|
|
<if test="singleProName != null and singleProName != ''">
|
|
|
|
|
AND INSTR(dkta.single_pro_name, #{singleProName}) > 0
|
2025-09-19 11:10:21 +08:00
|
|
|
</if>
|
|
|
|
|
<if test="transfertTime != null and transfertTime != ''">
|
|
|
|
|
and DATE(dkta.transfer_time) = #{transfertTime}
|
|
|
|
|
</if>
|
2025-09-28 14:31:28 +08:00
|
|
|
<if test="deptIds != null">
|
|
|
|
|
AND dkta.dept_id IN
|
|
|
|
|
<foreach collection="deptIds" item="deptId" open="(" separator="," close=")">
|
|
|
|
|
#{deptId}
|
|
|
|
|
</foreach>
|
2025-09-15 15:43:00 +08:00
|
|
|
</if>
|
2025-09-19 11:10:21 +08:00
|
|
|
<if test="proType != null and proType != ''">
|
|
|
|
|
and dkp.pro_type = #{proType}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="voltageLevel != null and voltageLevel != ''">
|
|
|
|
|
and dkp.voltage_level = #{voltageLevel}
|
|
|
|
|
</if>
|
|
|
|
|
<if test="auditStatus != null and auditStatus != ''">
|
|
|
|
|
and dkta.audit_status = #{auditStatus}
|
|
|
|
|
</if>
|
|
|
|
|
ORDER BY dkta.create_time DESC
|
2025-09-15 15:43:00 +08:00
|
|
|
</select>
|
|
|
|
|
<select id="getTransferApply" resultType="com.bonus.web.domain.TransferApplyDto">
|
2025-09-28 10:05:24 +08:00
|
|
|
WITH RECURSIVE DeptTree AS (
|
|
|
|
|
SELECT
|
|
|
|
|
dept_id,
|
|
|
|
|
dept_name,
|
|
|
|
|
parent_id,
|
|
|
|
|
dept_name AS full_path,
|
|
|
|
|
0 AS level
|
|
|
|
|
FROM da_ky_sys_dept
|
|
|
|
|
WHERE dept_id = (SELECT dept_id FROM da_ky_transfer_apply WHERE id = #{id})
|
|
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
d.dept_id,
|
|
|
|
|
d.dept_name,
|
|
|
|
|
d.parent_id,
|
|
|
|
|
CONCAT(d.dept_name, ' / ', dt.full_path) AS full_path,
|
|
|
|
|
dt.level + 1
|
|
|
|
|
FROM da_ky_sys_dept d
|
|
|
|
|
INNER JOIN DeptTree dt ON d.dept_id = dt.parent_id
|
|
|
|
|
)
|
2025-09-15 15:43:00 +08:00
|
|
|
SELECT
|
2025-09-28 10:05:24 +08:00
|
|
|
dt.full_path AS deptName,
|
|
|
|
|
dkta.pro_name AS proName,
|
|
|
|
|
dkta.apply_user AS applyUser,
|
|
|
|
|
dkta.apply_time AS applyTime,
|
|
|
|
|
dkta.audit_user AS auditUser,
|
|
|
|
|
dkta.audit_time AS auditTime,
|
|
|
|
|
dkta.audit_opinion AS auditOpinion,
|
|
|
|
|
CASE dkta.audit_status
|
|
|
|
|
WHEN '0' THEN '待审批'
|
|
|
|
|
WHEN '1' THEN '审批通过'
|
|
|
|
|
WHEN '2' THEN '审批驳回'
|
|
|
|
|
ELSE ''
|
|
|
|
|
END AS auditStatus
|
|
|
|
|
FROM DeptTree dt
|
|
|
|
|
CROSS JOIN da_ky_transfer_apply dkta
|
|
|
|
|
WHERE dkta.del_flag = '1'
|
|
|
|
|
AND dkta.id = #{id}
|
|
|
|
|
AND dt.level = (SELECT MAX(level) FROM DeptTree)
|
2025-09-15 15:43:00 +08:00
|
|
|
</select>
|
2025-09-28 15:09:40 +08:00
|
|
|
<select id="getProSelect" resultType="com.bonus.web.domain.ProSelectDto">
|
2025-09-18 17:12:08 +08:00
|
|
|
SELECT
|
|
|
|
|
id,
|
2025-09-28 15:09:40 +08:00
|
|
|
single_pro_name AS name,
|
|
|
|
|
pro_name AS proName
|
2025-09-18 17:12:08 +08:00
|
|
|
FROM
|
|
|
|
|
da_ky_project
|
|
|
|
|
WHERE
|
|
|
|
|
del_flag = '1' and file_status = '1'
|
|
|
|
|
</select>
|
2025-09-15 15:43:00 +08:00
|
|
|
<select id="getTransferFile" resultType="com.bonus.web.domain.TransferFileDto">
|
|
|
|
|
SELECT
|
|
|
|
|
dkp.pro_name AS proName,
|
|
|
|
|
dkp.single_pro_name AS singleProName,
|
2025-09-25 17:29:33 +08:00
|
|
|
dktf.file_name AS fileName,
|
|
|
|
|
dktf.receive_status AS receiveStatus
|
2025-09-15 15:43:00 +08:00
|
|
|
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-18 17:12:08 +08:00
|
|
|
<select id="getDeptSelect" resultType="com.bonus.common.core.domain.entity.SysDept">
|
2025-09-18 17:27:49 +08:00
|
|
|
SELECT dept_id AS deptId,
|
|
|
|
|
parent_id AS parentId,
|
|
|
|
|
ancestors,
|
|
|
|
|
dept_name AS deptName,
|
|
|
|
|
order_num AS orderNum,
|
|
|
|
|
leader,
|
|
|
|
|
phone,
|
|
|
|
|
email,
|
|
|
|
|
status,
|
|
|
|
|
del_flag AS delFlag
|
|
|
|
|
FROM da_ky_sys_dept
|
|
|
|
|
WHERE del_flag = '0'
|
|
|
|
|
and status = '0'
|
|
|
|
|
</select>
|
2025-09-19 11:10:21 +08:00
|
|
|
<select id="getTransferApplyFilesContents" resultType="java.lang.String">
|
|
|
|
|
WITH RECURSIVE sub_tree AS (
|
|
|
|
|
SELECT
|
|
|
|
|
id,
|
|
|
|
|
pro_id,
|
|
|
|
|
level
|
|
|
|
|
FROM da_ky_pro_files_contents
|
|
|
|
|
WHERE id = #{id}
|
2025-09-19 13:57:10 +08:00
|
|
|
AND pro_id = #{proId}
|
2025-09-19 11:10:21 +08:00
|
|
|
|
|
|
|
|
UNION ALL
|
|
|
|
|
|
|
|
|
|
SELECT
|
|
|
|
|
c.id,
|
|
|
|
|
c.pro_id,
|
|
|
|
|
c.level
|
|
|
|
|
FROM da_ky_pro_files_contents c
|
|
|
|
|
INNER JOIN sub_tree st ON c.parent_id = st.id
|
|
|
|
|
WHERE c.level <= 4
|
2025-09-19 13:57:10 +08:00
|
|
|
AND c.pro_id = #{proId}
|
2025-09-19 11:10:21 +08:00
|
|
|
)
|
|
|
|
|
SELECT DISTINCT id
|
|
|
|
|
FROM sub_tree
|
|
|
|
|
WHERE level = 4
|
|
|
|
|
ORDER BY id
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getTransferApplyFiles" resultType="com.bonus.web.domain.DaKyProFilesContentsDto">
|
2025-09-19 14:24:28 +08:00
|
|
|
SELECT distinct
|
2025-09-19 11:10:21 +08:00
|
|
|
dkpfc.id AS id,
|
|
|
|
|
dkpfc.pro_id AS proId,
|
|
|
|
|
dkpfc.content_name AS contentName,
|
|
|
|
|
dkpfc.parent_id AS parentId,
|
|
|
|
|
dkpfc.LEVEL AS LEVEL,
|
|
|
|
|
dkpfc.sort AS sort,
|
|
|
|
|
dkpfc.mark_code AS markCode,
|
|
|
|
|
dkpfc.term AS term,
|
2025-09-19 11:30:40 +08:00
|
|
|
concat(dkpfc3.content_name,'/',dkpfc2.content_name) AS parParentName,
|
2025-09-19 11:31:02 +08:00
|
|
|
dkpfc1.content_name AS parentName,
|
2025-09-19 11:10:21 +08:00
|
|
|
dkpfc.unit_name AS unitName,
|
|
|
|
|
CASE
|
|
|
|
|
|
|
|
|
|
WHEN dkpfc.data_source = '1' THEN
|
|
|
|
|
'本系统上传'
|
|
|
|
|
WHEN dkpfc.data_source = '2' THEN
|
|
|
|
|
'智慧现场' ELSE ''
|
|
|
|
|
END AS dataSource,
|
|
|
|
|
dkpfc.is_unique AS isUnique,
|
|
|
|
|
dkpfc.integrity_status AS integrityStatus,
|
|
|
|
|
dkfs.id AS fileId,
|
|
|
|
|
dkfs.file_name AS fileName,
|
2025-09-19 13:20:12 +08:00
|
|
|
dkfs.file_path AS filePath,
|
2025-09-19 11:10:21 +08:00
|
|
|
dkfs.create_time AS createTime,
|
|
|
|
|
dkfs.source_file_name AS sourceFileName,
|
|
|
|
|
dkfs.create_user_name AS createUserName
|
|
|
|
|
FROM
|
|
|
|
|
da_ky_pro_files_contents dkpfc
|
2025-09-19 11:30:40 +08:00
|
|
|
left join da_ky_pro_files_contents dkpfc1 on dkpfc.parent_id = dkpfc1.id
|
|
|
|
|
left join da_ky_pro_files_contents dkpfc2 on dkpfc1.parent_id = dkpfc2.id
|
|
|
|
|
left join da_ky_pro_files_contents dkpfc3 on dkpfc2.parent_id = dkpfc3.id
|
2025-09-19 11:10:21 +08:00
|
|
|
LEFT JOIN da_ky_sys_file_source dkfs ON dkpfc.id = dkfs.business_id
|
|
|
|
|
LEFT JOIN da_ky_transfer_file fs ON dkfs.id = fs.file_source_id
|
|
|
|
|
WHERE
|
|
|
|
|
dkpfc.del_flag = '1'
|
|
|
|
|
AND dkpfc.parent_id = #{parentId}
|
|
|
|
|
AND dkpfc.pro_id = #{proId}
|
|
|
|
|
AND dkpfc.LEVEL = 5
|
|
|
|
|
AND NOT EXISTS ( SELECT 1 FROM da_ky_transfer_file tf WHERE tf.file_source_id = dkfs.id )
|
|
|
|
|
</select>
|
2025-09-19 13:20:12 +08:00
|
|
|
<select id="getTransferRecordFiles" resultType="com.bonus.web.domain.TransferFileDto">
|
2025-09-19 15:29:49 +08:00
|
|
|
SELECT DISTINCT
|
|
|
|
|
dktf.id,
|
|
|
|
|
dktf.file_name AS fileName,
|
|
|
|
|
CONCAT( dkpfc3.content_name, '/', dkpfc2.content_name ) AS parParentName,
|
2025-09-28 14:43:24 +08:00
|
|
|
dkpfc1.content_name AS parentName,
|
|
|
|
|
dktf.transfer_status AS transferStatus
|
2025-09-19 15:29:49 +08:00
|
|
|
FROM
|
|
|
|
|
da_ky_transfer_file dktf
|
|
|
|
|
LEFT JOIN da_ky_pro_files_contents dkpfc ON dktf.pro_files_contents_id = dkpfc.id
|
|
|
|
|
LEFT JOIN da_ky_pro_files_contents dkpfc1 ON dkpfc.parent_id = dkpfc1.id
|
|
|
|
|
LEFT JOIN da_ky_pro_files_contents dkpfc2 ON dkpfc1.parent_id = dkpfc2.id
|
|
|
|
|
LEFT JOIN da_ky_pro_files_contents dkpfc3 ON dkpfc2.parent_id = dkpfc3.id
|
|
|
|
|
WHERE
|
|
|
|
|
dktf.transfer_apply_id = #{transferApplyId}
|
2025-09-19 13:20:12 +08:00
|
|
|
</select>
|
2025-09-19 14:24:28 +08:00
|
|
|
<select id="getProNameById" resultType="java.lang.String">
|
|
|
|
|
SELECT
|
|
|
|
|
pro_name AS proName
|
|
|
|
|
FROM
|
|
|
|
|
da_ky_project
|
|
|
|
|
WHERE
|
|
|
|
|
id = #{id}
|
|
|
|
|
</select>
|
2025-09-19 15:47:55 +08:00
|
|
|
<select id="getTransferApplyFilesByApplyId" resultType="com.bonus.web.domain.DaKyProFilesContentsDto">
|
|
|
|
|
SELECT distinct
|
|
|
|
|
dkpfc.id AS id,
|
|
|
|
|
dkpfc.pro_id AS proId,
|
|
|
|
|
dkpfc.content_name AS contentName,
|
|
|
|
|
dkpfc.parent_id AS parentId,
|
|
|
|
|
dkpfc.LEVEL AS LEVEL,
|
|
|
|
|
dkpfc.sort AS sort,
|
|
|
|
|
dkpfc.mark_code AS markCode,
|
|
|
|
|
dkpfc.term AS term,
|
2025-09-19 16:19:11 +08:00
|
|
|
tfs.pro_name AS proName,
|
|
|
|
|
tfs.single_pro_name AS singleProName,
|
2025-09-19 16:24:42 +08:00
|
|
|
tfs.create_time AS createTime,
|
2025-09-19 15:47:55 +08:00
|
|
|
concat(dkpfc3.content_name,'/',dkpfc2.content_name) AS parParentName,
|
|
|
|
|
dkpfc1.content_name AS parentName,
|
|
|
|
|
dkpfc.unit_name AS unitName,
|
|
|
|
|
CASE
|
|
|
|
|
|
|
|
|
|
WHEN dkpfc.data_source = '1' THEN
|
|
|
|
|
'本系统上传'
|
|
|
|
|
WHEN dkpfc.data_source = '2' THEN
|
|
|
|
|
'智慧现场' ELSE ''
|
|
|
|
|
END AS dataSource,
|
|
|
|
|
dkpfc.is_unique AS isUnique,
|
|
|
|
|
dkpfc.integrity_status AS integrityStatus,
|
|
|
|
|
dkfs.id AS fileId,
|
|
|
|
|
dkfs.file_name AS fileName,
|
|
|
|
|
dkfs.file_path AS filePath,
|
|
|
|
|
dkfs.source_file_name AS sourceFileName,
|
|
|
|
|
dkfs.create_user_name AS createUserName
|
|
|
|
|
FROM
|
|
|
|
|
da_ky_pro_files_contents dkpfc
|
|
|
|
|
left join da_ky_pro_files_contents dkpfc1 on dkpfc.parent_id = dkpfc1.id
|
|
|
|
|
left join da_ky_pro_files_contents dkpfc2 on dkpfc1.parent_id = dkpfc2.id
|
|
|
|
|
left join da_ky_pro_files_contents dkpfc3 on dkpfc2.parent_id = dkpfc3.id
|
|
|
|
|
LEFT JOIN da_ky_sys_file_source dkfs ON dkpfc.id = dkfs.business_id
|
|
|
|
|
LEFT JOIN da_ky_transfer_file fs ON dkfs.id = fs.file_source_id
|
2025-09-19 16:19:11 +08:00
|
|
|
left join da_ky_transfer_apply tfs on tfs.id = fs.transfer_apply_id
|
2025-09-19 15:47:55 +08:00
|
|
|
WHERE
|
|
|
|
|
dkpfc.del_flag = '1' and
|
|
|
|
|
fs.transfer_apply_id = #{id}
|
|
|
|
|
AND dkpfc.LEVEL = 5
|
|
|
|
|
</select>
|
2025-09-25 17:43:24 +08:00
|
|
|
<select id="isAllReceive" resultType="java.lang.Integer">
|
|
|
|
|
SELECT
|
|
|
|
|
CASE
|
|
|
|
|
WHEN
|
|
|
|
|
COUNT(*) = SUM( CASE WHEN receive_status = '1' THEN 1 ELSE 0 END ) THEN
|
|
|
|
|
1 ELSE 0
|
|
|
|
|
END AS all_received
|
|
|
|
|
FROM
|
|
|
|
|
da_ky_transfer_file
|
|
|
|
|
WHERE
|
|
|
|
|
transfer_apply_id = #{transferApplyId}
|
|
|
|
|
</select>
|
2025-09-28 14:08:28 +08:00
|
|
|
<select id="getDeptList" resultType="java.lang.String">
|
2025-09-28 14:31:28 +08:00
|
|
|
SELECT
|
|
|
|
|
dept_id
|
|
|
|
|
FROM
|
|
|
|
|
da_ky_sys_dept
|
|
|
|
|
WHERE
|
|
|
|
|
del_flag = '0'
|
|
|
|
|
AND (
|
|
|
|
|
dept_id = #{deptId}
|
|
|
|
|
OR FIND_IN_SET( #{deptId}, ancestors )
|
|
|
|
|
)
|
2025-09-28 14:08:28 +08:00
|
|
|
</select>
|
|
|
|
|
<select id="getTransferApplyTransferTime" resultType="java.lang.String">
|
|
|
|
|
SELECT
|
|
|
|
|
transfer_time AS transferTime
|
|
|
|
|
FROM
|
|
|
|
|
da_ky_transfer_apply
|
|
|
|
|
WHERE
|
|
|
|
|
id = #{transferApplyId}
|
|
|
|
|
</select>
|
2025-09-28 14:31:28 +08:00
|
|
|
<select id="getAllTransferStatus" resultType="java.lang.Integer">
|
|
|
|
|
SELECT
|
|
|
|
|
CASE
|
|
|
|
|
WHEN
|
|
|
|
|
COUNT(*) = SUM( CASE WHEN transfer_status = '1' THEN 1 ELSE 0 END ) THEN
|
|
|
|
|
1 ELSE 0
|
|
|
|
|
END AS all_received
|
|
|
|
|
FROM
|
|
|
|
|
da_ky_transfer_file
|
|
|
|
|
WHERE
|
|
|
|
|
transfer_apply_id = #{transferApplyId}
|
|
|
|
|
</select>
|
2025-09-15 15:43:00 +08:00
|
|
|
|
|
|
|
|
</mapper>
|