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.

185 lines
7.1 KiB

4 years ago
<?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.IInputDocDao">
4 years ago
<resultMap id="ass" type="com.ccsens.tall.bean.vo.TaskVo$NormalTask">
<id property="projectId" column="pId"/>
<result property="projectName" column="pName"/>
<result property="description" column="pDescription"/>
<result property="beginTime" column="pBeginTime"/>
<result property="endTime" column="pEndTime"/>
<result property="duration" column="pDuration"/>
<collection property="secondTasks" ofType="com.ccsens.tall.bean.vo.TaskVo$NormalTask">
<result property="detailId" column="task_id"/>
<result property="id" column="times_id"/>
<result property="name" column="name"/>
<result property="description" column="description"/>
<result property="beginTime" column="begin_time_sub_time"/>
<result property="endTime" column="end_time_sub_time"/>
<result property="duration" column="duration"/>
<result property="cycle" column="cycle"/>
<result property="priority" column="priority"/>
<result property="milestone" column="milestone"/>
<result property="hasGroup" column="has_group"/>
4 years ago
</collection>
</resultMap>
4 years ago
<select id="selectByCompany" resultMap="ass">
4 years ago
SELECT
4 years ago
tsp.id AS pId,
tsp.`name` AS pName,
tsp.description AS pDescription,
tsp.begin_time as pBeginTime,
tsp.end_time as pEndTime,
4 years ago
(tsp.end_time-tsp.begin_time) as pDuration,
4 years ago
tptdt.id as task_id,
tptdt.name,
tptdt.description,
tptdt.begin_time_sub_time,
tptdt.end_time_sub_time,
4 years ago
(tptdt.end_time_sub_time-tptdt.begin_time_sub_time) as duration,
4 years ago
tptdt.cycle,
tptdt.priority,
tptdt.milestone,
tptdt.has_group,
tptdt.times_id
4 years ago
FROM
4 years ago
t_sys_project tsp
INNER JOIN t_pro_member tpm ON tpm.project_id = tsp.id AND tpm.user_id = #{userId} and tpm.rec_status=0
<if test="param.id!=null">
and tpm.project_id=#{param.id}
</if>
LEFT JOIN (
SELECT
tptd.*,
tptst.begin_time AS begin_time_sub_time,
tptst.end_time AS end_time_sub_time,
tptst.id as times_id
FROM
t_pro_task_detail tptd
LEFT JOIN t_pro_task_sub_time tptst ON tptd.id = tptst.task_detail_id
AND tptst.rec_status = 0
4 years ago
WHERE
4 years ago
tptd.rec_status = 0
AND tptd.`level` = 2
AND tptst.begin_time &lt;= #{param.endTime} AND tptst.end_time &gt;= #{param.startTime}
4 years ago
AND tptd.executor_role IN (
SELECT
tpmr.role_id
FROM
4 years ago
t_pro_member_role tpmr,
t_pro_member tpm
4 years ago
WHERE
4 years ago
tpm.rec_status = 0
AND tpmr.rec_status = 0
AND tpm.user_id = #{userId} UNION
SELECT
tpr.id
FROM
t_pro_role tpr
WHERE
tpr.rec_status = 0
AND tpr.NAME = '全体成员'
4 years ago
)
4 years ago
) tptdt ON tptdt.project_id = tsp.id
WHERE
tsp.rec_status = 0
AND tsp.begin_time &lt;= #{param.endTime} AND tsp.end_time &gt;= #{param.startTime}
<if test="param.id!=null">
and tsp.id =#{param.id}
4 years ago
</if>
</select>
4 years ago
<resultMap type="com.ccsens.tall.bean.vo.TaskVo$NormalTask" id="selByTwoTaskIdResaultMap">
<id property="id" column="times_id"/>
<result property="detailId" column="id"/>
<result property="name" column="name"/>
<result property="description" column="description"/>
<result property="beginTime" column="begin_time_sub_time"/>
<result property="endTime" column="end_time_sub_time"/>
<result property="duration" column="duration"/>
<result property="cycle" column="cycle"/>
<result property="priority" column="priority"/>
<result property="milestone" column="milestone"/>
<result property="hasGroup" column="has_group"/>
<result property="projectId" column="project_id" />
</resultMap>
<select id="selByTwoTaskId" resultMap="selByTwoTaskIdResaultMap">
SELECT
tptd.*,
tptst.begin_time AS begin_time_sub_time,
tptst.end_time AS end_time_sub_time,
(tptst.end_time-tptst.begin_time)/1000/3600/24 as duration,
tptst.id as times_id
FROM
t_pro_task_detail tptd
LEFT JOIN t_pro_task_sub_time tptst ON tptd.id = tptst.task_detail_id
AND tptst.rec_status = 0
WHERE
tptd.rec_status = 0
and tptd.parent_id=#{taskId}
AND tptst.begin_time &lt;= #{param.endTime} AND tptst.end_time &gt;= #{param.startTime}
</select>
<!-- <select id="findDocByTask" resultMap="DocAndFile">-->
<!-- SELECT-->
<!-- tid.id AS docId,-->
<!-- tid.name AS docName,-->
<!-- tid.is_upload AS isUpload,-->
<!-- tir.id AS recordId,-->
<!-- tf.file_name AS fileName,-->
<!-- tf.visit_location AS fileUrl-->
<!-- FROM-->
<!-- t_pro_task_input_doc AS tid-->
<!-- LEFT JOIN t_pro_task_input_record AS tir ON tid.id = tir.input_doc_id-->
<!-- LEFT JOIN t_file AS tf ON tir.file_id = tf.id-->
<!-- WHERE-->
<!-- tid.task_detail_id = #{taskId}-->
<!-- AND tid.is_upload = 1-->
<!-- AND tid.rec_status = 0-->
<!-- AND tir.rec_status = 0-->
<!-- AND tf.rec_status = 0-->
<!-- </select>-->
<resultMap id="DocAndFile" type="com.ccsens.tall.bean.vo.InputDocVo$DocOfTask">
<id property="docId" column="docId" />
<id property="docName" column="docName"/>
<result property="isUpload" column="isUpload"/>
<collection property="records" ofType="com.ccsens.tall.bean.vo.InputDocVo$Record">
<id column="recordId" property="recordId" />
<result column="fileIds" property="fileIds"/>
<result column="remark" property="remark"/>
</collection>
</resultMap>
<select id="findDocByTask" resultMap="DocAndFile">
SELECT
tid.id AS docId,
tid. NAME AS docName,
tid.is_upload AS isUpload,
tir.id AS recordId,
tir.file_id AS fileIds,
tir.remark AS remark
FROM
t_pro_task_input_doc AS tid
LEFT JOIN t_pro_task_input_record AS tir ON tid.id = tir.input_doc_id and tir.rec_status = 0
WHERE
tid.task_detail_id = #{taskId}
AND tid.rec_status = 0
</select>
<select id="viewDocHistory" resultType="com.ccsens.tall.bean.vo.InputDocVo$HistoryRecord">
SELECT
tir.id,
tf.file_name,
tf.visit_location,
tir.`status`
FROM
t_pro_task_input_record AS tir
LEFT JOIN t_file AS tf ON tir.file_id = tf.id
LEFT JOIN t_pro_task_input_doc AS tid ON tid.id = tir.input_doc_id
WHERE
tid.id = #{docId}
ORDER BY
tir.created_at DESC
</select>
4 years ago
4 years ago
</mapper>