Subversion-Projekte lars-tiefland.prado

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?xml version="1.0" encoding="utf-8" ?>
2
<sqlMap>
3
 
4
<insert id="AddNewTimeEntry" parameterClass="TimeEntryRecord">
5
	INSERT INTO time_entry(
6
		EntryCreated,
7
		Duration,
8
		Description,
9
		CategoryID,
10
		EntryDate,
11
		CreatorID,
12
		UserID
13
	)
14
	VALUES(
15
		strftime('%s', 'now'),
16
		#Duration#,
17
		#Description#,
18
		#Category.ID#,
19
		#ReportDate, typeHandler=DateTime#,
20
		#CreatorUserName#,
21
		#Username#
22
	)
23
  <selectKey property="ID" type="post" resultClass="int">
24
		select LAST_INSERT_ROWID() as value
25
  </selectKey>
26
</insert>
27
 
28
<resultMap id="time-entry-result" class="TimeEntryRecord">
29
	<result property="ID" column="EntryID" type="integer" />
30
	<result property="DateCreated" column="EntryCreated" typeHandler="DateTime" />
31
	<result property="Duration" column="Duration" type="float" />
32
	<result property="Description" column="Description" />
33
	<result property="Category" column="CategoryID" />
34
	<result property="ReportDate" column="EntryDate" typeHandler="DateTime" />
35
	<result property="CreatorUserName" column="CreatorID" />
36
	<result property="Username" column="UserID" />
37
</resultMap>
38
 
39
<resultMap id="time-entry-category-result" class="TimeEntryRecord">
40
	<result property="ID" column="EntryID" type="integer" />
41
	<result property="DateCreated" column="EntryCreated" typeHandler="DateTime" />
42
	<result property="Duration" column="Duration" type="float" />
43
	<result property="Description" column="Description" />
44
	<result property="Category" resultMapping="entry-category" />
45
	<result property="ReportDate" column="EntryDate" typeHandler="DateTime" />
46
	<result property="CreatorUserName" column="CreatorID" />
47
	<result property="Username" column="UserID" />
48
</resultMap>
49
 
50
<resultMap id="entry-category" class="CategoryRecord">
51
	<result property="ID" column="CategoryID" />
52
	<result property="Name" column="CategoryName" />
53
</resultMap>
54
 
55
<select id="GetTimeEntryByID" resultMap="time-entry-result">
56
	SELECT
57
		*
58
	FROM
59
		time_entry
60
	WHERE
61
		EntryID = #value#
62
</select>
63
 
64
<delete id="DeleteTimeEntry" parameterClass="integer">
65
	DELETE FROM time_entry WHERE EntryID = #value#
66
</delete>
67
 
68
<select id="GetAllTimeEntriesByProjectIdAndUser" resultMap="time-entry-category-result">
69
	SELECT
70
		time_entry.EntryID as EntryID,
71
		time_entry.EntryCreated as EntryCreated,
72
		time_entry.Duration as Duration,
73
		time_entry.Description as Description,
74
		time_entry.EntryDate as EntryDate,
75
		time_entry.CreatorID as CreatorID,
76
		time_entry.UserID as UserID,
77
		time_entry.CategoryID as CategoryID,
78
		categories.Name as CategoryName
79
	FROM
80
		time_entry, categories
81
	WHERE
82
			time_entry.UserID = #username#
83
		AND time_entry.CategoryID = categories.CategoryID
84
		AND categories.ProjectID = #project#
85
	ORDER BY
86
		EntryID ASC
87
</select>
88
 
89
<update id="UpdateTimeEntry" parameterClass="TimeEntryRecord">
90
	UPDATE time_entry SET
91
		Duration = #Duration#,
92
		Description = #Description#,
93
		CategoryID = #Category.ID#,
94
		EntryDate = #ReportDate, typeHandler=DateTime#,
95
		UserID = #Username#
96
	WHERE
97
		EntryID = #ID#
98
</update>
99
 
100
</sqlMap>