内嵌查询代替LEFT JOIN导致的重复问题以及修改邮件不能发送图片和附件的问题
This commit is contained in:
@@ -16,6 +16,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="content" column="content"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="state" column="state"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="taskRank" column="task_rank"/>
|
||||
<result property="ownRank" column="own_rank"/>
|
||||
<result property="timeGap" column="time_gap"/>
|
||||
<result property="tempTime" column="temp_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="completedTime" column="completed_time"/>
|
||||
@@ -23,20 +28,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="workerNickName" column="workerNickName"/>
|
||||
<result property="postponements" column="postponements"/>
|
||||
<result property="accessory" column="accessory"/>
|
||||
<result property="projectName" column="project_name"/>
|
||||
<result property="projectNum" column="project_num"/>
|
||||
<result property="overDays" column="overDays"/>
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="files" column="files"/>
|
||||
|
||||
<collection property="taskItemVoList" ofType="com.ruoyi.oa.domain.vo.SysOaTaskItemVo" javaType="list">
|
||||
<result property="itemId" column="item_id"/>
|
||||
<result property="content" column="itemContent"/>
|
||||
<result property="signTime" column="sign_time"/>
|
||||
<result property="status" column="itemStatus"/>
|
||||
<result property="beginTime" column="itemBeginTime"/>
|
||||
<result property="endTime" column="itemEndTime"/>
|
||||
<result property="remark" column="itemRemark"/>
|
||||
<result property="completedTime" column="itemCompletedTime"/>
|
||||
<result property="files" column="files"/>
|
||||
|
||||
|
||||
</collection>
|
||||
<collection property="taskItemVoList"
|
||||
ofType="com.ruoyi.oa.domain.vo.SysOaTaskItemVo"
|
||||
javaType="list"
|
||||
select="selectTaskItemsByTaskId"
|
||||
column="task_id"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
@@ -57,27 +59,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sot.task_type,
|
||||
sot.task_grade,
|
||||
sot.collaborator,
|
||||
COALESCE(sot.finish_time, soti.end_time) AS finish_time,
|
||||
COALESCE(sot.temp_time, soti.temp_time) AS temp_time,
|
||||
sot.finish_time,
|
||||
sot.temp_time,
|
||||
sot.begin_time,
|
||||
sot.origin_finish_time,
|
||||
sot.postponements,
|
||||
sot.completed_time,
|
||||
CASE
|
||||
WHEN sot.completed_time IS NULL
|
||||
THEN DATEDIFF(
|
||||
NOW(),
|
||||
COALESCE(
|
||||
sot.finish_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)
|
||||
)
|
||||
)
|
||||
ELSE 0
|
||||
END AS overDays,
|
||||
sot.rank_number,
|
||||
sot.remark,
|
||||
sot.task_rank,
|
||||
@@ -91,7 +78,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sot.del_flag,
|
||||
sot.own_rank,
|
||||
sop.project_name,
|
||||
soti.item_id,
|
||||
sop.project_num,
|
||||
su1.nick_name AS createUserNickName,
|
||||
su2.nick_name AS workerNickName
|
||||
@@ -99,12 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
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_oa_project sop ON sop.project_id = sot.project_id
|
||||
LEFT JOIN sys_oa_task_item soti
|
||||
ON soti.task_id = sot.task_id
|
||||
AND soti.completed_time IS NULL
|
||||
|
||||
${ew.getCustomSqlSegment}
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
@@ -116,7 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sot.task_title,
|
||||
sot.task_type,
|
||||
sot.task_grade,
|
||||
sot.accessory,
|
||||
sot.accessory,
|
||||
COALESCE(
|
||||
sot.finish_time,
|
||||
(SELECT a.end_time
|
||||
@@ -142,7 +123,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
su1.nick_name AS createUserNickName,
|
||||
su2.nick_name AS workerNickName,
|
||||
|
||||
|
||||
sot.rank_number,
|
||||
sot.remark,
|
||||
sot.task_rank,
|
||||
@@ -158,14 +138,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
sop.project_name,
|
||||
sop.project_num,
|
||||
|
||||
soti.item_id,
|
||||
soti.content AS itemContent,
|
||||
soti.sign_time,
|
||||
soti.status AS itemStatus,
|
||||
soti.begin_time AS itemBeginTime,
|
||||
soti.completed_time AS itemCompletedTime,
|
||||
soti.end_time AS itemEndTime,
|
||||
soti.remark AS itemRemark,
|
||||
CASE
|
||||
WHEN sot.completed_time IS NULL
|
||||
THEN DATEDIFF(
|
||||
@@ -180,19 +152,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
)
|
||||
ELSE 0
|
||||
END AS overDays,
|
||||
soti.files
|
||||
END AS overDays
|
||||
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_oa_project sop ON sop.project_id = sot.project_id
|
||||
LEFT JOIN sys_oa_task_item soti ON soti.task_id = sot.task_id
|
||||
LEFT JOIN sys_oss so2 ON FIND_IN_SET(so2.oss_id, soti.files)
|
||||
WHERE
|
||||
sot.task_id = #{taskId}
|
||||
WHERE sot.task_id = #{taskId}
|
||||
AND sot.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<!-- 嵌套查询:根据任务ID获取报工单元列表 -->
|
||||
<select id="selectTaskItemsByTaskId" resultType="com.ruoyi.oa.domain.vo.SysOaTaskItemVo">
|
||||
SELECT soti.item_id,
|
||||
soti.content,
|
||||
soti.sign_time,
|
||||
soti.status,
|
||||
soti.begin_time,
|
||||
soti.completed_time,
|
||||
soti.end_time,
|
||||
soti.remark,
|
||||
soti.files
|
||||
FROM sys_oa_task_item soti
|
||||
WHERE soti.task_id = #{task_id}
|
||||
AND soti.del_flag = '0'
|
||||
ORDER BY soti.create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="getMonthlyData"
|
||||
|
||||
Reference in New Issue
Block a user