| Line 3... |
Line 3... |
| 3 |
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
3 |
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
| 4 |
|
4 |
|
| 5 |
<mapper namespace="in.shop2020.crm.persistence.ActivityMapper">
|
5 |
<mapper namespace="in.shop2020.crm.persistence.ActivityMapper">
|
| 6 |
<resultMap type="activity" id="activityResult">
|
6 |
<resultMap type="activity" id="activityResult">
|
| 7 |
<id property="id" column="id"/>
|
7 |
<id property="id" column="id"/>
|
| - |
|
8 |
<association property="creator" column="creatorId" javaType="agent">
|
| - |
|
9 |
<id property="id" column="creator_id"/>
|
| - |
|
10 |
<result property="name" column="creator_name"/>
|
| - |
|
11 |
<result property="emailId" column="creator_emailId"/>
|
| - |
|
12 |
<result property="password" column="creator_password"/>
|
| - |
|
13 |
<result property="managerId" column="creator_managerId"/>
|
| - |
|
14 |
</association>
|
| - |
|
15 |
<association property="ticketAssignee" column="ticketAssigneeId" javaType="agent">
|
| - |
|
16 |
<id property="id" column="ticketAssignee_id"/>
|
| - |
|
17 |
<result property="name" column="ticketAssignee_name"/>
|
| - |
|
18 |
<result property="emailId" column="ticketAssignee_emailId"/>
|
| - |
|
19 |
<result property="password" column="ticketAssignee_password"/>
|
| - |
|
20 |
<result property="managerId" column="ticketAssignee_managerId"/>
|
| - |
|
21 |
</association>
|
| 8 |
</resultMap>
|
22 |
</resultMap>
|
| 9 |
|
23 |
|
| 10 |
<insert id="insertActivity" parameterType="activity" useGeneratedKeys="true" keyProperty="id">
|
24 |
<insert id="insertActivity" parameterType="activity" useGeneratedKeys="true" keyProperty="id">
|
| 11 |
INSERT INTO activity
|
25 |
INSERT INTO activity
|
| 12 |
(customerId, ticketAssigneeId, description, ticketId, creatorId, type, creationTimestamp,
|
26 |
(customerId, ticketAssigneeId, description, ticketId, creatorId, type, creationTimestamp,
|
| 13 |
ticketPriority, ticketStatus, ticketCategory, ticketDescription, emailId, customerMobileNumber)
|
27 |
ticketPriority, ticketStatus, ticketCategory, ticketDescription, userEmailId, customerMobileNumber,
|
| - |
|
28 |
isRead, customerEmailId, customerName)
|
| 14 |
VALUES
|
29 |
VALUES
|
| 15 |
(#{customerId}, #{ticketAssigneeId}, #{description}, #{ticketId}, #{creatorId}, #{type}, NOW(),
|
30 |
(#{customerId}, #{ticketAssigneeId}, #{description}, #{ticketId}, #{creatorId}, #{type}, NOW(),
|
| 16 |
#{ticketPriority}, #{ticketStatus}, #{ticketCategory}, #{ticketDescription}, #{emailId}, #{customerMobileNumber})
|
31 |
#{ticketPriority}, #{ticketStatus}, #{ticketCategory}, #{ticketDescription}, #{userEmailId},
|
| - |
|
32 |
#{customerMobileNumber}, #{isRead}, #{customerEmailId}, #{customerName})
|
| 17 |
</insert>
|
33 |
</insert>
|
| 18 |
|
34 |
|
| 19 |
<select id="getActivities" parameterType="long" resultType="activity">
|
35 |
<select id="getActivities" parameterType="searchFilter" resultType="activity">
|
| - |
|
36 |
SELECT a.*,
|
| - |
|
37 |
c.id AS creator_id,
|
| - |
|
38 |
c.name AS creator_name,
|
| - |
|
39 |
c.emailId AS creator_emailId,
|
| - |
|
40 |
c.password AS creator_password,
|
| - |
|
41 |
c.managerId AS creator_managerId,
|
| - |
|
42 |
t.id AS ticketAssignee_id,
|
| - |
|
43 |
t.name AS ticketAssignee_name,
|
| - |
|
44 |
t.emailId AS ticketAssignee_emailId,
|
| - |
|
45 |
t.password AS ticketAssignee_password,
|
| - |
|
46 |
t.managerId AS ticketAssignee_managerId
|
| 20 |
SELECT * FROM activity
|
47 |
FROM activity a
|
| - |
|
48 |
LEFT JOIN agent c
|
| - |
|
49 |
ON (c.id = a.creatorId)
|
| - |
|
50 |
LEFT JOIN agent t
|
| - |
|
51 |
ON (t.id = a.ticketAssigneeId)
|
| - |
|
52 |
<where>
|
| - |
|
53 |
<if test="ticketId != null">
|
| - |
|
54 |
AND a.ticketId = #{ticketId}
|
| - |
|
55 |
</if>
|
| - |
|
56 |
<if test="activityId != null">
|
| - |
|
57 |
AND a.id = #{activityId}
|
| - |
|
58 |
</if>
|
| - |
|
59 |
<if test="activityCreatorIds != null">
|
| - |
|
60 |
AND a.creatorId IN
|
| - |
|
61 |
<foreach collection="activityCreatorIds" item="activityCreatorId"
|
| - |
|
62 |
index="index" open="(" close=")" separator=",">
|
| - |
|
63 |
#{activityCreatorId}
|
| - |
|
64 |
</foreach>
|
| - |
|
65 |
</if>
|
| - |
|
66 |
<if test="customerId != null">
|
| 21 |
WHERE customerId = #{customerId}
|
67 |
AND a.customerId = #{customerId}
|
| - |
|
68 |
</if>
|
| - |
|
69 |
<if test="startTimestamp != null">
|
| - |
|
70 |
AND a.creationTimestamp > #{startTimestamp}
|
| - |
|
71 |
</if>
|
| - |
|
72 |
<if test="endTimestamp != null">
|
| - |
|
73 |
AND a.creationTimestamp < #{endTimestamp}
|
| - |
|
74 |
</if>
|
| - |
|
75 |
<if test="customerEmailId != null">
|
| - |
|
76 |
AND a.customerEmailId = #{customerEmailId}
|
| - |
|
77 |
</if>
|
| - |
|
78 |
<if test="customerMobileNumber != null">
|
| - |
|
79 |
AND a.customerMobileNumber = #{customerMobileNumber}
|
| - |
|
80 |
</if>
|
| - |
|
81 |
<if test="isActivityRead != null">
|
| - |
|
82 |
AND a.isRead = #{isActivityRead}
|
| - |
|
83 |
</if>
|
| - |
|
84 |
</where>
|
| 22 |
ORDER BY creationTimestamp DESC
|
85 |
ORDER BY a.creationTimestamp DESC
|
| 23 |
</select>
|
86 |
</select>
|
| 24 |
|
87 |
|
| 25 |
<select id="getActivitiesByCreator" parameterType="long" resultType="activity">
|
88 |
<update id="markAsRead" parameterType="long">
|
| 26 |
SELECT * FROM activity
|
89 |
UPDATE activity
|
| 27 |
WHERE creatorId = #{creatorId}
|
- |
|
| 28 |
ORDER BY creationTimestamp DESC
|
- |
|
| 29 |
</select>
|
- |
|
| 30 |
|
- |
|
| 31 |
<select id="getActivitiesForTicket" parameterType="long" resultType="activity">
|
- |
|
| 32 |
SELECT * FROM activity
|
- |
|
| 33 |
WHERE ticketId = #{ticketId}
|
- |
|
| 34 |
ORDER BY creationTimestamp DESC
|
- |
|
| 35 |
</select>
|
- |
|
| 36 |
|
- |
|
| 37 |
<select id="getActivity" parameterType="long" resultType="activity">
|
- |
|
| 38 |
SELECT * FROM activity
|
90 |
SET isRead = 1
|
| 39 |
WHERE id = #{activityId}
|
91 |
WHERE id = #{activityId}
|
| 40 |
</select>
|
92 |
</update>
|
| 41 |
|
- |
|
| 42 |
<select id="getLastActivity" parameterType="long" resultType="activity">
|
- |
|
| 43 |
SELECT * FROM activity
|
- |
|
| 44 |
WHERE ticketId = #{ticketId}
|
- |
|
| 45 |
ORDER BY creationTimestamp DESC
|
- |
|
| 46 |
LIMIT 1
|
- |
|
| 47 |
</select>
|
- |
|
| 48 |
</mapper>
|
93 |
</mapper>
|
| 49 |
|
94 |
|