Files
fad_oa/ruoyi-oa/src/main/resources/mapper/oa/OaProjectScheduleStepMapper.xml

215 lines
8.1 KiB
XML
Raw Normal View History

2025-05-08 20:42:58 +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.oa.mapper.OaProjectScheduleStepMapper">
<resultMap id="OaProjectScheduleStepResult"
type="com.ruoyi.oa.domain.vo.OaProjectScheduleStepVo" >
<!-- 主键最好用 <id/>,以便 MyBatis 去重 -->
<id property="trackId" column="track_id"/>
<!-- ========== 原有字段 ========= -->
<result property="accessory" column="accessory"/>
<result property="scheduleId" column="schedule_id"/>
<result property="stepOrder" column="step_order"/>
<result property="stepName" column="step_name"/>
<result property="planStart" column="plan_start"/>
<result property="planEnd" column="plan_end"/>
<result property="actualStart" column="actual_start"/>
<result property="actualEnd" column="actual_end"/>
<result property="status" column="status"/>
<result property="expectedDays" column="expected_days"/>
<result property="useFlag" column="use_flag"/>
<result property="header" column="header"/>
<result property="tabNode" column="tab_node"/>
<result property="firstLevelNode" column="first_level_node"/>
<result property="secondLevelNode" column="second_level_node"/>
<result property="startTime" column="start_time"/>
<result property="originalEndTime" column="original_end_time"/>
<result property="endTime" column="end_time"/>
<result property="nodeHeader" column="node_header"/>
<result property="relatedDocs" column="related_docs"/>
<result property="relatedImages" column="related_images"/>
<result property="specification" column="specification"/>
2025-05-08 20:42:58 +08:00
<!-- ========== 附件列表:多对一 折叠 ========= -->
<collection property="fileList"
ofType="com.ruoyi.system.domain.SysOss"
javaType="java.util.ArrayList">
<result property="ossId" column="oss_id"/>
2025-05-08 20:42:58 +08:00
<result property="url" column="attach_url"/>
<result property="fileName" column="attach_file_name"/>
<result property="createBy" column="create_by"/>
<result property="isPublic" column="is_public"/>
<result property="ownerId" column="owner_id"/>
2025-05-08 20:42:58 +08:00
</collection>
</resultMap>
<sql id="OssVisibleCondition">
( so.is_public = 1
OR so.owner_id = #{userId}
OR EXISTS (SELECT 1 FROM sys_oss_acl a
WHERE a.oss_id = so.oss_id
AND a.user_id = #{userId}) )
</sql>
<insert id="saveBatch">
INSERT INTO oa_project_schedule_step (
schedule_id,
step_order,
step_name,
tab_node,
first_level_node,
second_level_node,
specification,
sort_num
) VALUES
<foreach item="item" index="index" collection="list" separator=",">
(
#{item.scheduleId},
#{item.stepOrder},
#{item.stepName},
#{item.tabNode},
#{item.firstLevelNode},
#{item.secondLevelNode},
#{item.specification},
#{item.sortNum}
)
</foreach>
</insert>
2025-05-08 20:42:58 +08:00
<update id="updateByStepAndScheduleId">
UPDATE oa_project_schedule_step
SET
status = 1,
actual_end = NOW()
WHERE
schedule_id = #{scheduleId}
AND step_order = #{currentStep}
AND del_flag = '0'
and use_flag = '1'
2025-05-08 20:42:58 +08:00
</update>
<delete id="deleteByScheduleIds">
DELETE FROM oa_project_schedule_step
WHERE schedule_id IN
<foreach collection="scheduleIds" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
2025-05-08 20:42:58 +08:00
<select id="maxStepByScheduleId" resultMap="OaProjectScheduleStepResult">
SELECT opss.track_id,
opss.accessory,
opss.schedule_id,
opss.step_order,
opss.step_name,
opss.plan_start,
opss.plan_end,
opss.actual_start,
opss.actual_end,
opss.status,
opss.del_flag,
opss.header,
opss.use_flag,
2025-05-08 20:42:58 +08:00
osts.expected_days,
osts.description
FROM oa_project_schedule_step opss
LEFT JOIN fad_oa.oa_project_schedule ops ON ops.schedule_id = opss.schedule_id
LEFT JOIN fad_oa.oa_schedule_template_step osts ON osts.template_id = ops.template_id AND osts.step_order = opss.step_order
WHERE opss.schedule_id = #{scheduleId}
AND opss.del_flag = '0'
and opss.use_flag = '1'
2025-05-08 20:42:58 +08:00
AND opss.step_order = (
SELECT MAX(step_order)
FROM oa_project_schedule_step
WHERE schedule_id = #{scheduleId}
AND del_flag = '0'
and use_flag = '1'
2025-05-08 20:42:58 +08:00
)
2025-05-08 20:42:58 +08:00
</select>
<select id="selectVoPagePlus" resultMap="OaProjectScheduleStepResult">
select opss.track_id,
opss.accessory,
opss.schedule_id,
opss.step_order,
opss.step_name,
opss.plan_start,
opss.plan_end,
opss.actual_start,
opss.actual_end,
opss.status,
opss.del_flag,
opss.header,
opss.use_flag,
2025-05-08 20:42:58 +08:00
osts.expected_days,
osts.description,
so.oss_id AS oss_id,
so.url AS attach_url,
so.original_name AS attach_file_name, -- 如有需要
so.create_by,
so.is_public,
so.owner_id,
batch_id
2025-05-08 20:42:58 +08:00
from oa_project_schedule_step opss
left join fad_oa.oa_project_schedule ops on ops.schedule_id = opss.schedule_id
left join fad_oa.oa_schedule_template_step osts on osts.template_id = ops.template_id and osts.step_order = opss.step_order
LEFT JOIN sys_oss so ON FIND_IN_SET(so.oss_id, opss.accessory)
AND <include refid="OssVisibleCondition"/>
2025-05-08 20:42:58 +08:00
${ew.getCustomSqlSegment}
</select>
<select id="selectVoPlusById" resultMap="OaProjectScheduleStepResult">
select opss.track_id,
opss.accessory,
opss.schedule_id,
opss.step_order,
opss.step_name,
opss.plan_start,
opss.plan_end,
opss.actual_start,
opss.actual_end,
opss.status,
opss.use_flag,
opss.del_flag,
opss.header,
osts.expected_days,
osts.description,
so.oss_id AS oss_id,
so.url AS attach_url,
so.original_name AS attach_file_name, -- 如有需要
so.create_by,
so.owner_id,
so.is_public
2025-05-08 20:42:58 +08:00
from oa_project_schedule_step opss
left join fad_oa.oa_project_schedule ops on ops.schedule_id = opss.schedule_id
left join fad_oa.oa_schedule_template_step osts on osts.template_id = ops.template_id and osts.step_order =
opss.step_order
LEFT JOIN sys_oss so ON FIND_IN_SET(so.oss_id, opss.accessory)
AND
<include refid="OssVisibleCondition"/>
where opss.track_id = #{trackId} and opss.del_flag='0' and opss.use_flag = '1'
2025-05-08 20:42:58 +08:00
</select>
<select id="selectByCurrentStepAndScheduleId" resultType="com.ruoyi.oa.domain.vo.OaProjectScheduleStepVo">
select opss.track_id,
accessory,
schedule_id,
step_order,
step_name,
plan_start,
plan_end,
actual_start,
actual_end,
opss.use_flag,
2025-05-08 20:42:58 +08:00
status,
header
from oa_project_schedule_step opss
WHERE schedule_id = #{scheduleId}
AND step_order = #{currentStep}
and use_flag = '1'
2025-05-08 20:42:58 +08:00
AND del_flag = '0'
</select>
</mapper>