<?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.njzscloud.supervisory.user.mapper.SysUserMapper">

    <resultMap id="UserDetailResultMap" autoMapping="true" type="com.njzscloud.supervisory.user.pojo.UserDetailResult">
        <association property="account" autoMapping="true" javaType="com.njzscloud.supervisory.user.pojo.UserAccountDetailResult">
            <id column="account_id" property="id"/>
        </association>
    </resultMap>

    <select id="paging" resultMap="UserDetailResultMap">
        SELECT a.id,
        a.nickname,
        a.gender,
        a.avatar,
        a.email,
        a.phone,
        b.id account_id,
        b.username,
        b.email,
        b.phone,
        b.secret,
        b.wechat_openid,
        b.wechat_unionid,
        b.regdate,
        b.client_code,
        b.disabled
        FROM sys_user a
        INNER JOIN sys_user_account b ON b.user_id = a.id AND b.deleted = 0
        <if test="ew != null and ew.customSqlSegment != null and ew.customSqlSegment !=''">
            ${ew.customSqlSegment}
        </if>
    </select>
</mapper>
