Subversion Repositories SmartDukaan

Rev

Rev 3390 | Rev 5168 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3390 Rev 4793
Line 5... Line 5...
5
<mapper namespace="in.shop2020.crm.persistence.AgentMapper">
5
<mapper namespace="in.shop2020.crm.persistence.AgentMapper">
6
  <resultMap type="agent" id="agentResult">
6
  <resultMap type="agent" id="agentResult">
7
    <id property="id" column="id"/>
7
    <id property="id" column="id"/>
8
  </resultMap>
8
  </resultMap>
9
 
9
 
-
 
10
	<insert id="insertAgent" parameterType="agent" useGeneratedKeys="true" keyProperty="id">
-
 
11
    INSERT INTO agent
-
 
12
      ( name, emailId, password, managerId, is_active)
-
 
13
    VALUES
-
 
14
      (#{name}, #{emailId},  #{password}, #{managerId}, #{is_active})
-
 
15
  </insert>
-
 
16
 
-
 
17
	<insert id="insertAgentRole" parameterType="map">
-
 
18
	INSERT INTO user_roles
-
 
19
		(agentId, role_name)
-
 
20
	VALUES 
-
 
21
		(#{id}, #{agentRole})
-
 
22
	</insert>
-
 
23
 
10
  <select id="getAgents" parameterType="searchFilter" resultType="agent">
24
  <select id="getAgents" parameterType="searchFilter" resultType="agent">
11
    SELECT *
25
    SELECT *
12
    FROM agent a
26
    FROM agent a
13
    <where>
27
    WHERE is_active = 1
14
        <if test="agentId != null">
28
        <if test="agentId != null">
15
            AND a.id = #{agentId}
29
            AND a.id = #{agentId}
16
        </if>
30
        </if>
17
        <if test="agentEmailId != null">
31
        <if test="agentEmailId != null">
18
            AND a.emailId = #{agentEmailId}
32
            AND a.emailId = #{agentEmailId}
19
        </if>
33
        </if>
20
    </where>
-
 
21
  </select>
34
  </select>
22
 
35
 
23
  <select id="getRoleNamesForAgent" parameterType="String" resultType="String">
36
  <select id="getRoleNamesForAgent" parameterType="String" resultType="String">
24
    SELECT role_name 
37
    SELECT role_name 
25
    FROM user_roles a
38
    FROM user_roles a
Line 46... Line 59...
46
 
59
 
47
  <update id="updateLastEmailProcessedTimestamp" parameterType="java.util.Date">
60
  <update id="updateLastEmailProcessedTimestamp" parameterType="java.util.Date">
48
    UPDATE emailStatus
61
    UPDATE emailStatus
49
    SET lastUpdatedTimestamp = #{timestamp} 
62
    SET lastUpdatedTimestamp = #{timestamp} 
50
  </update>
63
  </update>
-
 
64
  
-
 
65
  <update id="changeAgentStatus" parameterType="map">
-
 
66
  	UPDATE agent
-
 
67
  	SET is_active = #{status}
-
 
68
  	WHERE emailId = #{emailId}
-
 
69
  </update>
-
 
70
  
-
 
71
  
51
</mapper>
72
</mapper>
52
73