项目进度控制
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<?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.OaProjectScheduleMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.oa.domain.OaProjectSchedule" id="OaProjectScheduleResult">
|
||||
<result property="scheduleId" column="schedule_id"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="templateId" column="template_id"/>
|
||||
<result property="currentStep" column="current_step"/>
|
||||
<result property="startTime" column="start_time"/>
|
||||
<result property="endTime" column="end_time"/>
|
||||
<result property="status" column="status"/>
|
||||
<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="delFlag" column="del_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectVoPagePlus" resultType="com.ruoyi.oa.domain.vo.OaProjectScheduleVo">
|
||||
SELECT
|
||||
ops.schedule_id,
|
||||
ops.project_id,
|
||||
ops.template_id,
|
||||
ops.current_step,
|
||||
opss.step_name AS currentStepName,
|
||||
ops.start_time,
|
||||
ops.end_time,
|
||||
ops.status,
|
||||
ops.remark,
|
||||
|
||||
-- 项目信息
|
||||
op.project_id AS opProjectId,
|
||||
op.project_name,
|
||||
op.project_num,
|
||||
op.project_type,
|
||||
op.address,
|
||||
op.funds,
|
||||
op.functionary,
|
||||
op.begin_time,
|
||||
op.finish_time,
|
||||
op.introduction,
|
||||
op.project_grade,
|
||||
op.project_status,
|
||||
op.trade_type,
|
||||
op.pre_pay,
|
||||
opss.plan_end,
|
||||
|
||||
-- 剩余天数
|
||||
TIMESTAMPDIFF(DAY, NOW(), opss.plan_end) AS remainTime,
|
||||
|
||||
-- 进度百分比:当 current_step=1 时强制为0,否则按公式计算
|
||||
CASE
|
||||
WHEN ops.current_step = 1 THEN 0
|
||||
ELSE ROUND((ops.current_step / NULLIF(maxs.max_order,0)) * 100, 2)
|
||||
END AS schedulePercentage -- 添加 NULLIF 防止除以0
|
||||
|
||||
FROM oa_project_schedule ops
|
||||
LEFT JOIN sys_oa_project op ON ops.project_id = op.project_id
|
||||
LEFT JOIN oa_project_schedule_step opss
|
||||
ON ops.schedule_id = opss.schedule_id
|
||||
AND opss.step_order = ops.current_step
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
schedule_id,
|
||||
MAX(step_order) AS max_order
|
||||
FROM oa_project_schedule_step
|
||||
GROUP BY schedule_id
|
||||
) maxs ON maxs.schedule_id = ops.schedule_id
|
||||
${ew.getCustomSqlSegment}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,142 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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.OaScheduleTemplateMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.oa.domain.OaScheduleTemplate" id="OaScheduleTemplateResult">
|
||||
<result property="templateId" column="template_id"/>
|
||||
<result property="templateName" column="template_name"/>
|
||||
<result property="status" column="status"/>
|
||||
<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="delFlag" column="del_flag"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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.OaScheduleTemplateStepMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.oa.domain.OaScheduleTemplateStep" id="OaScheduleTemplateStepResult">
|
||||
<result property="stepId" column="step_id"/>
|
||||
<result property="templateId" column="template_id"/>
|
||||
<result property="stepOrder" column="step_order"/>
|
||||
<result property="stepName" column="step_name"/>
|
||||
<result property="expectedDays" column="expected_days"/>
|
||||
<result property="header" column="header"/>
|
||||
<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="delFlag" column="del_flag"/>
|
||||
<result property="description" column="description"/>
|
||||
</resultMap>
|
||||
<select id="selectVoPagePlus" resultType="com.ruoyi.oa.domain.vo.OaScheduleTemplateStepVo">
|
||||
|
||||
select ANY_VALUE(step_id),
|
||||
template_id,
|
||||
step_order,
|
||||
step_name,
|
||||
expected_days,
|
||||
header,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
del_flag,
|
||||
description
|
||||
from oa_schedule_template_step
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -260,6 +260,8 @@
|
||||
</select>
|
||||
<select id="selectVoPlus" resultType="com.ruoyi.oa.domain.vo.SysOaProjectVo">
|
||||
SELECT
|
||||
p.pre_pay,
|
||||
p.trade_type,
|
||||
p.project_id,
|
||||
p.project_name,
|
||||
p.project_num,
|
||||
|
||||
Reference in New Issue
Block a user