<?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="pwc.taxtech.atms.dao.UserMapper">

    <select id="selectByUserName" parameterType="java.lang.String" resultMap="BaseResultMap">

        <!-- select one record by user name -->
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        user
        WHERE
        user_name = #{userName,jdbcType=VARCHAR}
    </select>

    <select id="selectByUserNameIgnoreCase" parameterType="java.lang.String" resultMap="BaseResultMap">

        <!-- select one record by user name -->
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        user
        WHERE
        LOWER (user_name)
        = LOWER (#{userName,jdbcType=VARCHAR})
    </select>

    <select id="selectUserWithSameUserName" parameterType="pwc.taxtech.atms.dpo.UserDto" resultMap="BaseResultMap">

        <!-- select one record by user name and different ID -->
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        user
        WHERE
        LOWER (user_name) = LOWER (#{userName})
        AND id != #{id}
    </select>

    <select id="selectUserWithSameEmail" parameterType="pwc.taxtech.atms.dpo.UserDto" resultMap="BaseResultMap">

        <!-- select one record by email and different ID -->
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        user
        WHERE
        LOWER (email) = LOWER (#{email})
        AND id != #{id}
    </select>

    <select id="selectByEmailIgnoreCase" parameterType="java.lang.String" resultMap="BaseResultMap">

        <!-- select one record by email -->
        SELECT
        <include refid="Base_Column_List"/>
        FROM
        user
        WHERE
        LOWER (email) = LOWER (#{email})
    </select>

</mapper>