78 lines
3.4 KiB
XML
78 lines
3.4 KiB
XML
|
<?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.dite.znpt.mapper.ProjectTaskMapper">
|
||
|
|
||
|
<sql id="Base_Column_List">
|
||
|
a.task_id, a.task_group_id, a.task_name, a.task_code,
|
||
|
a.main_user_id, a.user_ids, a.plan_start_date, a.plan_end_date,
|
||
|
a.actual_start_date, a.actual_end_date, a.status, a.overdue_status,
|
||
|
a.update_by, a.create_time, a.create_by, a.update_time
|
||
|
</sql>
|
||
|
|
||
|
<select id="queryBySelective" resultType="com.dite.znpt.domain.vo.ProjectTaskResp">
|
||
|
select
|
||
|
<include refid="Base_Column_List"/>
|
||
|
from project_task a
|
||
|
left join user u on a.main_user_id=u.user_id
|
||
|
<where>
|
||
|
<if test="keyword != null and keyword != ''">
|
||
|
and (a.task_name like concat('%', #{keyword,jdbcType=VARCHAR}, '%') or a.task_code like concat('%', #{keyword,jdbcType=VARCHAR}, '%'))
|
||
|
</if>
|
||
|
<if test="taskId != null and taskId != ''">
|
||
|
and a.task_id like concat ('%', #{taskId}, '%')
|
||
|
</if>
|
||
|
<if test="taskGroupId != null and taskGroupId != ''">
|
||
|
and a.task_group_id like concat ('%', #{taskGroupId}, '%')
|
||
|
</if>
|
||
|
<if test="taskName != null and taskName != ''">
|
||
|
and a.task_name like concat ('%', #{taskName}, '%')
|
||
|
</if>
|
||
|
<if test="taskCode != null and taskCode != ''">
|
||
|
and a.task_code like concat ('%', #{taskCode}, '%')
|
||
|
</if>
|
||
|
<if test="mainUserId != null and mainUserId != ''">
|
||
|
and a.main_user_id like concat ('%', #{mainUserId}, '%')
|
||
|
</if>
|
||
|
<if test="userIds != null and userIds != ''">
|
||
|
and a.user_ids like concat ('%', #{userIds}, '%')
|
||
|
</if>
|
||
|
<if test="planStartDate != null">
|
||
|
and a.plan_start_date = #{planStartDate}
|
||
|
</if>
|
||
|
<if test="planEndDate != null">
|
||
|
and a.plan_end_date = #{planEndDate}
|
||
|
</if>
|
||
|
<if test="actualStartDate != null">
|
||
|
and a.actual_start_date = #{actualStartDate}
|
||
|
</if>
|
||
|
<if test="actualEndDate != null">
|
||
|
and a.actual_end_date = #{actualEndDate}
|
||
|
</if>
|
||
|
<if test="status != null">
|
||
|
and a.status = #{status}
|
||
|
</if>
|
||
|
<if test="overdueStatus != null">
|
||
|
and a.overdue_status = #{overdueStatus}
|
||
|
</if>
|
||
|
<if test="taskNameOrMainUser != null and taskNameOrMainUser != ''">
|
||
|
and (a.task_name like concat ('%', #{taskNameOrMainUser}, '%') or u.name like concat ('%', #{taskNameOrMainUser}, '%') )
|
||
|
</if>
|
||
|
</where>
|
||
|
</select>
|
||
|
|
||
|
<select id="listAllParents" resultType="com.dite.znpt.domain.entity.ProjectTaskEntity">
|
||
|
WITH RECURSIVE task_tree AS (
|
||
|
SELECT *
|
||
|
FROM project_task pt
|
||
|
WHERE task_id = #{taskId} -- 起始父级任务ID
|
||
|
|
||
|
UNION ALL
|
||
|
|
||
|
SELECT t.*
|
||
|
FROM project_task t
|
||
|
INNER JOIN task_tree tt ON t.task_id = tt.parent_task_id
|
||
|
) select * from task_tree
|
||
|
</select>
|
||
|
</mapper>
|
||
|
|