进度控制开发,任务模式bug修正
This commit is contained in:
@@ -24,14 +24,14 @@
|
||||
|
||||
|
||||
<select id="selectFileUserVoPage" resultType="com.ruoyi.oa.domain.vo.FileUser">
|
||||
select su.user_id,su.nick_name,joining_date,count(file_id) AS fileTotal from sys_user su
|
||||
left join employee_onboarding eo on su.user_id = eo.user_id
|
||||
left join fad_oa.employee_files ef on su.user_id = ef.user_id AND ef.del_flag = '0'
|
||||
select su.user_id, su.nick_name, joining_date, count(file_id) AS fileTotal
|
||||
from sys_user su
|
||||
left join employee_onboarding eo on su.user_id = eo.user_id
|
||||
left join fad_oa.employee_files ef on su.user_id = ef.user_id AND ef.del_flag = '0'
|
||||
${ew.getCustomSqlSegment}
|
||||
GROUP BY
|
||||
su.user_id,
|
||||
su.nick_name,
|
||||
eo.joining_date
|
||||
GROUP BY su.user_id,
|
||||
su.nick_name,
|
||||
eo.joining_date
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
<?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.OaProgressDetailMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.oa.domain.OaProgressDetail" id="OaProgressDetailResult">
|
||||
<result property="detailId" column="detail_id"/>
|
||||
<result property="progressId" column="progress_id"/>
|
||||
<result property="detailName" column="detail_name"/>
|
||||
<result property="planStartDate" column="plan_start_date"/>
|
||||
<result property="planEndDate" column="plan_end_date"/>
|
||||
<result property="actualStartDate" column="actual_start_date"/>
|
||||
<result property="actualEndDate" column="actual_end_date"/>
|
||||
<result property="completePercent" column="complete_percent"/>
|
||||
<result property="planPayDate" column="plan_pay_date"/>
|
||||
<result property="payAmount" column="pay_amount"/>
|
||||
<result property="paidAmount" column="paid_amount"/>
|
||||
<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"/>
|
||||
<result property="detailStatus" column="detail_status"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectVoPagePlus" resultType="com.ruoyi.oa.domain.vo.OaProgressDetailVo">
|
||||
select opd.detail_id,
|
||||
progress_id,
|
||||
detail_name,
|
||||
plan_start_date,
|
||||
plan_end_date,
|
||||
actual_start_date,
|
||||
actual_end_date,
|
||||
complete_percent,
|
||||
plan_pay_date,
|
||||
pay_amount,
|
||||
paid_amount,
|
||||
detail_status,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
del_flag,
|
||||
remark,
|
||||
department,
|
||||
TIMESTAMPDIFF(DAY, NOW(), plan_end_date) AS remainTime
|
||||
from oa_progress_detail opd
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
87
ruoyi-oa/src/main/resources/mapper/oa/OaProgressMapper.xml
Normal file
87
ruoyi-oa/src/main/resources/mapper/oa/OaProgressMapper.xml
Normal file
@@ -0,0 +1,87 @@
|
||||
<?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.OaProgressMapper">
|
||||
|
||||
<resultMap type="com.ruoyi.oa.domain.OaProgress" id="OaProgressResult">
|
||||
<result property="progressId" column="progress_id"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="progressName" column="progress_name"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<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="sort" column="sort"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="timeRemark" column="time_remark"/>
|
||||
<result property="contactPhone" column="contact_phone"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="getKeyList" resultType="com.ruoyi.oa.domain.OaProgressDetail">
|
||||
select distinct detail_name, department
|
||||
from oa_progress_detail
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectVoPagePlus" resultType="com.ruoyi.oa.domain.vo.OaProgressVo">
|
||||
SELECT
|
||||
op.progress_id,
|
||||
op.project_id,
|
||||
op.contact_phone,
|
||||
op.type,
|
||||
op.progress_name,
|
||||
op.parent_id,
|
||||
op.del_flag,
|
||||
op.sort,
|
||||
op.remark,
|
||||
op.status,
|
||||
op.amount,
|
||||
op.time_remark,
|
||||
sop.project_name,
|
||||
sop.project_num,
|
||||
sop.funds,
|
||||
-- 获取 detail_status = 0 且 plan_start_date 最小的记录的 detail_name 作为 nowLevel
|
||||
(
|
||||
SELECT d.detail_name
|
||||
FROM oa_progress_detail d
|
||||
WHERE d.progress_id = op.progress_id
|
||||
AND d.detail_status = 0
|
||||
ORDER BY d.plan_start_date ASC
|
||||
LIMIT 1
|
||||
) AS nowLevel,
|
||||
(
|
||||
SELECT d.detail_id
|
||||
FROM oa_progress_detail d
|
||||
WHERE d.progress_id = op.progress_id
|
||||
AND d.detail_status = 0
|
||||
ORDER BY d.plan_start_date ASC
|
||||
LIMIT 1
|
||||
) AS nowLevelId,
|
||||
-- 计算该记录 plan_end_date 与当前时间的天数差值作为 remainTime
|
||||
(
|
||||
SELECT TIMESTAMPDIFF(DAY, NOW(), d.plan_end_date)
|
||||
FROM oa_progress_detail d
|
||||
WHERE d.progress_id = op.progress_id
|
||||
AND d.detail_status = 0
|
||||
ORDER BY d.plan_start_date ASC
|
||||
LIMIT 1
|
||||
) AS remainTime,
|
||||
-- 计算当前 progress 对应的 detail 完成比例:满足 detail_status = 1 的条数 / 总条数(避免除0)
|
||||
(
|
||||
SELECT IF(COUNT(*) = 0, 0, ROUND(SUM(CASE WHEN d.detail_status = 1 THEN 1 ELSE 0 END) / COUNT(*), 2))
|
||||
FROM oa_progress_detail d
|
||||
WHERE d.progress_id = op.progress_id
|
||||
) AS detailCompletePercent
|
||||
FROM oa_progress op
|
||||
LEFT JOIN sys_oa_project sop ON sop.project_id = op.project_id
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -292,6 +292,7 @@
|
||||
p.color,
|
||||
TIMESTAMPDIFF(DAY, NOW(), p.postpone_time) AS remainTime
|
||||
FROM sys_oa_project p
|
||||
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
@@ -380,4 +381,102 @@
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 项目与进度关联的结果映射 -->
|
||||
<resultMap type="com.ruoyi.oa.domain.vo.SysOaProjectVo" id="ProjectProgressResult">
|
||||
<id property="projectId" column="project_id"/>
|
||||
<result property="projectName" column="project_name"/>
|
||||
<result property="projectNum" column="project_num"/>
|
||||
<result property="projectType" column="project_type"/>
|
||||
<result property="remainTime" column="remainTime"/>
|
||||
<!-- 根据项目 ID 查询顶级进度(parent_id 为 0 或 NULL) -->
|
||||
<collection property="progressList"
|
||||
ofType="com.ruoyi.oa.domain.vo.OaProgressVo"
|
||||
select="selectProgressByProjectId"
|
||||
column="project_id"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 进度项的结果映射 -->
|
||||
<resultMap type="com.ruoyi.oa.domain.vo.OaProgressVo" id="OaProgressResult">
|
||||
<id property="progressId" column="progress_id"/>
|
||||
<result property="projectId" column="project_id"/>
|
||||
<result property="type" column="type"/>
|
||||
<result property="progressName" column="progress_name"/>
|
||||
<result property="parentId" column="parent_id"/>
|
||||
<result property="sort" column="sort"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="status" column="status"/>
|
||||
<!-- 新增字段映射 -->
|
||||
<result property="progressSize" column="progress_size"/>
|
||||
<result property="finishCount" column="finish_count"/>
|
||||
<result property="completionPercent" column="completionPercent"/>
|
||||
|
||||
<!-- 嵌套查询孩子节点(如果需要展示孩子节点明细,可保留) -->
|
||||
<collection property="children"
|
||||
ofType="com.ruoyi.oa.domain.vo.OaProgressVo"
|
||||
select="selectChildProgress"
|
||||
column="progress_id"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 根据项目 ID 查询顶级进度 -->
|
||||
<select id="selectProgressByProjectId" resultMap="OaProgressResult">
|
||||
SELECT
|
||||
p.progress_id,
|
||||
p.project_id,
|
||||
p.type,
|
||||
p.progress_name,
|
||||
p.parent_id,
|
||||
p.sort,
|
||||
p.remark,
|
||||
p.status,
|
||||
-- 孩子节点总数:如果没有匹配则返回 0
|
||||
IFNULL(child.totalCount, 0) AS progress_size,
|
||||
-- 孩子节点中 status 为1的数量
|
||||
IFNULL(child.finishedCount, 0) AS finish_count,
|
||||
-- 计算完成比例:避免除以0的情况
|
||||
CASE WHEN child.totalCount > 0
|
||||
THEN ROUND(child.finishedCount / child.totalCount, 2) *100
|
||||
ELSE 0
|
||||
END AS completionPercent
|
||||
FROM oa_progress p
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
parent_id,
|
||||
COUNT(*) AS totalCount,
|
||||
SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) AS finishedCount
|
||||
FROM oa_progress
|
||||
GROUP BY parent_id
|
||||
) child ON p.progress_id = child.parent_id
|
||||
WHERE p.project_id = #{projectId}
|
||||
AND p.parent_id = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据进度 ID 查询子进度 -->
|
||||
<select id="selectChildProgress" resultMap="OaProgressResult">
|
||||
SELECT
|
||||
progress_id,
|
||||
project_id,
|
||||
type,
|
||||
progress_name,
|
||||
parent_id,
|
||||
sort,
|
||||
remark,
|
||||
status
|
||||
FROM oa_progress
|
||||
WHERE parent_id = #{progressId}
|
||||
</select>
|
||||
|
||||
<!-- 主项目查询,同时获取项目的一些计算字段 -->
|
||||
<select id="selectVoAndProgress" resultMap="ProjectProgressResult">
|
||||
SELECT
|
||||
p.project_id,
|
||||
p.project_name,
|
||||
p.project_num,
|
||||
p.project_type,
|
||||
p.funds,
|
||||
TIMESTAMPDIFF(DAY, NOW(), p.postpone_time) AS remainTime
|
||||
FROM sys_oa_project p
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user