| 1 |
lars |
1 |
<?xml version="1.0" encoding="utf-8" ?>
|
|
|
2 |
<sqlMap>
|
|
|
3 |
|
|
|
4 |
<resultMap id="project-category-user" class="ProjectReport" GroupBy="ProjectID">
|
|
|
5 |
<result property="ProjectName" column="ProjectName" />
|
|
|
6 |
<result property="EstimateHours" column="ProjectEstimate" type="float"/>
|
|
|
7 |
<result property="EstimateCompletion" column="ProjectCompletion" type="DateTime" />
|
|
|
8 |
<result property="Categories" type="TList" resultMapping="category-user-report" />
|
|
|
9 |
</resultMap>
|
|
|
10 |
|
|
|
11 |
<resultMap id="category-user-report" class="CategoryReport" GroupBy="CategoryID" >
|
|
|
12 |
<result property="CategoryName" column="CategoryName" />
|
|
|
13 |
<result property="EstimateHours" column="CategoryEstimate" type="float" />
|
|
|
14 |
<result property="members" type="array" resultMapping="member-report" />
|
|
|
15 |
</resultMap>
|
|
|
16 |
|
|
|
17 |
<resultMap id="member-report" class="array">
|
|
|
18 |
<result property="username" column="Username" />
|
|
|
19 |
<result property="hours" column="ActualDuration" type="float" />
|
|
|
20 |
</resultMap>
|
|
|
21 |
|
|
|
22 |
<select id="GetTimeReportByProjectIDs" resultMap="project-category-user">
|
|
|
23 |
SELECT
|
|
|
24 |
categories.Name as CategoryName,
|
|
|
25 |
categories.CategoryID as CategoryID,
|
|
|
26 |
project.ProjectID as ProjectID,
|
|
|
27 |
categories.EstimateDuration as CategoryEstimate,
|
|
|
28 |
project.Name as ProjectName,
|
|
|
29 |
project.EstimateDuration as ProjectEstimate,
|
|
|
30 |
project.CompletionDate as ProjectCompletion,
|
|
|
31 |
time_entry.UserID as Username,
|
|
|
32 |
SUM(time_entry.Duration) as ActualDuration
|
|
|
33 |
FROM
|
|
|
34 |
project
|
|
|
35 |
LEFT JOIN categories ON categories.ProjectID = project.ProjectID
|
|
|
36 |
LEFT JOIN time_entry ON categories.CategoryID = time_entry.CategoryID
|
|
|
37 |
WHERE
|
|
|
38 |
project.ProjectID IN ( $value$ )
|
|
|
39 |
GROUP BY
|
|
|
40 |
categories.ProjectID,
|
|
|
41 |
categories.CategoryID,
|
|
|
42 |
time_entry.UserID
|
|
|
43 |
ORDER BY
|
|
|
44 |
project.ProjectID
|
|
|
45 |
</select>
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
<resultMap id="time-entry-user-report" class="UserReport" GroupBy="Username">
|
|
|
49 |
<result property="Username" column="Username" />
|
|
|
50 |
<result property="Projects" resultMapping="project-user-report" />
|
|
|
51 |
</resultMap>
|
|
|
52 |
|
|
|
53 |
<resultMap id="project-user-report" class="UserProjectReport">
|
|
|
54 |
<result property="ProjectName" column="ProjectName" />
|
|
|
55 |
<result property="CategoryName" column="CategoryName" />
|
|
|
56 |
<result property="Duration" column="Duration" type="float" />
|
|
|
57 |
<result property="Description" column="Description" />
|
|
|
58 |
<result property="ReportDate" column="EntryDate" type="DateTime" />
|
|
|
59 |
</resultMap>
|
|
|
60 |
|
|
|
61 |
<select id="GetTimeReportByUsername" resultMap="time-entry-user-report">
|
|
|
62 |
SELECT
|
|
|
63 |
users.Username,
|
|
|
64 |
project.Name as ProjectName,
|
|
|
65 |
categories.Name as CategoryName,
|
|
|
66 |
time_entry.Duration,
|
|
|
67 |
time_entry.Description,
|
|
|
68 |
time_entry.EntryDate
|
|
|
69 |
FROM
|
|
|
70 |
users
|
|
|
71 |
LEFT JOIN time_entry ON time_entry.UserID = users.Username
|
|
|
72 |
AND time_entry.EntryDate BETWEEN
|
|
|
73 |
#startDate, typeHandler=DateTime# AND
|
|
|
74 |
#endDate, typeHandler=DateTime#
|
|
|
75 |
LEFT JOIN categories ON time_entry.CategoryID = categories.CategoryID
|
|
|
76 |
LEFT JOIN project ON categories.ProjectID = project.ProjectID
|
|
|
77 |
AND project.ProjectID in ($projects$)
|
|
|
78 |
WHERE
|
|
|
79 |
users.Username in ($members$)
|
|
|
80 |
ORDER BY
|
|
|
81 |
users.Username ASC,
|
|
|
82 |
time_entry.EntryDate ASC,
|
|
|
83 |
project.Name ASC,
|
|
|
84 |
categories.Name ASC
|
|
|
85 |
</select>
|
|
|
86 |
|
|
|
87 |
</sqlMap>
|