<?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.wecloud.im.mapper.ImClientBlacklistMapper">

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id
        , create_time, update_time, fk_appid, client_id_prevent, client_id_be_prevent
    </sql>

    <select id="getImClientBlacklistById" resultType="com.wecloud.im.param.ImClientBlacklistQueryVo">
        select
        <include refid="Base_Column_List"/>
        from im_client_blacklist where id = #{id}
    </select>

    <select id="getImClientBlacklistPageList" resultType="com.wecloud.im.param.ImClientBlacklistQueryVo">
        SELECT im_client.client_id AS clientIdBePrevent
        FROM im_client_blacklist
                 INNER JOIN im_client ON im_client.client_id = im_client_blacklist.client_id_be_prevent
        WHERE im_client_blacklist.client_id_prevent = #{clientId}
        ORDER BY im_client_blacklist.create_time DESC
    </select>

</mapper>
