<?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.cai.mapper.UserCallMapper">

    <select id="pageAdmin" resultType="com.ruoyi.cai.dto.admin.vo.UserCallAdminVo">
        select t1.*,
               t2.mobile as from_mobile,t2.avatar as from_avatar,
               t3.mobile as to_mobile, t3.avatar as to_avatar
        from cai_user_call t1
        left join cai_user t2 on t1.from_uid = t2.id
        left join cai_user t3 on t1.to_uid = t3.id
        <where>
            <if test="bo.fromUsercode != null and bo.fromUsercode != ''">
                and t1.from_usercode = #{bo.fromUsercode}
            </if>
            <if test="bo.fromMobile != null and bo.fromMobile != ''">
                and t2.mobile = #{bo.fromMobile}
            </if>
            <if test="bo.toUsercode != null and bo.toUsercode != ''">
                and t1.to_usercode = #{bo.fromUsercode}
            </if>
            <if test="bo.toMobile != null and bo.toMobile != ''">
                and t3.mobile = #{bo.fromMobile}
            </if>
            <if test="bo.status != null">
                and t1.status = #{bo.status}
            </if>
            <if test="bo.deleteFlag != null">
                and t1.delete_flag = #{bo.deleteFlag}
            </if>
        </where>
        order by t1.create_time desc
    </select>


</mapper>
