Subversion Repositories SmartDukaan

Rev

Rev 3106 | Rev 3269 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
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"/>
8
  </resultMap>
9
 
10
  <insert id="insertTicket" parameterType="ticket" useGeneratedKeys="true" keyProperty="id">
11
    INSERT INTO ticket
3106 mandeep.dh 12
      (customerId, openDate, closeDate, creatorId, description, assigneeId, status,
13
       priority, category, productName, airwayBillNo, orderId)
3024 mandeep.dh 14
    VALUES
3106 mandeep.dh 15
      (#{customerId}, NOW(),  #{closeDate},  #{creatorId}, #{description}, #{assigneeId}, #{status},
16
       #{priority}, #{category}, #{productName}, #{airwayBillNo}, #{orderId})
3024 mandeep.dh 17
  </insert>
18
 
19
  <update id="updateTicket" parameterType="ticket">
20
    UPDATE ticket
21
    SET
3106 mandeep.dh 22
    <if test="assigneeId != null">
23
      assigneeId = #{assigneeId},
3024 mandeep.dh 24
    </if>
3106 mandeep.dh 25
    <if test="status != null">
26
      status = #{status},
27
    </if>
28
    <if test="priority != null">
29
      priority = #{priority},
30
    </if>
31
    <if test="category != null">
32
      category = #{category},
33
    </if>
34
    <if test="description != null">
35
      description = #{description},
36
    </if>
3024 mandeep.dh 37
    closeDate = #{closeDate}
38
    WHERE id = #{id}
39
  </update>
40
 
41
  <select id="getTickets" parameterType="long" resultType="ticket">
42
    SELECT * FROM ticket
43
    WHERE customerId = #{customerId}
44
    ORDER BY openDate DESC
45
  </select>
46
 
47
  <select id="getTicket" parameterType="long" resultType="ticket">
48
    SELECT * FROM ticket
49
    WHERE id = #{ticketId}
50
  </select>
3137 mandeep.dh 51
 
52
  <select id="getAssignedTickets" parameterType="long" resultType="ticket">
53
    SELECT * FROM ticket
54
    WHERE assigneeId = #{agentId}
55
    ORDER BY openDate DESC
56
  </select>
57
 
58
  <select id="getUnassignedTickets" resultType="ticket">
59
    SELECT * FROM ticket
60
    WHERE assigneeId IS NULL
61
    ORDER BY openDate DESC
62
  </select>
63
</mapper>