项目进度控制
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>
|
||||
Reference in New Issue
Block a user