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.
579 lines
20 KiB
579 lines
20 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.TaskDetailDao">
|
|
<resultMap id="globalTask" type="com.ccsens.tall.bean.vo.TaskVo$GlobalTask">
|
|
<id column="tDetailId" property="detailId" />
|
|
<id column="tSubTimeId" property="id" />
|
|
<result column="tName" property="name" />
|
|
<result column="tCycle" property="cycle" />
|
|
<result column="tBeginTime" property="beginTime" />
|
|
<result column="tEndTime" property="endTime" />
|
|
<result column="tDelay" property="delay" />
|
|
<result column="webPath" property="webPath" />
|
|
<result column="routineLocation" property="routineLocation" />
|
|
<result column="importParam" property="importParam" />
|
|
</resultMap>
|
|
|
|
<resultMap id="secondTask" type="com.ccsens.tall.bean.vo.TaskVo$NormalTask">
|
|
<id column="tDetailId" property="detailId" />
|
|
<id column="tSubTimeId" property="id" />
|
|
<result column="tName" property="name" />
|
|
<result column="tProjectId" property="projectId" />
|
|
<result column="tDescription" property="description" />
|
|
<result column="tExecutorRole" property="executorRole" />
|
|
<result column="tExecutorRoleName" property="executorRoleName" />
|
|
<result column="tBeginTime" property="beginTime" />
|
|
<result column="tEndTime" property="endTime" />
|
|
<result column="tCycle" property="cycle" />
|
|
<result column="tRealBeginTime" property="realBeginTime" />
|
|
<result column="tRealEndTime" property="realEndTime" />
|
|
<result column="tProcess" property="process" />
|
|
<result column="tSubProjectId" property="subProjectId" />
|
|
<result column="tSubProjectName" property="subProjectName" />
|
|
<result column="tMoney" property="money" />
|
|
<result column="tVirtual" property="virtual" />
|
|
<result column="tDelay" property="delay" />
|
|
<result column="tHasGroup" property="hasGroup" />
|
|
<result column="webPath" property="webPath" />
|
|
<result column="routineLocation" property="routineLocation" />
|
|
<result column="importParam" property="importParam" />
|
|
<result column="priority" property="priority" />
|
|
<result column="milestone" property="milestone" />
|
|
<collection property="plugins" ofType="com.ccsens.tall.bean.vo.TaskVo$PluginVo">
|
|
<id column="pId" property="id"/>
|
|
<result column="pName" property="name"/>
|
|
<result column="pDescription" property="description"/>
|
|
<result column="pShowType" property="showType"/>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<resultMap id="taskDetailByKey" type="com.ccsens.tall.bean.vo.TaskVo$TaskDetailByKey">
|
|
<id column="tId" property="id" />
|
|
<result column="tName" property="name" />
|
|
</resultMap>
|
|
|
|
<resultMap id="TaskIdAndSubTimeIdByParendIdAndTime" type="com.ccsens.tall.bean.vo.TaskVo$TaskIdAndSubTimeIdByParentIdAndTime">
|
|
<id column="tId" property="taskId" />
|
|
<result column="sId" property="subTimeId" />
|
|
</resultMap>
|
|
|
|
|
|
<select id="selectTaskByRoleAndAllMembers" parameterType="java.util.Map"
|
|
resultMap="secondTask">
|
|
SELECT
|
|
*,
|
|
GROUP_CONCAT(t.p_id ORDER BY t.spid) as pId,
|
|
GROUP_CONCAT(t.spName ORDER BY t.spid) as pName,
|
|
GROUP_CONCAT(t.spDescription ORDER BY t.spid) as pDescription,
|
|
GROUP_CONCAT(t.spShowType ORDER BY t.spid) as pShowType
|
|
FROM
|
|
(SELECT
|
|
d.id as tDetailId,
|
|
s.id as tSubTimeId,
|
|
d.name as tName,
|
|
d.project_id as tProjectId,
|
|
d.description as tDescription,
|
|
d.executor_role as tExecutorRole,
|
|
s.begin_time as tBeginTime,
|
|
s.end_time as tEndTime,
|
|
d.cycle as tCycle,
|
|
s.real_begin_time as tRealBeginTime,
|
|
s.real_end_time as tRealEndTime,
|
|
s.complated_status as tProcess,
|
|
d.sub_project_id as tSubProjectId,
|
|
d.sub_project as tSubProjectName,
|
|
d.money as tMoney,
|
|
d.virtual as tVirtual,
|
|
d.delay as tDelay,
|
|
d.has_group as tHasGroup,
|
|
c.web_path as webPath,
|
|
c.routine_location as routineLocation,
|
|
c.import_param as importParam,
|
|
sp.name as spName,
|
|
p.id as p_id,
|
|
sp.description as spDescription,
|
|
sp.id as spid,
|
|
sp.show_type as spShowType,
|
|
d.priority as priority,
|
|
d.milestone as milestone
|
|
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_task_plugin p ON p.task_detail_id = d.id
|
|
AND
|
|
(
|
|
p.member_role_id in (#{roleId},#{allMemberId})
|
|
OR
|
|
p.id IS NULL
|
|
)
|
|
LEFT JOIN t_sys_plugin sp ON sp.id = p.plugin_id
|
|
left join t_pro_plugin_config c on d.id = c.task_id and c.plugin_id = 0
|
|
WHERE
|
|
d.rec_status = 0
|
|
and
|
|
(p.rec_status = 0 OR p.rec_status IS NULL)
|
|
AND
|
|
d.project_id = #{projectId}
|
|
AND
|
|
d.executor_role in (#{roleId},#{allMemberId})
|
|
<if test="endTime != null">
|
|
AND
|
|
s.begin_time < #{endTime}
|
|
</if>
|
|
<if test="startTime != null">
|
|
AND
|
|
s.end_time > #{startTime}
|
|
</if>
|
|
AND
|
|
d.Level > 1
|
|
AND
|
|
d.has_group = 0
|
|
AND
|
|
(c.place_location = 0 or c.id is null)
|
|
group by s.task_detail_id,sp.id
|
|
)t
|
|
GROUP BY t.tSubTimeId
|
|
order by
|
|
<if test="priority == 1">
|
|
t.priority DESC,
|
|
</if>
|
|
<if test="priority == 2">
|
|
t.priority,
|
|
</if>
|
|
t.tDetailId
|
|
|
|
</select>
|
|
|
|
|
|
<select id="selectNormalTaskListByPM" parameterType="java.util.Map"
|
|
resultMap="secondTask">
|
|
SELECT
|
|
*,
|
|
GROUP_CONCAT(t.p_id ORDER BY t.spid) as pId,
|
|
GROUP_CONCAT(t.spName ORDER BY t.spid) as pName,
|
|
GROUP_CONCAT(t.spDescription ORDER BY t.spid) as pDescription,
|
|
GROUP_CONCAT(t.spShowType ORDER BY t.spid) as pShowType
|
|
FROM
|
|
(SELECT
|
|
d.id as tDetailId,
|
|
s.id as tSubTimeId,
|
|
d.name as tName,
|
|
d.project_id as tProjectId,
|
|
d.description as tDescription,
|
|
d.executor_role as tExecutorRole,
|
|
s.begin_time as tBeginTime,
|
|
s.end_time as tEndTime,
|
|
d.cycle as tCycle,
|
|
s.real_begin_time as tRealBeginTime,
|
|
s.real_end_time as tRealEndTime,
|
|
s.complated_status as tProcess,
|
|
d.sub_project_id as tSubProjectId,
|
|
d.sub_project as tSubProjectName,
|
|
d.money as tMoney,
|
|
d.virtual as tVirtual,
|
|
d.delay as tDelay,
|
|
d.has_group as tHasGroup,
|
|
c.web_path as webPath,
|
|
c.routine_location as routineLocation,
|
|
c.import_param as importParam,
|
|
sp.name as spName,
|
|
p.id as p_id,
|
|
sp.description as spDescription,
|
|
sp.id as spid,
|
|
sp.show_type as spShowType,
|
|
d.milestone as milestone
|
|
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_task_plugin p ON p.task_detail_id = d.id
|
|
AND
|
|
(
|
|
p.member_role_id = #{roleId}
|
|
OR
|
|
p.id IS NULL
|
|
)
|
|
LEFT JOIN t_sys_plugin sp ON sp.id = p.plugin_id
|
|
left join t_pro_plugin_config c on d.id = c.task_id and c.plugin_id = 0
|
|
WHERE
|
|
d.rec_status = 0
|
|
and
|
|
(p.rec_status = 0 OR p.rec_status IS NULL)
|
|
AND
|
|
d.project_id = #{projectId}
|
|
AND
|
|
d.parent_id = #{parentId}
|
|
<if test="endTime != null">
|
|
AND
|
|
s.begin_time < #{endTime}
|
|
</if>
|
|
<if test="startTime != null">
|
|
AND
|
|
s.end_time > #{startTime}
|
|
</if>
|
|
AND
|
|
d.Level in (2,3)
|
|
AND
|
|
d.has_group = 0
|
|
AND
|
|
(c.place_location = 0 or c.id is null)
|
|
group by s.task_detail_id,sp.id)t
|
|
GROUP BY t.tSubTimeId
|
|
order by t.tDetailId
|
|
</select>
|
|
|
|
<select id="selectTaskByTaskId" parameterType="java.util.Map"
|
|
resultMap="secondTask">
|
|
SELECT
|
|
*,
|
|
GROUP_CONCAT(t.p_id ORDER BY t.spid) as pId,
|
|
GROUP_CONCAT(t.spName ORDER BY t.spid) as pName,
|
|
GROUP_CONCAT(t.spDescription ORDER BY t.spid) as pDescription,
|
|
GROUP_CONCAT(t.spShowType ORDER BY t.spid) as pShowType
|
|
FROM
|
|
(SELECT
|
|
d.id as tDetailId,
|
|
s.id as tSubTimeId,
|
|
d.name as tName,
|
|
d.project_id as tProjectId,
|
|
d.description as tDescription,
|
|
d.executor_role as tExecutorRole,
|
|
s.begin_time as tBeginTime,
|
|
s.end_time as tEndTime,
|
|
d.cycle as tCycle,
|
|
s.real_begin_time as tRealBeginTime,
|
|
s.real_end_time as tRealEndTime,
|
|
s.complated_status as tProcess,
|
|
d.sub_project_id as tSubProjectId,
|
|
d.sub_project as tSubProjectName,
|
|
d.money as tMoney,
|
|
d.virtual as tVirtual,
|
|
d.delay as tDelay,
|
|
d.has_group as tHasGroup,
|
|
sp.name as spName,
|
|
p.id as p_id,
|
|
sp.description as spDescription,
|
|
sp.id as spid,
|
|
sp.show_type as spShowType,
|
|
d.milestone as milestone
|
|
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_task_plugin p ON p.task_detail_id = d.id
|
|
AND
|
|
(
|
|
p.member_role_id = #{roleId}
|
|
OR
|
|
p.id IS NULL
|
|
)
|
|
LEFT JOIN t_sys_plugin sp ON sp.id = p.plugin_id
|
|
WHERE
|
|
d.rec_status = 0
|
|
and
|
|
(p.rec_status = 0 OR p.rec_status IS NULL)
|
|
AND
|
|
d.id = #{taskId}
|
|
AND
|
|
s.id = #{subTimeId}
|
|
group by s.task_detail_id,sp.id)t
|
|
GROUP BY t.tSubTimeId
|
|
</select>
|
|
|
|
<select id="selectTaskByParentId" parameterType="java.util.Map"
|
|
resultMap="secondTask">
|
|
SELECT
|
|
*,
|
|
GROUP_CONCAT(t.p_id ORDER BY t.spid) as pId,
|
|
GROUP_CONCAT(t.spName ORDER BY t.spid) as pName,
|
|
GROUP_CONCAT(t.spDescription ORDER BY t.spid) as pDescription,
|
|
GROUP_CONCAT(t.spShowType ORDER BY t.spid) as pShowType
|
|
FROM
|
|
(SELECT
|
|
d.id as tDetailId,
|
|
s.id as tSubTimeId,
|
|
d.name as tName,
|
|
d.project_id as tProjectId,
|
|
d.description as tDescription,
|
|
d.executor_role as tExecutorRole,
|
|
s.begin_time as tBeginTime,
|
|
s.end_time as tEndTime,
|
|
d.cycle as tCycle,
|
|
s.real_begin_time as tRealBeginTime,
|
|
s.real_end_time as tRealEndTime,
|
|
s.complated_status as tProcess,
|
|
d.sub_project_id as tSubProjectId,
|
|
d.sub_project as tSubProjectName,
|
|
d.money as tMoney,
|
|
d.virtual as tVirtual,
|
|
d.delay as tDelay,
|
|
d.has_group as tHasGroup,
|
|
sp.name as spName,
|
|
p.id as p_id,
|
|
sp.description as spDescription,
|
|
sp.id as spid,
|
|
sp.show_type as spShowType,
|
|
d.milestone as milestone
|
|
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_task_plugin p ON p.task_detail_id = d.id
|
|
LEFT JOIN t_sys_plugin sp ON sp.id = p.plugin_id
|
|
WHERE
|
|
d.rec_status = 0
|
|
and
|
|
(p.rec_status = 0 OR p.rec_status IS NULL)
|
|
AND
|
|
d.parent_id = #{parentId}
|
|
group by s.task_detail_id,sp.id)t
|
|
GROUP BY t.tSubTimeId
|
|
</select>
|
|
|
|
<select id="selectSubTaskByGroupId" parameterType="java.util.Map"
|
|
resultType="com.ccsens.tall.bean.po.ProTaskSubTime">
|
|
SELECT
|
|
s.id,
|
|
s.begin_time,
|
|
s.end_time,
|
|
s.complated_status
|
|
FROM
|
|
t_pro_task_sub_time s JOIN t_pro_task_detail t ON s.task_detail_id = t.id
|
|
WHERE
|
|
t.rec_status = 0
|
|
AND
|
|
t.parent_id = #{parentId}
|
|
AND
|
|
s.begin_time >= #{beginTime}
|
|
AND
|
|
s.end_time <= #{endTime}
|
|
</select>
|
|
|
|
<select id="selectTaskByKey" parameterType="java.util.Map" resultMap="taskDetailByKey">
|
|
SELECT
|
|
*
|
|
FROM
|
|
t_pro_task_detail t join t_sys_project s on t.project_id = s.id JOIN t_sys_user_attention a on s.id = a.project_id
|
|
WHERE
|
|
a.user_id = #{userId}
|
|
AND t.rec_status = 0
|
|
AND s.rec_status = 0
|
|
AND a.rec_status = 0
|
|
AND t.name like concat('%',#{key},'%')
|
|
<if test="projectId != null" >
|
|
AND
|
|
s.id = #{projectId}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectTaskByParentIdAndTime" parameterType="java.util.Map" resultMap="secondTask">
|
|
SELECT
|
|
*,
|
|
GROUP_CONCAT(t.p_id ORDER BY t.spid) as pId,
|
|
GROUP_CONCAT(t.spName ORDER BY t.spid) as pName,
|
|
GROUP_CONCAT(t.spDescription ORDER BY t.spid) as pDescription,
|
|
GROUP_CONCAT(t.spShowType ORDER BY t.spid) as pShowType
|
|
FROM
|
|
(SELECT
|
|
d.id as tDetailId,
|
|
s.id as tSubTimeId,
|
|
d.name as tName,
|
|
d.project_id as tProjectId,
|
|
d.description as tDescription,
|
|
d.executor_role as tExecutorRole,
|
|
s.begin_time as tBeginTime,
|
|
s.end_time as tEndTime,
|
|
d.cycle as tCycle,
|
|
s.real_begin_time as tRealBeginTime,
|
|
s.real_end_time as tRealEndTime,
|
|
s.complated_status as tProcess,
|
|
d.sub_project_id as tSubProjectId,
|
|
d.sub_project as tSubProjectName,
|
|
d.money as tMoney,
|
|
d.virtual as tVirtual,
|
|
d.delay as tDelay,
|
|
d.has_group as tHasGroup,
|
|
sp.name as spName,
|
|
p.id as p_id,
|
|
sp.description as spDescription,
|
|
sp.id as spid,
|
|
sp.show_type as spShowType,
|
|
d.milestone as milestone
|
|
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_task_plugin p ON p.task_detail_id = d.id
|
|
LEFT JOIN t_sys_plugin sp ON sp.id = p.plugin_id
|
|
WHERE
|
|
d.rec_status = 0
|
|
and
|
|
(p.rec_status = 0 OR p.rec_status IS NULL)
|
|
AND
|
|
d.parent_id = #{parentId}
|
|
AND
|
|
s.begin_time < #{endTime}
|
|
AND
|
|
s.end_time > #{startTime}
|
|
group by s.task_detail_id,sp.id
|
|
ORDER BY s.begin_time)t
|
|
GROUP BY t.tSubTimeId
|
|
limit 0,1
|
|
</select>
|
|
|
|
<select id="selectSubTimeByTaskIdAndTime" parameterType="java.util.Map"
|
|
resultType="Long">
|
|
SELECT
|
|
s.id
|
|
FROM
|
|
t_pro_task_sub_time s join t_pro_task_detail d on s.task_detail_id = d.id
|
|
WHERE
|
|
d.rec_status = 0
|
|
AND
|
|
d.id = #{detailId}
|
|
AND
|
|
s.begin_time <= #{now}
|
|
ORDER BY s.begin_time DESC
|
|
limit 0,1
|
|
</select>
|
|
|
|
<select id="selectSubTimeByTaskParentIdAndTime" parameterType="java.util.Map"
|
|
resultMap="TaskIdAndSubTimeIdByParendIdAndTime">
|
|
SELECT
|
|
d.id as tId,
|
|
s.id as sId
|
|
FROM
|
|
t_pro_task_sub_time s join t_pro_task_detail d on s.task_detail_id = d.id
|
|
WHERE
|
|
d.rec_status = 0
|
|
AND
|
|
d.parent_id = #{parentId}
|
|
AND
|
|
s.begin_time <= #{now}
|
|
ORDER BY s.begin_time DESC
|
|
limit 0,1
|
|
</select>
|
|
<!--==================================-->
|
|
|
|
<update id="selectTaskByDetailId" parameterType="java.util.Map">
|
|
update
|
|
t_pro_task_detail d LEFT JOIN
|
|
t_pro_task_sub_time s ON s.task_detail_id = d.id LEFT JOIN
|
|
t_pro_sub_time_member sm ON sm.task_sub_time_id = s.id
|
|
set
|
|
d.rec_status=2,
|
|
s.rec_status=2,
|
|
sm.rec_status=2
|
|
WHERE
|
|
d.id = #{detailId}
|
|
</update>
|
|
|
|
<select id="getTaskMemberNameByTaskId" parameterType="java.util.Map" resultType="String">
|
|
select
|
|
GROUP_CONCAT(m.nickname)
|
|
from
|
|
t_pro_member m join t_pro_task_member tm on m.id = tm.member_id
|
|
where
|
|
m.rec_status = 0
|
|
and
|
|
tm.task_detail_id = #{taskId}
|
|
</select>
|
|
|
|
<select id="selectAllByProject" parameterType="java.util.Map" resultType="com.ccsens.tall.bean.po.ProTaskDetail">
|
|
SELECT
|
|
*
|
|
FROM
|
|
t_pro_task_detail
|
|
WHERE
|
|
project_id = #{projectId}
|
|
AND
|
|
level != 0
|
|
AND
|
|
rec_status != 2
|
|
ORDER BY LEVEL
|
|
</select>
|
|
|
|
<select id="getChecklistsByProjectId" parameterType="java.util.Map" resultType="com.ccsens.tall.bean.vo.WbsVo$ChecklistByProjectId">
|
|
SELECT
|
|
s.`name` as projectName,
|
|
d.`name` as taskName,
|
|
d.`id` as taskId,
|
|
r.`name` as roleName,
|
|
d.begin_time as beginTime,
|
|
d.end_time as endTime,
|
|
d.cycle as cycle
|
|
FROM
|
|
t_pro_task_detail d LEFT JOIN t_sys_project s on d.project_id = s.id
|
|
LEFT JOIN t_pro_role r on d.executor_role = r.id
|
|
WHERE
|
|
d.rec_status = 0
|
|
and
|
|
d.level != 0
|
|
and
|
|
d.level != 1
|
|
<if test="projectId != null">
|
|
and
|
|
s.id = #{projectId}
|
|
</if>
|
|
<if test="roleId != null">
|
|
and
|
|
r.id in (#{roleId},#{allMemberId})
|
|
</if>
|
|
<if test="endTime != null">
|
|
AND
|
|
s.begin_time < #{endTime}
|
|
</if>
|
|
<if test="startTime != null">
|
|
AND
|
|
s.end_time > #{startTime}
|
|
</if>
|
|
</select>
|
|
<select id="getTaskById" resultType="com.ccsens.tall.bean.vo.TaskVo$TaskListByProjectId">
|
|
SELECT
|
|
t.id as detailId,
|
|
t.`name`,
|
|
t.description,
|
|
t.begin_time as beginTime,
|
|
t.end_time as endTime,
|
|
t.cycle as cycle,
|
|
t.money as money,
|
|
t.project_id as projectId,
|
|
t.milestone,
|
|
(SELECT `name` FROM t_sys_project WHERE id = t.project_id) as projectName,
|
|
t.executor_role as executorRole,
|
|
(SELECT `name` FROM t_pro_role WHERE id = t.executor_role) as executorRoleName,
|
|
d.id as deliverId,
|
|
d.`name` as deliverName
|
|
FROM
|
|
t_pro_task_detail t
|
|
LEFT JOIN t_pro_task_deliver d on t.id = d.task_detail_id
|
|
WHERE
|
|
t.id = #{detailTaskId}
|
|
and t.rec_status = 0
|
|
limit 1
|
|
</select>
|
|
<select id="getTaskByParentId" resultType="com.ccsens.tall.bean.vo.TaskVo$TaskListByProjectId">
|
|
SELECT
|
|
t.id as detailId,
|
|
t.`name`,
|
|
t.description,
|
|
t.begin_time as beginTime,
|
|
t.end_time as endTime,
|
|
t.cycle as cycle,
|
|
t.money as money,
|
|
t.project_id as projectId,
|
|
t.milestone as milestone,
|
|
(SELECT `name` FROM t_sys_project WHERE id = t.project_id) as projectName,
|
|
t.executor_role as executorRole,
|
|
(SELECT `name` FROM t_pro_role WHERE id = t.executor_role) as executorRoleName,
|
|
d.id as deliverId,
|
|
d.`name` as deliverName
|
|
FROM
|
|
t_pro_task_detail t
|
|
LEFT JOIN t_pro_task_deliver d on t.id = d.task_detail_id
|
|
WHERE
|
|
t.parent_id = #{parentTaskId}
|
|
<if test="endTime != null">
|
|
AND t.begin_time <= #{endTime}
|
|
</if>
|
|
<if test="beginTime != null">
|
|
AND t.end_time >= #{beginTime}
|
|
</if>
|
|
<if test="milestone != null">
|
|
and t.milestone = #{milestone}
|
|
</if>
|
|
and t.rec_status = 0
|
|
</select>
|
|
|
|
</mapper>
|