You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

307 lines
11 KiB

<?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.ccsens.tall.persist.dao.TaskSubTimeDao">
<resultMap id="taskMinutesWps" type="com.ccsens.tall.bean.vo.TaskVo$TaskMinutesWps">
<id column="taskSubTimeId" property="taskSubTimeId" />
<result column="executorRoleName" property="executorRoleName" />
<result column="taskName" property="taskName" />
<result column="beginTime" property="beginTime" />
<result column="endTime" property="endTime" />
<result column="realBeginTime" property="realBeginTime" />
<result column="realEndTime" property="realEndTime" />
<result column="milestone" property="milestone" />
<result column="projectName" property="projectName" />
<result column="projectId" property="projectId" />
<result column="process" property="process" />
<collection property="comment" ofType="com.ccsens.tall.bean.vo.TaskVo$TaskMinutesWps$CommentByMinutes">
<id column="commentId" property="commentId"/>
<result column="userName" property="userName"/>
<result column="commentValue" property="commentValue"/>
</collection>
<collection property="deliverList" ofType="com.ccsens.tall.bean.vo.TaskVo$TaskMinutesWps$DeliverByMinutes">
<id column="deliverId" property="deliverId"/>
<result column="deliverName" property="deliverName"/>
<result column="deliverPath" property="deliverPath"/>
<result column="score" property="score"/>
</collection>
</resultMap>
<select id="getUnderwayTaskByRoleId" parameterType="java.util.Map" resultType="com.ccsens.tall.bean.po.ProTaskSubTime">
SELECT
*
FROM
`t_pro_task_sub_time` s LEFT JOIN `t_pro_task_detail` t ON s.task_detail_id = t.id
WHERE
s.rec_status = 0
and
s.complated_status = 1
and
t.executor_role = #{roleId}
and
s.id != #{subTaskId}
</select>
<update id="clearTaskRealTime" parameterType="java.util.Map">
UPDATE
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d on s.task_detail_id = d.id LEFT JOIN t_sys_project p on d.project_id = p.id
SET
s.real_begin_time = 0,
s.real_end_time = 0,
s.complated_status = 0
WHERE
p.id = #{projectId}
</update>
<select id="getKanbanTake" parameterType="java.util.Map" resultType="com.ccsens.tall.bean.vo.TaskVo$KanBanTask">
SELECT
d.id as taskDetailId,
s.id as id,
d.name as taskName,
d.executor_role as roleId,
r.name as roleName,
s.begin_time as taskBegintime,
s.end_time as taskEndTime,
if(a.rId is not null or r.`name` = '全体成员',1,0) as mine
FROM
t_pro_task_detail d
LEFT JOIN t_pro_task_sub_time s on d.id = s.task_detail_id
LEFT JOIN t_pro_role r on r.id = d.executor_role
LEFT JOIN
(
SELECT
count(m.id) as mid,
s.id as sId
FROM
t_pro_sub_time_member m LEFT JOIN t_pro_task_sub_time s on m.task_sub_time_id = s.id
WHERE
m.rec_status = 0
and m.member_id in
<foreach collection="memberIdList" item="id" separator="," open="(" close=")">
#{id}
</foreach>
)t on t.sId = s.id
LEFT JOIN
(
SELECT
r.id as rId
FROM
t_pro_role r Left join t_pro_member_role mr on r.id = mr.role_id
LEFT JOIN t_pro_member m on mr.member_id = m.id
WHERE
m.user_id = #{userId}
and m.rec_status = 0
and r.rec_status = 0
) a on a.rId = r.id
WHERE
d.rec_status = 0
and d.project_id in
<foreach collection="projectIdList" item="id" separator="," open="(" close=")">
#{id}
</foreach>
and d.level != 0
and d.level != 1
<if test="roleId != null">
and r.id = #{roleId}
</if>
and s.complated_status = #{type}
and FROM_UNIXTIME(s.begin_time/1000,'%Y-%m-%d %H:%m:%s') &lt; NOW()
and
(
( d.finish_need_all = 0 )
or
( d.finish_need_all = 1 and t.mid > 0 )
)
ORDER BY
<if test="orderType == 0">
s.begin_time DESC
</if>
<if test="orderType == 1">
d.priority DESC
,s.begin_time DESC
</if>
</select>
<select id="getKanbanTakeByType" parameterType="java.util.Map" resultType="com.ccsens.tall.bean.vo.TaskVo$KanBanTask">
SELECT
d.id as taskDetailId,
s.id as id,
d.name as taskName,
d.executor_role as roleId,
r.name as roleName,
s.begin_time as taskBegintime,
s.end_time as taskEndTime,
if(t.rId is not null or r.`name` = '全体成员',1,0) as mine
FROM
t_pro_task_detail d LEFT JOIN t_pro_task_sub_time s on d.id = s.task_detail_id
LEFT JOIN t_pro_role r on r.id = d.executor_role
LEFT JOIN
(
SELECT
r.id as rId
FROM
t_pro_role r Left join t_pro_member_role mr on r.id = mr.role_id
LEFT JOIN t_pro_member m on mr.member_id = m.id
WHERE
m.user_id = #{userId}
and m.rec_status = 0
and r.rec_status = 0
) t on t.rId = r.id
WHERE
d.rec_status = 0
and
d.project_id in
<foreach collection="projectIdList" item="id" separator="," open="(" close=")">
#{id}
</foreach>
and
d.level != 0
and
d.level != 1
<if test="roleId != null">
and
r.id = #{roleId}
</if>
and
s.complated_status = #{type}
and
FROM_UNIXTIME(s.begin_time/1000,'%Y-%m-%d %H:%m:%s') &lt; NOW()
ORDER BY
<if test="orderType == 0">
s.begin_time DESC
</if>
<if test="orderType == 1">
d.priority DESC
,s.begin_time DESC
</if>
</select>
<select id="queryMinutesTaskByTime" parameterType="java.util.Map" resultMap="taskMinutesWps">
SELECT
s.id as taskSubTimeId,
r.`name` as executorRoleName,
d.`name` as taskName,
d.milestone as milestone,
FROM_UNIXTIME(s.begin_time/1000,'%m-%d %H:%m') as beginTime,
FROM_UNIXTIME(s.end_time/1000,'%m-%d %H:%m') as endTime,
if(s.real_begin_time = 0,'' ,FROM_UNIXTIME(s.real_begin_time/1000,'%m-%d %H:%m')) as realBeginTime,
if(s.real_end_time = 0,'' ,FROM_UNIXTIME(s.real_end_time/1000,'%m-%d %H:%m')) as realEndTime,
t.commentId as commentId,
t.userName as userName,
t.commentValue as commentValue,
td.`name` as deliverName,
n.deliverPath as deliverPath,
td.id as deliverId,
s.complated_status as process
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d on s.task_detail_id = d.id
LEFT JOIN t_pro_role r on d.executor_role = r.id
LEFT JOIN t_pro_task_deliver td on d.id = td.task_detail_id
LEFT JOIN
(
SELECT
c.id as commentId,
c.task_sub_time_id as taskId,
c.description as `commentValue`,
if(s.nickname = '',a.identifier,s.nickname) as userName
FROM
t_pro_task_comment c left join t_sys_user s on c.user_id = s.id
left join t_sys_auth a on s.id = a.user_id and a.identify_type = 3
WHERE
c.rec_status = 0
and
a.rec_status = 0
)t on t.taskId = s.id
LEFT JOIN
(
SELECT
dl.id as deliverLogPostId,
dl.task_sub_time_id as taskId,
cf.path as deliverPath,
AVG(ch.score)
FROM
t_pro_task_deliver_post_log dl LEFT JOIN t_sys_commited_file cf on cf.id = dl.file_id
LEFT JOIN t_pro_task_deliver_post_log_checker ch on ch.deliver_post_log_id = dl.id
GROUP BY dl.id
)n on s.id = n.taskId
WHERE
d.rec_status = 0
AND
d.project_id = #{projectId}
AND
s.begin_time &lt; #{endTime}
AND
s.end_time &gt; #{startTime}
and
d.level != 1
group by d.id
</select>
<select id="queryWeekTaskByMemberAndProject" resultMap="taskMinutesWps">
SELECT
s.id as taskSubTimeId,
r.`name` as executorRoleName,
d.`name` as taskName,
d.milestone as milestone,
FROM_UNIXTIME(s.begin_time/1000,'%m-%d %H:%m') as beginTime,
FROM_UNIXTIME(s.end_time/1000,'%m-%d %H:%m') as endTime,
if(s.real_begin_time = 0,'' ,FROM_UNIXTIME(s.real_begin_time/1000,'%m-%d %H:%m')) as realBeginTime,
if(s.real_end_time = 0,'' ,FROM_UNIXTIME(s.real_end_time/1000,'%m-%d %H:%m')) as realEndTime,
p.id as projectId,
p.`name` as projectName,
t.commentId as commentId,
t.userName as userName,
t.commentValue as commentValue,
td.`name` as deliverName,
n.deliverPath as deliverPath,
td.id as deliverId,
s.complated_status as process
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d on s.task_detail_id = d.id
LEFT JOIN t_sys_project p on d.project_id = p.id
LEFT JOIN t_pro_role r on d.executor_role = r.id
LEFT JOIN t_pro_member_role mr on mr.role_id = r.id
LEFT JOIN t_pro_member m on m.id = mr.member_id
LEFT JOIN t_pro_task_deliver td on d.id = td.task_detail_id
LEFT JOIN
(
SELECT
c.id as commentId,
c.task_sub_time_id as taskId,
c.description as `commentValue`,
if(s.nickname = '',a.identifier,s.nickname) as userName
FROM
t_pro_task_comment c left join t_sys_user s on c.user_id = s.id
left join t_sys_auth a on s.id = a.user_id and a.identify_type = 3
WHERE
c.rec_status = 0
and
a.rec_status = 0
)t on t.taskId = s.id
LEFT JOIN
(
SELECT
dl.id as deliverLogPostId,
dl.task_sub_time_id as taskId,
cf.path as deliverPath,
AVG(ch.score)
FROM
t_pro_task_deliver_post_log dl LEFT JOIN t_sys_commited_file cf on cf.id = dl.file_id
LEFT JOIN t_pro_task_deliver_post_log_checker ch on ch.deliver_post_log_id = dl.id
GROUP BY dl.id
)n on s.id = n.taskId
WHERE
(m.user_id = #{userId} or r.`name` = '全体成员')
AND
d.project_id = #{projectId}
AND
s.begin_time &lt; #{endTime}
AND
s.end_time &gt; #{startTime}
and
d.rec_status = 0
and
d.level != 1
group by d.id
</select>
</mapper>