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

143 lines
5.8 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"/>
<!-- ========== 附件列表:多对一 折叠 ========= -->
<collection property="fileList"
ofType="com.ruoyi.system.domain.SysOss"
javaType="java.util.ArrayList">
<result property="ossId" column="attach_oss_id"/>
<result property="url" column="attach_url"/>
<result property="fileName" column="attach_file_name"/>
<result property="createBy" column="create_by"/>
</collection>
</resultMap>
<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'
</update>
<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,
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.step_order = (
SELECT MAX(step_order)
FROM oa_project_schedule_step
WHERE schedule_id = #{scheduleId}
AND del_flag = '0'
)
</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,
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
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)
${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.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
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)
where opss.track_id = #{trackId} and opss.del_flag='0'
</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,
status,
header
from oa_project_schedule_step opss
WHERE schedule_id = #{scheduleId}
AND step_order = #{currentStep}
AND del_flag = '0'
</select>
</mapper>