Subversion Repositories SmartDukaan

Rev

Rev 3711 | Rev 4241 | 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.ActivityMapper">
6
  <resultMap type="activity" id="activityResult">
7
    <id property="id" column="id"/>
8
  </resultMap>
9
 
10
  <insert id="insertActivity" parameterType="activity" useGeneratedKeys="true" keyProperty="id">
11
    INSERT INTO activity
3106 mandeep.dh 12
      (customerId, ticketAssigneeId, description, ticketId, creatorId, type, creationTimestamp,
3390 mandeep.dh 13
       ticketPriority, ticketStatus, ticketCategory, ticketDescription, userEmailId, customerMobileNumber,
14
       isRead, customerEmailId, customerName)
3024 mandeep.dh 15
    VALUES
3106 mandeep.dh 16
      (#{customerId}, #{ticketAssigneeId}, #{description}, #{ticketId}, #{creatorId}, #{type}, NOW(),
3390 mandeep.dh 17
       #{ticketPriority}, #{ticketStatus}, #{ticketCategory}, #{ticketDescription}, #{userEmailId},
18
       #{customerMobileNumber}, #{isRead}, #{customerEmailId}, #{customerName})
3024 mandeep.dh 19
  </insert>
20
 
3390 mandeep.dh 21
  <select id="getActivities" parameterType="searchFilter" resultType="activity">
3546 mandeep.dh 22
    SELECT *
23
    FROM activity
3390 mandeep.dh 24
    <where>
25
    <if test="ticketId != null">
3546 mandeep.dh 26
        AND ticketId = #{ticketId}
3390 mandeep.dh 27
    </if>
28
    <if test="activityId != null">
3546 mandeep.dh 29
        AND id = #{activityId}
3390 mandeep.dh 30
    </if>
31
    <if test="activityCreatorIds != null">
3546 mandeep.dh 32
        AND creatorId IN 
3390 mandeep.dh 33
        <foreach collection="activityCreatorIds" item="activityCreatorId"
34
                 index="index" open="(" close=")" separator=",">
35
            #{activityCreatorId}
36
        </foreach>
37
    </if>
38
    <if test="customerId != null">
3546 mandeep.dh 39
        AND customerId = #{customerId}
3390 mandeep.dh 40
    </if>
41
    <if test="startTimestamp != null">
3546 mandeep.dh 42
        AND creationTimestamp &gt; #{startTimestamp}
3390 mandeep.dh 43
    </if>
44
    <if test="endTimestamp != null">
3546 mandeep.dh 45
        AND creationTimestamp &lt; #{endTimestamp}
3390 mandeep.dh 46
    </if>
47
    <if test="customerEmailId != null">
3546 mandeep.dh 48
        AND customerEmailId = #{customerEmailId}
3390 mandeep.dh 49
    </if>
50
    <if test="customerMobileNumber != null">
3546 mandeep.dh 51
        AND customerMobileNumber = #{customerMobileNumber}
3390 mandeep.dh 52
    </if>
53
    <if test="isActivityRead != null">
3546 mandeep.dh 54
        AND isRead = #{isActivityRead}
3390 mandeep.dh 55
    </if>
3546 mandeep.dh 56
    <if test="activityType != null">
57
        AND type = #{activityType}
58
    </if>
4142 mandeep.dh 59
    <if test="ticketCategory != null">
60
        AND ticketCategory = #{ticketCategory}
61
    </if>
3711 mandeep.dh 62
    <if test="ticketAssigneeIds != null">
63
        AND ticketAssigneeId IN 
64
        <foreach collection="ticketAssigneeIds" item="ticketAssigneeId"
65
                 index="index" open="(" close=")" separator=",">
66
            #{ticketAssigneeId}
67
        </foreach>
68
    </if>
3390 mandeep.dh 69
    </where>
3546 mandeep.dh 70
    ORDER BY creationTimestamp DESC
3024 mandeep.dh 71
  </select>
72
 
3390 mandeep.dh 73
  <update id="markAsRead" parameterType="long">
74
    UPDATE activity
75
    SET isRead = 1
3024 mandeep.dh 76
    WHERE id = #{activityId}
3390 mandeep.dh 77
  </update>
3024 mandeep.dh 78
</mapper>