<?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="com.interplug.qcast.biz.login.LoginMapper">
    <select id="getLogin" parameterType="com.interplug.qcast.biz.login.dto.LoginUser"
            resultType="boolean">
        /* sqlid : com.interplug.qcast.login.findByLoginId */
        select 1
        from M_USER
        where USER_ID = #{username}
          and PASSWORD = #{password}
    </select>

    <select id="getUser" parameterType="com.interplug.qcast.biz.login.dto.LoginUser"
            resultType="com.interplug.qcast.biz.login.dto.UserResponse">
        /* sqlid : com.interplug.qcast.login.findByLoginId */
        SELECT A.USER_ID
				, A.SALE_STORE_ID AS STORE_ID
				, A.CATEGORY
				, A.NAME AS USER_NM
				, A.NAME_KANA AS USER_NM_KANA
				, A.TEL AS TEL_NO
				, A.FAX
				, A.MAIL AS EMAIL
				, A.GROUP_ID
				, A.MODULE_SELECT_GROUP_ID
				, A.VERSION_MANAGEMENT_ID
				, A.DISP_COST_PRICE
				, A.DISP_SELLING_PRICE
				, A.REGIST_DATETIME
				, A.LAST_EDIT_DATETIME
				, A.LAST_EDIT_USER
				, B.SAP_SALES_STORE_CD AS CUST_CD
        FROM M_USER A
        LEFT OUTER JOIN M_SALES_STORE_ID_FOR_SAP B
        ON A.SALE_STORE_ID = B.SALE_STORE_ID
        WHERE USER_ID = #{loginId}
    </select>
</mapper>