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.
644 lines
24 KiB
644 lines
24 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.ptccsens.persist.dao.ProTaskDetailDao">
|
|
<insert id="insertReplace" parameterType="com.ccsens.ptccsens.bean.po.ProTaskDetail">
|
|
replace into t_pro_task_detail
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
id,
|
|
</if>
|
|
<if test="name != null">
|
|
name,
|
|
</if>
|
|
<if test="description != null">
|
|
description,
|
|
</if>
|
|
<if test="cycle != null">
|
|
cycle,
|
|
</if>
|
|
<if test="createdAt != null">
|
|
created_at,
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
updated_at,
|
|
</if>
|
|
<if test="recStatus != null">
|
|
rec_status,
|
|
</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="id != null">
|
|
#{id,jdbcType=BIGINT},
|
|
</if>
|
|
<if test="name != null">
|
|
#{name,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="description != null">
|
|
#{description,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="cycle != null">
|
|
#{cycle,jdbcType=VARCHAR},
|
|
</if>
|
|
<if test="createdAt != null">
|
|
#{createdAt,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="updatedAt != null">
|
|
#{updatedAt,jdbcType=TIMESTAMP},
|
|
</if>
|
|
<if test="recStatus != null">
|
|
#{recStatus,jdbcType=TINYINT},
|
|
</if>
|
|
</trim>
|
|
</insert>
|
|
<select id="projectIdByTaskDetailId" resultType="java.lang.Long">
|
|
SELECT
|
|
b.business_id
|
|
FROM
|
|
(SELECT l.id as labelId FROM t_label l LEFT JOIN t_label_type lt on l.label_type_id = lt.id WHERE lt.label_type = 1 and l.level = 0 and l.rec_status = 0 and lt.rec_status = 0) l,
|
|
(SELECT
|
|
@r as _id ,
|
|
@r:=(SELECT @r:=parent_task_detail_id FROM t_pro_parent_task WHERE task_detail_id = _id and rec_status = 0) as parentId
|
|
FROM
|
|
(SELECT @r := #{taskDetailId}) d,
|
|
t_pro_parent_task p
|
|
WHERE
|
|
@r is not null
|
|
)p,
|
|
t_label_business b
|
|
WHERE
|
|
l.labelId = b.label_id
|
|
and p.parentId = b.business_id
|
|
and b.rec_status = 0
|
|
limit 1
|
|
</select>
|
|
|
|
|
|
<resultMap id="queryTask" type="com.ccsensptos.tallsdk.bean.vo.TallTaskVo$QueryTask">
|
|
<id column="id" property="id"/>
|
|
<result column="detailId" property="detailId"/>
|
|
<result column="name" property="name"/>
|
|
<result column="description" property="description"/>
|
|
<result column="planStart" property="planStart"/>
|
|
<result column="plan_duration" property="planDuration"/>
|
|
<result column="plan_end_time" property="planEnd"/>
|
|
<result column="realStart" property="realStart"/>
|
|
<result column="real_duration" property="realDuration"/>
|
|
<result column="real_end_time" property="realEnd"/>
|
|
<result column="process" property="process"/>
|
|
<result column="skip" property="skip"/>
|
|
<result column="skipTaskId" property="skipTaskId"/>
|
|
<collection property="panel" ofType="com.ccsensptos.tallsdk.bean.vo.TallTaskVo$PanelInfo">
|
|
<result column="backgroundColor" property="backgroundColor"/>
|
|
<result column="borderRadius" property="borderRadius"/>
|
|
<result column="border" property="border"/>
|
|
<result column="shadow" property="shadow"/>
|
|
<result column="width" property="width"/>
|
|
<result column="height" property="height"/>
|
|
<result column="row" property="row"/>
|
|
<result column="col" property="col"/>
|
|
</collection>
|
|
</resultMap>
|
|
|
|
<!-- <insert id="insertAllTaskDetail">-->
|
|
<!-- INSERT INTO t_pro_task_detail (-->
|
|
<!-- id,-->
|
|
<!-- `name`,-->
|
|
<!-- description,-->
|
|
<!-- cycle-->
|
|
<!-- )-->
|
|
<!-- VALUES-->
|
|
<!-- <foreach collection="newTaskDetailList" item="item" separator=",">-->
|
|
<!-- (#{item.id},#{item.name},#{item.description},#{item.cycle})-->
|
|
<!-- </foreach>-->
|
|
<!-- </insert>-->
|
|
|
|
<select id="queryPermanentGlobalTask" resultMap="queryTask">
|
|
SELECT
|
|
ts.id,
|
|
td.id AS detailId,
|
|
td.`name`,
|
|
td.description,
|
|
ts.plan_start_time AS planStart,
|
|
ts.plan_duration,
|
|
ts.plan_end_time,
|
|
ts.real_start_time AS realStart,
|
|
ts.real_duration,
|
|
ts.real_end_time,
|
|
ts.task_status AS process,
|
|
tf.flow_type AS skip,
|
|
tf.jump_task_detail_id AS skipTaskId,
|
|
tpi.back_color AS backgroundColor,
|
|
tpi.round_corner AS borderRadius,
|
|
tpi.border AS border,
|
|
tpi.shadow AS shadow,
|
|
tpi.width AS width,
|
|
tpi.height AS height,
|
|
tpi.`row` AS `row`,
|
|
tpi.col AS col
|
|
FROM
|
|
t_pro_task_detail AS td
|
|
LEFT JOIN t_pro_task_sub AS ts ON ts.task_detail_id = td.id
|
|
LEFT JOIN t_pro_task_flow AS tf ON tf.task_detail_id = td.id AND tf.rec_status = 0
|
|
LEFT JOIN t_pro_role_task AS rt ON rt.task_id = td.id
|
|
LEFT JOIN t_pro_task_panel_info AS tpi ON tpi.task_detail_id = td.id AND tpi.rec_status = 0
|
|
LEFT JOIN t_label_business AS lb ON td.id = lb.business_id
|
|
LEFT JOIN t_label AS l ON l.id = lb.label_id
|
|
LEFT JOIN t_label_type AS lt ON lt.id = l.label_type_id
|
|
WHERE
|
|
td.rec_status = 0 AND ts.rec_status = 0 AND lb.rec_status = 0 AND l.rec_status = 0 AND lt.rec_status = 0 AND rt.rec_status = 0
|
|
AND lb.business_type = 0
|
|
AND l.`level` = 2
|
|
AND lt.label_type = 1
|
|
AND ts.plan_start_time = 0
|
|
AND ts.plan_duration = 0
|
|
AND rt.role_id IN
|
|
<foreach collection="roleIdList" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
ORDER BY ts.plan_start_time
|
|
</select>
|
|
|
|
<select id="queryGlobalTask" resultMap="queryTask">
|
|
SELECT
|
|
alltask.*
|
|
FROM
|
|
(
|
|
SELECT
|
|
ts.id,
|
|
td.id AS detailId,
|
|
td.`name`,
|
|
td.description,
|
|
ts.plan_start_time AS planStart,
|
|
ts.plan_duration,
|
|
ts.plan_end_time,
|
|
ts.real_end_time,
|
|
ts.real_start_time AS realStart,
|
|
ts.real_duration,
|
|
ts.task_status AS process,
|
|
tf.flow_type AS skip,
|
|
tf.jump_task_detail_id AS skipTaskId,
|
|
tpi.back_color AS backgroundColor,
|
|
tpi.round_corner AS borderRadius,
|
|
tpi.border AS border,
|
|
tpi.shadow AS shadow,
|
|
tpi.width AS width,
|
|
tpi.height AS height,
|
|
tpi.`row` AS `row`,
|
|
tpi.col AS col
|
|
FROM
|
|
t_pro_task_detail AS td
|
|
LEFT JOIN t_pro_task_sub AS ts ON ts.task_detail_id = td.id
|
|
LEFT JOIN t_pro_task_flow AS tf ON tf.task_detail_id = td.id
|
|
AND tf.rec_status = 0
|
|
LEFT JOIN t_pro_role_task AS rt ON rt.task_id = td.id
|
|
LEFT JOIN t_pro_task_panel_info AS tpi ON tpi.task_detail_id = td.id
|
|
AND tpi.rec_status = 0
|
|
LEFT JOIN t_label_business AS lb ON td.id = lb.business_id
|
|
LEFT JOIN t_label AS l ON l.id = lb.label_id
|
|
LEFT JOIN t_label_type AS lt ON lt.id = l.label_type_id
|
|
WHERE
|
|
td.rec_status = 0
|
|
AND ts.rec_status = 0
|
|
AND lb.rec_status = 0
|
|
AND l.rec_status = 0
|
|
AND lt.rec_status = 0
|
|
AND rt.rec_status = 0
|
|
AND lb.business_type = 0
|
|
AND l.`level` = 2
|
|
AND lt.label_type = 1
|
|
AND ts.plan_start_time != 0
|
|
AND ts.plan_duration != 0
|
|
AND rt.role_id IN
|
|
<foreach collection="roleIdList" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
AND ts.plan_start_time <= #{timeNode}
|
|
AND ts.plan_end_time >= #{timeNode}
|
|
) AS alltask
|
|
LEFT JOIN t_label_business AS llbb ON alltask.detailId = llbb.business_id
|
|
LEFT JOIN t_label AS ll ON llbb.label_id = ll.id
|
|
LEFT JOIN t_label_type AS lltt ON ll.label_type_id = lltt.id
|
|
WHERE
|
|
llbb.rec_status = 0
|
|
AND ll.rec_status = 0
|
|
AND lltt.rec_status = 0
|
|
AND lltt.label_type = 0
|
|
AND llbb.business_type = 0
|
|
AND ll.`level` >= #{timeUnit}
|
|
ORDER BY alltask.planStart
|
|
</select>
|
|
|
|
<select id="queryRegularTask" resultMap="queryTask">
|
|
SELECT
|
|
alltask.*
|
|
FROM
|
|
(
|
|
SELECT
|
|
ts.id,
|
|
td.id AS detailId,
|
|
td.`name`,
|
|
td.description,
|
|
ts.plan_start_time AS planStart,
|
|
ts.plan_duration,
|
|
ts.plan_end_time,
|
|
ts.real_end_time,
|
|
ts.real_start_time AS realStart,
|
|
ts.real_duration,
|
|
ts.task_status AS process,
|
|
tf.flow_type AS skip,
|
|
tf.jump_task_detail_id AS skipTaskId,
|
|
tpi.back_color AS backgroundColor,
|
|
tpi.round_corner AS borderRadius,
|
|
tpi.border AS border,
|
|
tpi.shadow AS shadow,
|
|
tpi.width AS width,
|
|
tpi.height AS height,
|
|
tpi.`row` AS `row`,
|
|
tpi.col AS col
|
|
FROM
|
|
t_pro_task_detail AS td
|
|
LEFT JOIN t_pro_task_sub AS ts ON ts.task_detail_id = td.id
|
|
LEFT JOIN t_pro_task_flow AS tf ON tf.task_detail_id = td.id AND tf.rec_status = 0
|
|
LEFT JOIN t_pro_role_task AS rt ON rt.task_id = td.id
|
|
LEFT JOIN t_pro_task_panel_info AS tpi ON tpi.task_detail_id = td.id AND tpi.rec_status = 0
|
|
LEFT JOIN t_label_business AS lb ON td.id = lb.business_id
|
|
LEFT JOIN t_label AS l ON l.id = lb.label_id
|
|
LEFT JOIN t_label_type AS lt ON lt.id = l.label_type_id
|
|
WHERE
|
|
td.rec_status = 0
|
|
AND ts.rec_status = 0
|
|
AND lb.rec_status = 0
|
|
AND l.rec_status = 0
|
|
AND lt.rec_status = 0
|
|
AND rt.rec_status = 0
|
|
AND lb.business_type = 0
|
|
AND l.`level` = 3
|
|
AND lt.label_type = 1
|
|
AND ts.plan_start_time != 0
|
|
AND ts.plan_duration != 0
|
|
AND rt.role_id IN
|
|
<foreach collection="roleIdList" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="queryType==0 and timeUnit != 7">
|
|
AND FROM_UNIXTIME(plan_start_time/1000,#{timeFormat}) <= FROM_UNIXTIME((#{timeNode}-86400000)/1000,#{timeFormat})
|
|
AND FROM_UNIXTIME(plan_start_time/1000,#{timeFormat}) >= DATE_ADD(FROM_UNIXTIME(#{timeNode}/1000,#{timeFormat}),${query})
|
|
</if>
|
|
<if test="queryType==1 and timeUnit != 7">
|
|
AND FROM_UNIXTIME(plan_start_time/1000,#{timeFormat}) >= FROM_UNIXTIME(#{timeNode}/1000,#{timeFormat})
|
|
AND FROM_UNIXTIME(plan_start_time/1000,#{timeFormat}) <=DATE_ADD(FROM_UNIXTIME(#{timeNode}/1000,#{timeFormat}),${query})
|
|
</if>
|
|
<if test="queryType==0 and timeUnit == 7">
|
|
AND CONCAT(FROM_UNIXTIME(plan_start_time/1000,'%Y'),QUARTER(FROM_UNIXTIME(plan_start_time/1000))) <= CONCAT(FROM_UNIXTIME(plan_start_time/1000,'%Y'),QUARTER(FROM_UNIXTIME(plan_start_time/1000)))
|
|
AND CONCAT(FROM_UNIXTIME(plan_start_time/1000,'%Y'),QUARTER(FROM_UNIXTIME(plan_start_time/1000))) >= DATE_ADD(FROM_UNIXTIME(#{timeNode}/1000,#{timeFormat}),${query})
|
|
</if>
|
|
<if test="queryType==1 and timeUnit == 7">
|
|
AND FROM_UNIXTIME(plan_start_time/1000,#{timeFormat}) >= FROM_UNIXTIME(#{timeNode}/1000,#{timeFormat})
|
|
AND FROM_UNIXTIME(plan_start_time/1000,#{timeFormat}) <=DATE_ADD(FROM_UNIXTIME(#{timeNode}/1000,#{timeFormat}),${query})
|
|
</if>
|
|
) AS alltask
|
|
LEFT JOIN t_label_business AS llbb ON alltask.detailId = llbb.business_id
|
|
LEFT JOIN t_label AS ll ON llbb.label_id = ll.id
|
|
LEFT JOIN t_label_type AS lltt ON ll.label_type_id = lltt.id
|
|
WHERE
|
|
llbb.rec_status = 0
|
|
AND ll.rec_status = 0
|
|
AND lltt.rec_status = 0
|
|
AND lltt.label_type = 0
|
|
AND llbb.business_type = 0
|
|
AND ll.`level` >= #{timeUnit}
|
|
ORDER BY alltask.planStart
|
|
</select>
|
|
|
|
<select id="continueQueryTask" resultMap="queryTask">
|
|
SELECT
|
|
alltask.*
|
|
FROM
|
|
(
|
|
SELECT
|
|
ts.id,
|
|
td.id AS detailId,
|
|
td.`name`,
|
|
td.description,
|
|
ts.plan_start_time AS planStart,
|
|
ts.plan_duration,
|
|
ts.plan_end_time,
|
|
ts.real_end_time,
|
|
ts.real_start_time AS realStart,
|
|
ts.real_duration,
|
|
ts.task_status AS process,
|
|
tf.flow_type AS skip,
|
|
tf.jump_task_detail_id AS skipTaskId,
|
|
tpi.back_color AS backgroundColor,
|
|
tpi.round_corner AS borderRadius,
|
|
tpi.border AS border,
|
|
tpi.shadow AS shadow,
|
|
tpi.width AS width,
|
|
tpi.height AS height,
|
|
tpi.`row` AS `row`,
|
|
tpi.col AS col
|
|
FROM
|
|
t_pro_task_detail AS td
|
|
LEFT JOIN t_pro_task_sub AS ts ON ts.task_detail_id = td.id
|
|
LEFT JOIN t_pro_task_flow AS tf ON tf.task_detail_id = td.id AND tf.rec_status = 0
|
|
LEFT JOIN t_pro_role_task AS rt ON rt.task_id = td.id
|
|
LEFT JOIN t_pro_task_panel_info AS tpi ON tpi.task_detail_id = td.id AND tpi.rec_status = 0
|
|
LEFT JOIN t_label_business AS lb ON td.id = lb.business_id
|
|
LEFT JOIN t_label AS l ON l.id = lb.label_id
|
|
LEFT JOIN t_label_type AS lt ON lt.id = l.label_type_id
|
|
WHERE
|
|
td.rec_status = 0
|
|
AND ts.rec_status = 0
|
|
AND lb.rec_status = 0
|
|
AND l.rec_status = 0
|
|
AND lt.rec_status = 0
|
|
AND rt.rec_status = 0
|
|
AND lb.business_type = 0
|
|
AND l.`level` = 3
|
|
AND lt.label_type = 1
|
|
AND ts.plan_start_time != 0
|
|
AND ts.plan_duration != 0
|
|
AND rt.role_id IN
|
|
<foreach collection="roleIdList" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="queryType==0 and timeUnit != 7">
|
|
AND FROM_UNIXTIME(ts.plan_start_time / 1000 ,#{timeFormat}) <= FROM_UNIXTIME((#{timeNode}-86400000)/ 1000 ,#{timeFormat})
|
|
</if>
|
|
<if test="queryType==1 and timeUnit != 7">
|
|
AND FROM_UNIXTIME(ts.plan_start_time / 1000 ,#{timeFormat}) >= FROM_UNIXTIME((#{timeNode})/ 1000 ,#{timeFormat})
|
|
</if>
|
|
) AS alltask
|
|
LEFT JOIN t_label_business AS llbb ON alltask.detailId = llbb.business_id
|
|
LEFT JOIN t_label AS ll ON llbb.label_id = ll.id
|
|
LEFT JOIN t_label_type AS lltt ON ll.label_type_id = lltt.id
|
|
WHERE
|
|
llbb.rec_status = 0
|
|
AND ll.rec_status = 0
|
|
AND lltt.rec_status = 0
|
|
AND lltt.label_type = 0
|
|
AND llbb.business_type = 0
|
|
AND ll.`level` >= #{timeUnit}
|
|
ORDER BY alltask.planStart
|
|
</select>
|
|
|
|
|
|
|
|
<insert id="insertSelectiveList">
|
|
INSERT INTO t_pro_task_sub
|
|
(
|
|
id,
|
|
task_detail_id,
|
|
plan_start_time,
|
|
plan_end_time,
|
|
plan_duration
|
|
)
|
|
VALUES
|
|
<foreach collection="proTaskSubList" item="item" separator=",">
|
|
(#{item.id},#{item.taskDetailId},#{item.planStartTime},#{item.planEndTime},#{item.planDuration})
|
|
</foreach>
|
|
</insert>
|
|
<select id="getNowTask" resultType="java.lang.Long">
|
|
SELECT
|
|
s.id
|
|
FROM
|
|
t_pro_task_detail d
|
|
LEFT JOIN t_pro_parent_task p on d.id = p.task_detail_id
|
|
LEFT JOIN (SELECT * FROM t_pro_parent_task WHERE parent_task_detail_id = #{projectId}) p1 on p.parent_task_detail_id = p1.task_detail_id
|
|
LEFT JOIN
|
|
t_pro_task_sub s on d.id = s.task_detail_id and s.rec_status = 0
|
|
WHERE
|
|
`name` = #{taskName}
|
|
and s.plan_start_time <= #{now}
|
|
and s.plan_end_time >= #{now}
|
|
and d.rec_status = 0
|
|
and p.rec_status = 0
|
|
and p1.rec_status = 0
|
|
limit 1
|
|
</select>
|
|
|
|
|
|
<select id="queryTaskOfProject" resultType="com.ccsens.ptccsens.bean.vo.TaskVo$TaskOfProject">
|
|
SELECT
|
|
t.id AS detailId,
|
|
t.`name`
|
|
FROM
|
|
t_pro_parent_task AS p
|
|
LEFT JOIN t_pro_task_detail AS t ON t.id = p.task_detail_id
|
|
WHERE
|
|
p.rec_status = 0
|
|
AND t.rec_status = 0
|
|
AND p.parent_task_detail_id IN (
|
|
SELECT
|
|
pp.task_detail_id
|
|
FROM
|
|
t_pro_parent_task AS pp
|
|
WHERE
|
|
pp.parent_task_detail_id = #{projectId}
|
|
AND pp.rec_status = 0
|
|
)
|
|
AND t.`name` LIKE CONCAT('%',#{name},'%')
|
|
</select>
|
|
<select id="queryMwbs" resultType="com.ccsensptos.tallsdk.bean.vo.TallProjectVo$ProjectInfo">
|
|
SELECT
|
|
d.id,
|
|
d.`name`,
|
|
s.plan_start_time as startTime,
|
|
s.plan_end_time as endTime
|
|
FROM
|
|
t_pro_task_detail d
|
|
LEFT JOIN t_pro_task_sub s on d.id = s.task_detail_id and s.rec_status = 0
|
|
LEFT JOIN t_label_business lb on d.id = lb.business_id and lb.rec_status = 0
|
|
LEFT JOIN t_label l on l.id = lb.label_id and l.rec_status = 0
|
|
LEFT JOIN t_pro_parent_task p on d.id = p.task_detail_id and p.rec_status = 0
|
|
WHERE
|
|
l.label_type_id = 2
|
|
and p.parent_task_detail_id is null
|
|
and
|
|
l.`level` = 0
|
|
and
|
|
d.rec_status = 0
|
|
and s.plan_start_time <= #{endTime}
|
|
and s.plan_end_time >= #{startTime}
|
|
</select>
|
|
<select id="queryPwbs" resultType="com.ccsensptos.tallsdk.bean.vo.TallProjectVo$ProjectInfo">
|
|
SELECT
|
|
d.id,
|
|
d.`name`,
|
|
s.plan_start_time as startTime,
|
|
s.plan_end_time as endTime
|
|
FROM
|
|
t_pro_task_detail d
|
|
LEFT JOIN t_pro_task_sub s on d.id = s.task_detail_id and s.rec_status = 0
|
|
LEFT JOIN t_label_business lb on d.id = lb.business_id and lb.rec_status = 0
|
|
LEFT JOIN t_label l on l.id = lb.label_id and l.rec_status = 0
|
|
LEFT JOIN t_pro_parent_task p on d.id = p.task_detail_id and p.rec_status = 0
|
|
WHERE
|
|
l.label_type_id = 2
|
|
and p.parent_task_detail_id = #{parentId}
|
|
and
|
|
l.`level` = 0
|
|
and
|
|
d.rec_status = 0
|
|
and s.plan_start_time <= #{endTime}
|
|
and s.plan_end_time >= #{startTime}
|
|
</select>
|
|
<select id="pageQueryRegularTask" resultType="com.ccsensptos.tallsdk.bean.vo.TallTaskVo$QueryTask">
|
|
SELECT
|
|
alltask.*
|
|
FROM
|
|
(
|
|
SELECT
|
|
ts.id,
|
|
td.id AS detailId,
|
|
td.`name`,
|
|
td.description,
|
|
ts.plan_start_time AS planStart,
|
|
ts.plan_duration,
|
|
ts.plan_end_time,
|
|
ts.real_end_time,
|
|
ts.real_start_time AS realStart,
|
|
ts.real_duration,
|
|
ts.task_status AS process,
|
|
tf.flow_type AS skip,
|
|
tf.jump_task_detail_id AS skipTaskId,
|
|
tpi.back_color AS backgroundColor,
|
|
tpi.round_corner AS borderRadius,
|
|
tpi.border AS border,
|
|
tpi.shadow AS shadow,
|
|
tpi.width AS width,
|
|
tpi.height AS height,
|
|
tpi.`row` AS `row`,
|
|
tpi.col AS col
|
|
FROM
|
|
t_pro_task_detail AS td
|
|
LEFT JOIN t_pro_task_sub AS ts ON ts.task_detail_id = td.id
|
|
LEFT JOIN t_pro_task_flow AS tf ON tf.task_detail_id = td.id AND tf.rec_status = 0
|
|
LEFT JOIN t_pro_role_task AS rt ON rt.task_id = td.id
|
|
LEFT JOIN t_pro_task_panel_info AS tpi ON tpi.task_detail_id = td.id AND tpi.rec_status = 0
|
|
LEFT JOIN t_label_business AS lb ON td.id = lb.business_id
|
|
LEFT JOIN t_label AS l ON l.id = lb.label_id
|
|
LEFT JOIN t_label_type AS lt ON lt.id = l.label_type_id
|
|
WHERE
|
|
td.rec_status = 0
|
|
AND ts.rec_status = 0
|
|
AND lb.rec_status = 0
|
|
AND l.rec_status = 0
|
|
AND lt.rec_status = 0
|
|
AND rt.rec_status = 0
|
|
AND lb.business_type = 0
|
|
AND l.`level` = 3
|
|
AND lt.label_type = 1
|
|
AND ts.plan_start_time != 0
|
|
AND ts.plan_duration != 0
|
|
AND rt.role_id = #{roleId}
|
|
<if test="queryType == 0">
|
|
AND plan_start_time < #{timeNode}
|
|
</if>
|
|
<if test="queryType == 1">
|
|
AND plan_start_time >= #{timeNode}
|
|
</if>
|
|
) AS alltask
|
|
LEFT JOIN t_label_business AS llbb ON alltask.detailId = llbb.business_id
|
|
LEFT JOIN t_label AS ll ON llbb.label_id = ll.id
|
|
LEFT JOIN t_label_type AS lltt ON ll.label_type_id = lltt.id
|
|
WHERE
|
|
llbb.rec_status = 0
|
|
AND ll.rec_status = 0
|
|
AND lltt.rec_status = 0
|
|
AND lltt.label_type = 0
|
|
AND llbb.business_type = 0
|
|
AND ll.`level` >= #{timeUnit}
|
|
<if test="queryType == 0">
|
|
ORDER BY alltask.planStart DESC,id DESC
|
|
</if>
|
|
<if test="queryType == 1">
|
|
ORDER BY alltask.planStart,id
|
|
</if>
|
|
</select>
|
|
<select id="getDeliverPluginIdBySubTaskId" resultType="java.lang.Long">
|
|
SELECT
|
|
p.id
|
|
FROM
|
|
t_pro_task_plugin p,
|
|
t_pro_task_sub s
|
|
WHERE
|
|
p.task_detail_id = s.task_detail_id
|
|
and p.rec_status = 0
|
|
and s.rec_status = 0
|
|
and s.id = #{taskSubId}
|
|
and p.plugin_id = 15
|
|
limit 1
|
|
</select>
|
|
<select id="getTaskTypeBySubTaskId" resultType="java.lang.Byte">
|
|
SELECT
|
|
if(Max(l.`level`) = 3, 1,0) as taskType
|
|
FROM
|
|
t_pro_task_sub s,
|
|
t_label_business b,
|
|
t_label l
|
|
WHERE
|
|
s.id = #{taskSubId}
|
|
and s.task_detail_id = b.business_id
|
|
and b.label_id = l.id
|
|
and l.label_type_id = 2
|
|
and s.rec_status = 0
|
|
and b.rec_status = 0
|
|
and l.rec_status = 0
|
|
</select>
|
|
|
|
<select id="getWbsTaskByProjectId" resultType="com.ccsensptos.tallsdk.bean.vo.TallWbsVo$WbsTaskInfo">
|
|
SELECT
|
|
d.id as firstId,
|
|
d.`name` as firstName
|
|
FROM
|
|
t_pro_parent_task p,
|
|
t_pro_task_detail d
|
|
WHERE
|
|
p.task_detail_id = d.id
|
|
and p.parent_task_detail_id = #{projectId}
|
|
and p.rec_status = 0
|
|
and d.rec_status = 0
|
|
</select>
|
|
<select id="getSecondTask" resultType="com.ccsensptos.tallsdk.bean.vo.TallWbsVo$WbsSecondTask">
|
|
SELECT
|
|
task.*,
|
|
Max(case tp.plgin_row when 1 then tp.id else 0 end ) pluginOneId,
|
|
Max(case tp.plgin_row when 1 then tp.`code` else null end ) pluginOneName,
|
|
Max(case tp.plgin_row when 2 then tp.id else 0 end ) pluginTwoId,
|
|
Max(case tp.plgin_row when 2 then tp.`code` else null end ) pluginTwoName,
|
|
Max(case tp.plgin_row when 3 then tp.id else 0 end ) pluginThreeId,
|
|
Max(case tp.plgin_row when 3 then tp.`code` else null end ) pluginThreeName
|
|
FROM
|
|
(
|
|
SELECT
|
|
d.id as detailId,
|
|
s.id as subId,
|
|
d.`name` as taskName,
|
|
d.description,
|
|
if(s.plan_start_time = 0,0,FROM_UNIXTIME(s.plan_start_time/1000,'%Y-%m-%d %H:%i')) as startTime,
|
|
if(s.plan_end_time = 0,0,FROM_UNIXTIME(s.plan_end_time/1000,'%Y-%m-%d %H:%i')) as endTime,
|
|
(SELECT l.description FROM t_label_business b LEFT JOIN t_label l on l.id = b.label_id and l.rec_status = 0 WHERE b.business_id = d.id and b.rec_status = 0 and b.business_type = 0 and label_type_id = 3 limit 1) as label,
|
|
GROUP_CONCAT(r1.`name` ORDER BY rt.id) as executor,
|
|
GROUP_CONCAT(r2.`name` ORDER BY rt.id) as checker,
|
|
de.id as deliverId,
|
|
de.`name` as deliverName
|
|
FROM
|
|
t_pro_parent_task p
|
|
LEFT JOIN t_pro_task_detail d on p.task_detail_id = d.id
|
|
LEFT JOIN t_pro_task_sub s on d.id = s.task_detail_id and s.rec_status = 0
|
|
LEFT JOIN t_pro_role_task rt on d.id = rt.task_id and rt.rec_status = 0
|
|
LEFT JOIN t_pro_role r1 on rt.role_id = r1.id and r1.rec_status = 0 and rt.role_duty = 0
|
|
LEFT JOIN t_pro_role r2 on rt.role_id = r2.id and r2.rec_status = 0 and rt.role_duty = 1
|
|
LEFT JOIN t_plu_deliver de on de.task_sub_id = s.id and de.rec_status = 0
|
|
WHERE
|
|
p.task_detail_id = d.id
|
|
and p.parent_task_detail_id = #{firstId}
|
|
and p.rec_status = 0
|
|
and d.rec_status = 0
|
|
GROUP BY s.id
|
|
) task
|
|
LEFT JOIN t_pro_task_plugin tp on tp.task_detail_id = task.detailId and tp.rec_status = 0
|
|
GROUP BY task.subId
|
|
</select>
|
|
</mapper>
|