tj
2025-06-05 2d549a04870d1315868a7cf19952b64e8071e711
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
<?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.cloudroam.mapper.ProjectTaskMapperCustom">
 
    <select id="selectProjectTaskPage" resultType="com.cloudroam.vo.projectTask.ProjectTaskVO">
        SELECT t.*,i.project_name as project_name_src,m.module_name as module_name_src,
        (select sum(actual_hours) from project_daily d where d.task_id=t.id ) as total_actual_hour,
        t.plan_hour-(select sum(actual_hours) from project_daily d where d.task_id=t.id ) as compute_left_hour
        FROM project_task t
        left join project_info i
        on t.project_id=i.id
        left join project_module m
        on t.module_id=m.id
        where 1=1
        <include refid="where_cause"></include>
        order by t.create_time desc
    </select>
 
    <select id="getProjectTaskMineTodoPage" resultType="com.cloudroam.vo.projectTask.ProjectTaskVO">
        SELECT t.*,td.id as dev_id,td.developer_task_status,i.project_name as project_name_src,m.module_name as module_name_src
        FROM project_task t
        left join project_info i
        on t.project_id=i.id
        left join project_module m
        on t.module_id=m.id
        left join project_task_developer td
        on t.id = td.task_id
        where td.is_deleted = 0 and td.developer_id = #{dto.curDeveloperUserId} and td.developer_task_status not in ('FY')
        <include refid="where_cause"></include>
        order by t.create_time desc
    </select>
 
    <sql id="where_cause">
        and  t.is_deleted = 0
        <if test="dto.projectId != null and dto.projectId != ''">
            AND t.project_id = #{dto.projectId}
        </if>
        <if test="dto.moduleIds != null and dto.moduleIds.size() > 0 ">
            AND t.module_id IN
            <foreach collection="dto.moduleIds" item="moduleId" index="index" open="(" close=")" separator=",">
                #{moduleId}
            </foreach>
        </if>
        <if test="dto.keyword != null and dto.keyword != ''">
            and (
            t.name like concat('%',#{dto.keyword},'%')
            or t.description like concat('%',#{dto.keyword},'%')
            )
        </if>
        <if test="dto.type != null and dto.type != ''">
            AND t.type = #{dto.type}
        </if>
 
        <if test="dto.priority != null and dto.priority != ''">
            AND t.priority = #{dto.priority}
        </if>
 
        <if test="dto.statusList != null and dto.statusList.size() > 0 ">
            AND t.`status` IN
            <foreach collection="dto.statusList" item="status" index="index" open="(" close=")" separator=",">
                #{status}
            </foreach>
        </if>
 
        <if test="dto.assignStatus != null and dto.assignStatus != ''">
            AND t.assign_status = #{dto.assignStatus}
        </if>
 
        <if test="dto.evaluatorUsers != null and dto.evaluatorUsers.size() > 0 ">
            AND t.id IN (
            select e.task_id from project_task_evaluator e where e.evaluator_id in
            <foreach collection="dto.evaluatorUsers" item="user" index="index" open="(" close=")" separator=",">
                #{user}
            </foreach>
            )
        </if>
 
        <if test="dto.developerUsers != null and dto.developerUsers.size() > 0 ">
            AND t.id IN (
            select e.task_id from project_task_developer e where e.developer_id in
            <foreach collection="dto.developerUsers" item="user" index="index" open="(" close=")" separator=",">
                #{user}
            </foreach>
            )
        </if>
 
        <if test="dto.planBeginDate != null and dto.planEndDate != null">
            AND (
            t.plan_begin_date BETWEEN #{dto.planBeginDate} AND #{dto.planEndDate}
            or t.plan_end_date BETWEEN #{dto.planBeginDate} AND #{dto.planEndDate}
            )
        </if>
        <!--        <if test="dto.planBeginDate != null " >-->
        <!--            AND t.plan_begin_date &gt;= #{dto.planBeginDate}-->
        <!--        </if>-->
 
        <!--        <if test="dto.planEndDate != null  " >-->
        <!--            AND t.plan_begin_date &lt;= #{dto.planEndDate}-->
        <!--        </if>-->
    </sql>
 
</mapper>