修复缺少字段

This commit is contained in:
2025-07-30 21:10:17 +08:00
parent 68aa2b43c5
commit b418d6928d

View File

@@ -50,38 +50,64 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectListVoPage" resultType="com.ruoyi.oa.domain.vo.SysOaTaskVo"> <select id="selectListVoPage" resultType="com.ruoyi.oa.domain.vo.SysOaTaskVo">
SELECT SELECT sot.task_id,
sot.task_id, sot.project_id,
sot.project_id, sot.create_user_id,
sot.create_user_id, sot.worker_id,
sot.worker_id, sot.task_title,
sot.task_title, sot.task_type,
sot.task_type, sot.task_grade,
sot.task_grade, sot.collaborator,
sot.collaborator, sot.finish_time,
sot.finish_time, sot.temp_time,
sot.temp_time, sot.begin_time,
sot.begin_time, sot.origin_finish_time,
sot.origin_finish_time, sot.postponements,
sot.postponements, sot.completed_time,
sot.completed_time, sot.rank_number,
sot.rank_number, sot.remark,
sot.remark, sot.task_rank,
sot.task_rank, sot.state,
sot.state, sot.time_gap,
sot.time_gap, sot.status,
sot.status, sot.accessory,
sot.accessory, sot.create_by,
sot.create_by, sot.create_time,
sot.create_time, sot.update_by,
sot.update_by, sot.update_time,
sot.update_time, sot.del_flag,
sot.del_flag, sot.own_rank,
sot.own_rank, sop.project_name,
sop.project_name, sop.project_num,
sop.project_num, su1.nick_name AS createUserNickName,
su1.nick_name AS createUserNickName, su2.nick_name AS workerNickName,
su2.nick_name AS workerNickName IF(
sot.completed_time IS NULL,
IF(
-- 子查询取第一个未完成 item 的 end_time
(
SELECT a.end_time
FROM sys_oa_task_item a
WHERE a.task_id = sot.task_id
AND a.completed_time IS NULL
LIMIT 1
) IS NOT NULL,
-- 如果子查询有值,就用它来算超期天数
DATEDIFF(
NOW(),
(
SELECT a.end_time
FROM sys_oa_task_item a
WHERE a.task_id = sot.task_id
AND a.completed_time IS NULL
LIMIT 1
)
),
-- 否则就退回到 sot.finish_time如果它也可能为 NULL可再加一层 IF 或 COALESCE
DATEDIFF(NOW(), sot.finish_time)
),
0
) AS overDays
FROM sys_oa_task sot FROM sys_oa_task sot
LEFT JOIN sys_user su1 ON su1.user_id = sot.create_user_id LEFT JOIN sys_user su1 ON su1.user_id = sot.create_user_id
LEFT JOIN sys_user su2 ON su2.user_id = sot.worker_id LEFT JOIN sys_user su2 ON su2.user_id = sot.worker_id