<?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.rj.mapper.sys.UserMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.rj.entity.sys.User">
        <id column="user_id" property="userId" />
        <result column="user_name" property="userName" />
        <result column="email" property="email" />
        <result column="password" property="password" />
        <result column="token" property="token" />
        <result column="avatar" property="avatar" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        user_id, user_name, email, password, token, avatar
    </sql>

    <!-- 根据 token 查询用户（token 验证、获取当前用户信息），不走多租户拦截器，不添加 tenant_id 条件 -->
    <select id="selectByTokenIgnoreTenant" resultMap="BaseResultMap">
        SELECT * FROM user WHERE token = #{token} LIMIT 1
    </select>

</mapper>

