Subversion Repositories SmartDukaan

Rev

Rev 14910 | 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,
4241 anupam.sin 14
       isRead, customerEmailId, customerName, attachments)
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},
4241 anupam.sin 18
       #{customerMobileNumber}, #{isRead}, #{customerEmailId}, #{customerName}, #{attachments})
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>
16208 manish.sha 69
    <if test="notShowPmTickets != null and notShowPmTickets == true">
14910 manish.sha 70
        AND ticketCategory not IN 
71
    	<foreach collection="ticketCategoryList" item="tkCategory" 
72
    			 index="index" open="(" close=")" separator=",">
73
    		#{tkCategory}
74
    	</foreach>
14898 manish.sha 75
    </if>
16208 manish.sha 76
    <if test="notShowPmTickets != null and notShowPmTickets == false">
77
        AND ticketCategory IN 
78
    	<foreach collection="ticketCategoryList" item="tkCategory" 
79
    			 index="index" open="(" close=")" separator=",">
80
    		#{tkCategory}
81
    	</foreach>
82
    </if>
3390 mandeep.dh 83
    </where>
3546 mandeep.dh 84
    ORDER BY creationTimestamp DESC
3024 mandeep.dh 85
  </select>
86
 
3390 mandeep.dh 87
  <update id="markAsRead" parameterType="long">
88
    UPDATE activity
89
    SET isRead = 1
3024 mandeep.dh 90
    WHERE id = #{activityId}
3390 mandeep.dh 91
  </update>
3024 mandeep.dh 92
</mapper>