<?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.tofly.gpsboot.custom.mapper.UserLoginMapper">
    <resultMap id="UserLoginMap" type="com.tofly.pojo.comm.vo.LoginUserVO">
        <id column="ID" property="id"/>
        <result column="USERNAME" property="username"/>
        <result column="PASSWORD" property="password"/>
        <result column="SALT" property="salt"/>
        <result column="PHONE" property="phone"/>
        <result column="AVATAR" property="avatar"/>
        <result column="DEPARTMENT_ID" property="departmentId"/>
        <result column="CREATE_TIME" property="createTime"/>
        <result column="UPDATE_TIME" property="updateTime"/>
        <result column="LOCK_FLAG" property="lockFlag"/>
        <result column="STATUS_FLAG" property="statusFlag"/>
        <result column="WX_OPENID" property="wxOpenid"/>
        <result column="QQ_OPENID" property="qqOpenid"/>
        <result column="EMAIL" property="email"/>
        <result column="REAL_NAME" property="realName"/>
        <result column="LOGIN_TIME" property="loginTime"/>
        <result column="LAST_IP" property="lastIp"/>
        <result column="PWDERRTIMES" property="pwdErrTimes"/>
        <result column="WORKNUMBER" property="workNumber"/>
        <result column="FINDPWDKEY" property="findPwdKey"/>
        <result column="ALIASNAME" property="aliasName"/>
        <result column="BIRTHDAY" property="birthday"/>
        <result column="BELONG" property="belong"/>
        <result column="CREATE_USER" property="createUser"/>
        <result column="USER_LEVEL" property="userLevel"/>
        <result column="COMPANY_ID" property="companyId"/>
        <!--        自定义字段-->
        <result column="DEPARTMENTNAME" property="departmentName"/>
        <result column="COMPANYNAME" property="companyName"/>
    </resultMap>
    <select id="getUserLogin" resultMap="UserLoginMap">
        SELECT b.name COMPANYNAME, c.name DEPARTMENTNAME, a.*
        from tf_smpn_user_x a
                 left join TF_SMPN_COMPANY_X b on a.company_id = b.id
                 left join tf_smpn_department_x c on a.department_id = c.id
        WHERE a.id = #{id}
    </select>
</mapper>