Rev 5286 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN""http://mybatis.org/dtd/mybatis-3-mapper.dtd"><mapper namespace="in.shop2020.crm.persistence.AgentMapper"><resultMap type="agent" id="agentResult"><id property="id" column="id"/></resultMap><insert id="insertAgent" parameterType="agent" useGeneratedKeys="true" keyProperty="id">INSERT INTO agent( name, emailId, password, managerId, is_active, is_pmCrmUser, is_allAssignable)VALUES(#{name}, #{emailId}, #{password}, #{managerId}, #{is_active}, #{is_pmCrmUser}, #{is_allAssignable})</insert><insert id="insertAgentRole" parameterType="map">INSERT INTO user_roles(agentId, role_name)VALUES(#{id}, #{agentRole})</insert><select id="getAgents" parameterType="searchFilter" resultType="agent">SELECT *FROM agent aWHERE is_active = 1<if test="agentId != null">AND a.id = #{agentId}</if><if test="agentEmailId != null">AND a.emailId = #{agentEmailId}</if></select><select id="getInactiveAgents" parameterType="searchFilter" resultType="agent">SELECT *FROM agent aWHERE is_active = 0<if test="agentId != null">AND a.id = #{agentId}</if><if test="agentEmailId != null">AND a.emailId = #{agentEmailId}</if></select><select id="getRoleNamesForAgent" parameterType="String" resultType="String">SELECT role_nameFROM user_roles aJOIN agent bON (b.id = a.agentId)WHERE b.emailId = #{emailId}</select><select id="getPermissionsForRoleName" parameterType="String" resultType="String">SELECT permissionFROM roles_permissionsWHERE role_name = #{role_name}</select><update id="updatePasswordForAgent" parameterType="map">UPDATE agentSET password = #{password}WHERE emailId = #{emailId}</update><select id="getLastEmailProcessedTimestamp" resultType="java.util.Date">SELECT lastUpdatedTimestamp from emailStatus</select><update id="updateLastEmailProcessedTimestamp" parameterType="java.util.Date">UPDATE emailStatusSET lastUpdatedTimestamp = #{timestamp}</update><update id="changeAgentStatus" parameterType="map">UPDATE agentSET is_active = #{status}WHERE emailId = #{emailId}</update><update id="removeAgentRoles" parameterType="long">DELETE FROM user_rolesWHERE agentId = #{id}</update></mapper>