| 3024 |
mandeep.dh |
1 |
<?xml version="1.0" encoding="UTF-8"?>
|
|
|
2 |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
3 |
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
4 |
|
|
|
5 |
<mapper namespace="in.shop2020.crm.persistence.ActivityMapper">
|
|
|
6 |
<resultMap type="activity" id="activityResult">
|
|
|
7 |
<id property="id" column="id"/>
|
| 3390 |
mandeep.dh |
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>
|
| 3024 |
mandeep.dh |
22 |
</resultMap>
|
|
|
23 |
|
|
|
24 |
<insert id="insertActivity" parameterType="activity" useGeneratedKeys="true" keyProperty="id">
|
|
|
25 |
INSERT INTO activity
|
| 3106 |
mandeep.dh |
26 |
(customerId, ticketAssigneeId, description, ticketId, creatorId, type, creationTimestamp,
|
| 3390 |
mandeep.dh |
27 |
ticketPriority, ticketStatus, ticketCategory, ticketDescription, userEmailId, customerMobileNumber,
|
|
|
28 |
isRead, customerEmailId, customerName)
|
| 3024 |
mandeep.dh |
29 |
VALUES
|
| 3106 |
mandeep.dh |
30 |
(#{customerId}, #{ticketAssigneeId}, #{description}, #{ticketId}, #{creatorId}, #{type}, NOW(),
|
| 3390 |
mandeep.dh |
31 |
#{ticketPriority}, #{ticketStatus}, #{ticketCategory}, #{ticketDescription}, #{userEmailId},
|
|
|
32 |
#{customerMobileNumber}, #{isRead}, #{customerEmailId}, #{customerName})
|
| 3024 |
mandeep.dh |
33 |
</insert>
|
|
|
34 |
|
| 3390 |
mandeep.dh |
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
|
|
|
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">
|
|
|
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>
|
|
|
85 |
ORDER BY a.creationTimestamp DESC
|
| 3024 |
mandeep.dh |
86 |
</select>
|
|
|
87 |
|
| 3390 |
mandeep.dh |
88 |
<update id="markAsRead" parameterType="long">
|
|
|
89 |
UPDATE activity
|
|
|
90 |
SET isRead = 1
|
| 3024 |
mandeep.dh |
91 |
WHERE id = #{activityId}
|
| 3390 |
mandeep.dh |
92 |
</update>
|
| 3024 |
mandeep.dh |
93 |
</mapper>
|