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.
 
 

253 lines
8.8 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" />
</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="tDescription" property="description" />
<result column="tExecutorRole" property="executorRole" />
<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="tMoney" property="money" />
<result column="tVirtual" property="virtual" />
<result column="tDelay" property="delay" />
<result column="tHasGroup" property="hasGroup" />
<collection property="plugins" ofType="com.ccsens.tall.bean.vo.TaskVo$PluginVo">
<id column="pId" property="id"/>
<result column="pName" property="name"/>
</collection>
</resultMap>
<resultMap id="taskDetailByKey" type="com.ccsens.tall.bean.vo.TaskVo$TaskDetailByKey">
<id column="tId" property="id" />
<result column="tName" property="name" />
</resultMap>
<select id="selectTaskByRoleAndAllMembers" parameterType="java.util.Map"
resultMap="secondTask">
SELECT
d.id as tDetailId,
s.id as tSubTimeId,
d.name as tName,
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.money as tMoney,
d.virtual as tVirtual,
d.delay as tDelay,
d.has_group as tHasGroup,
p.id as pId,
sp.name as pName
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.project_id = #{projectId}
AND
d.executor_role in(#{roleId},#{allMemberId})
<if test="startTime != null">
AND
s.begin_time &lt; #{endTime}
</if>
<if test="endTime != null">
AND
s.end_time &gt;= #{startTime}
</if>
AND
Level = 2
group by s.task_detail_id
</select>
<select id="selectNormalTaskListByPM" parameterType="java.util.Map"
resultMap="secondTask">
SELECT
d.id as tDetailId,
s.id as tSubTimeId,
d.name as tName,
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.money as tMoney,
d.virtual as tVirtual,
d.delay as tDelay,
d.has_group as tHasGroup,
p.id as pId,
sp.name as pName
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.project_id = #{projectId}
AND
d.parent_id = #{parentId}
AND
s.begin_time &lt; #{endTime}
AND
s.end_time &gt;= #{startTime}
AND
level = 2
group by s.task_detail_id
</select>
<select id="selectTaskByTaskId" parameterType="java.util.Map"
resultMap="secondTask">
SELECT
d.id as tDetailId,
s.id as tSubTimeId,
d.name as tName,
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.money as tMoney,
d.virtual as tVirtual,
d.delay as tDelay,
d.has_group as tHasGroup
FROM
t_pro_task_sub_time s LEFT JOIN t_pro_task_detail d ON s.task_detail_id = d.id
WHERE
d.id = #{taskId}
AND
s.id = #{subTimeId}
group by s.task_detail_id
</select>
<select id="selectTaskByParentId" parameterType="java.util.Map"
resultMap="secondTask">
SELECT
d.id as tDetailId,
s.id as tSubTimeId,
d.name as tName,
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.money as tMoney,
d.virtual as tVirtual,
d.delay as tDelay,
d.has_group as tHasGroup,
p.id as pId,
sp.name as pName
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.parent_id = #{parentId}
group by s.task_detail_id
</select>
<select id="selectSubTaskByGroupId" parameterType="java.util.Map"
resultType="com.ccsens.tall.bean.po.ProTaskSubTime">
SELECT
*
FROM
t_pro_task_sub_time s JOIN t_pro_task_detail t ON s.task_detail_id = t.id
WHERE
t.parent_id = #{parentId}
AND
s.begin_time &gt;= #{beginTime}
AND
s.end_time &lt;= #{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.name like concat('%',#{key},'%')
<if test="projectId != null" >
AND
s.id = #{projectId}
</if>
</select>
<select id="selectTaskByParentIdAndTime" parameterType="java.util.Map" resultMap="secondTask">
SELECT
d.id as tDetailId,
s.id as tSubTimeId,
d.name as tName,
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.money as tMoney,
d.virtual as tVirtual,
d.delay as tDelay,
d.has_group as tHasGroup,
p.id as pId,
sp.name as pName
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.parent_id = #{parentId}
AND
s.begin_time &lt; #{endTime}
AND
s.end_time &gt; #{startTime}
group by s.task_detail_id
ORDER BY s.begin_time
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.id = #{detailId}
AND
s.begin_time &lt;= #{now}
ORDER BY s.begin_time DESC
limit 0,1
</select>
</mapper>