<?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.ruoyi.member.mapper.MemberBlacklistMapper">

    <resultMap type="MemberBlacklist" id="MemberBlacklistResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="blackUserId"    column="black_user_id"    />
        <result property="blackUserType"    column="black_user_type"    />
        <result property="creator"    column="creator"    />
        <result property="createTime"    column="create_time"    />
        <result property="updater"    column="updater"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectMemberBlacklistVo">
        select id, user_id, black_user_id, black_user_type, creator, create_time, updater, update_time, del_flag from dl_member_blacklist
    </sql>
    <select id="queryListPage" resultType="com.ruoyi.member.vo.MemberBlacklistVO">
        SELECT
            main.id AS id,
            su.nick_name AS nickName,
            su.avatar AS avatar,
            main.create_time AS createTime
        FROM
            dl_member_blacklist main
                LEFT JOIN sys_user su ON main.black_user_id = su.user_id AND su.del_flag = 0
        WHERE
            main.del_flag = 0
        <if test="entity.userId != null"> and main.user_id = #{entity.userId}</if>
    </select>


</mapper>