| 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.TicketMapper">
|
|
|
6 |
<resultMap type="ticket" id="ticketResult">
|
|
|
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="assignee" column="assigneeId" javaType="agent">
|
|
|
16 |
<id property="id" column="assignee_id"/>
|
|
|
17 |
<result property="name" column="assignee_name"/>
|
|
|
18 |
<result property="emailId" column="assignee_emailId"/>
|
|
|
19 |
<result property="password" column="assignee_password"/>
|
|
|
20 |
<result property="managerId" column="assignee_managerId"/>
|
|
|
21 |
</association>
|
| 3024 |
mandeep.dh |
22 |
</resultMap>
|
|
|
23 |
|
|
|
24 |
<insert id="insertTicket" parameterType="ticket" useGeneratedKeys="true" keyProperty="id">
|
|
|
25 |
INSERT INTO ticket
|
| 3106 |
mandeep.dh |
26 |
(customerId, openDate, closeDate, creatorId, description, assigneeId, status,
|
| 3390 |
mandeep.dh |
27 |
priority, category, productName, airwayBillNo, orderId, customerEmailId,
|
|
|
28 |
customerMobileNumber, customerName)
|
| 3024 |
mandeep.dh |
29 |
VALUES
|
| 3106 |
mandeep.dh |
30 |
(#{customerId}, NOW(), #{closeDate}, #{creatorId}, #{description}, #{assigneeId}, #{status},
|
| 3390 |
mandeep.dh |
31 |
#{priority}, #{category}, #{productName}, #{airwayBillNo}, #{orderId}, #{customerEmailId},
|
|
|
32 |
#{customerMobileNumber}, #{customerName})
|
| 3024 |
mandeep.dh |
33 |
</insert>
|
| 3390 |
mandeep.dh |
34 |
|
| 3024 |
mandeep.dh |
35 |
<update id="updateTicket" parameterType="ticket">
|
|
|
36 |
UPDATE ticket
|
|
|
37 |
SET
|
| 3106 |
mandeep.dh |
38 |
<if test="assigneeId != null">
|
|
|
39 |
assigneeId = #{assigneeId},
|
| 3024 |
mandeep.dh |
40 |
</if>
|
| 3106 |
mandeep.dh |
41 |
<if test="status != null">
|
|
|
42 |
status = #{status},
|
|
|
43 |
</if>
|
|
|
44 |
<if test="priority != null">
|
|
|
45 |
priority = #{priority},
|
|
|
46 |
</if>
|
|
|
47 |
<if test="category != null">
|
|
|
48 |
category = #{category},
|
|
|
49 |
</if>
|
|
|
50 |
<if test="description != null">
|
|
|
51 |
description = #{description},
|
|
|
52 |
</if>
|
| 3390 |
mandeep.dh |
53 |
<if test="customerEmailId != null">
|
|
|
54 |
customerEmailId = #{customerEmailId},
|
|
|
55 |
</if>
|
|
|
56 |
<if test="customerName != null">
|
|
|
57 |
customerName = #{customerName},
|
|
|
58 |
</if>
|
|
|
59 |
<if test="customerMobileNumber != null">
|
|
|
60 |
customerMobileNumber = #{customerMobileNumber},
|
|
|
61 |
</if>
|
| 3499 |
mandeep.dh |
62 |
<if test="status != null">
|
|
|
63 |
status = #{status},
|
|
|
64 |
</if>
|
|
|
65 |
<if test="priority != null">
|
|
|
66 |
priority = #{priority},
|
|
|
67 |
</if>
|
|
|
68 |
<if test="category != null">
|
|
|
69 |
category = #{category},
|
|
|
70 |
</if>
|
| 3024 |
mandeep.dh |
71 |
closeDate = #{closeDate}
|
|
|
72 |
WHERE id = #{id}
|
|
|
73 |
</update>
|
|
|
74 |
|
| 3137 |
mandeep.dh |
75 |
<select id="getUnassignedTickets" resultType="ticket">
|
|
|
76 |
SELECT * FROM ticket
|
|
|
77 |
WHERE assigneeId IS NULL
|
|
|
78 |
ORDER BY openDate DESC
|
|
|
79 |
</select>
|
| 3390 |
mandeep.dh |
80 |
|
|
|
81 |
<select id="getTickets" parameterType="searchFilter" resultType="ticket">
|
|
|
82 |
SELECT t.*,
|
|
|
83 |
c.id AS creator_id,
|
|
|
84 |
c.name AS creator_name,
|
|
|
85 |
c.emailId AS creator_emailId,
|
|
|
86 |
c.password AS creator_password,
|
|
|
87 |
c.managerId AS creator_managerId,
|
|
|
88 |
a.id AS assignee_id,
|
|
|
89 |
a.name AS assignee_name,
|
|
|
90 |
a.emailId AS assignee_emailId,
|
|
|
91 |
a.password AS assignee_password,
|
|
|
92 |
a.managerId AS assignee_managerId
|
|
|
93 |
FROM ticket t
|
|
|
94 |
LEFT JOIN agent c
|
|
|
95 |
ON (c.id = t.creatorId)
|
|
|
96 |
LEFT JOIN agent a
|
|
|
97 |
ON (a.id = t.assigneeId)
|
|
|
98 |
<where>
|
|
|
99 |
<if test="ticketId != null">
|
|
|
100 |
AND t.id = #{ticketId}
|
|
|
101 |
</if>
|
|
|
102 |
<if test="ticketAssigneeIds != null">
|
|
|
103 |
AND t.assigneeId IN
|
|
|
104 |
<foreach collection="ticketAssigneeIds" item="ticketAssigneeId"
|
|
|
105 |
index="index" open="(" close=")" separator=",">
|
|
|
106 |
#{ticketAssigneeId}
|
|
|
107 |
</foreach>
|
|
|
108 |
</if>
|
|
|
109 |
<if test="customerId != null">
|
|
|
110 |
AND t.customerId = #{customerId}
|
|
|
111 |
</if>
|
|
|
112 |
<if test="startTimestamp != null">
|
|
|
113 |
AND t.openDate > #{startTimestamp}
|
|
|
114 |
</if>
|
|
|
115 |
<if test="endTimestamp != null">
|
|
|
116 |
AND t.openDate < #{endTimestamp}
|
|
|
117 |
</if>
|
|
|
118 |
<if test="customerEmailId != null">
|
|
|
119 |
AND t.customerEmailId = #{customerEmailId}
|
|
|
120 |
</if>
|
|
|
121 |
<if test="customerMobileNumber != null">
|
|
|
122 |
AND t.customerMobileNumber = #{customerMobileNumber}
|
|
|
123 |
</if>
|
| 3499 |
mandeep.dh |
124 |
<if test="ticketStatus != null">
|
|
|
125 |
AND status = #{ticketStatus}
|
|
|
126 |
</if>
|
|
|
127 |
<if test="ticketPriority != null">
|
|
|
128 |
AND priority = #{ticketPriority}
|
|
|
129 |
</if>
|
|
|
130 |
<if test="ticketCategory != null">
|
|
|
131 |
AND category = #{ticketCategory}
|
|
|
132 |
</if>
|
| 3390 |
mandeep.dh |
133 |
</where>
|
|
|
134 |
ORDER BY t.openDate DESC
|
|
|
135 |
</select>
|
| 3137 |
mandeep.dh |
136 |
</mapper>
|