<?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.xq.mapper.ReportMapper">

    <select id="pageAdmin" resultType="com.ruoyi.xq.dto.admin.report.ReportAdminVo">
        select t1.*, t2.usercode, t2.nickname, t2.avatar, t2.mobile,
                t3.usercode as report_usercode, t3.nickname as report_nickname, t3.avatar as report_avatar, t3.mobile as report_mobile
        from xq_report t1
        join xq_user t2 on t1.user_id = t2.id
        join xq_user t3 on t1.report_uid = t3.id
        <where>
            <if test="bo.usercode != null and bo.usercode != ''">
                and t2.usercode = #{bo.usercode}
            </if>
            <if test="bo.nickname != null and bo.nickname != ''">
                and t2.nickname like concat('%',#{bo.nickname},'%')
            </if>
            <if test="bo.mobile != null and bo.mobile != ''">
                and t2.mobile = #{bo.mobile}
            </if>
            <if test="bo.reportUsercode != null and bo.reportUsercode != ''">
                and t3.usercode = #{bo.reportUsercode}
            </if>
            <if test="bo.reportNickname != null and bo.reportNickname != ''">
                and t3.nickname like concat('%',#{bo.reportNickname},'%')
            </if>
            <if test="bo.reportMobile != null and bo.reportMobile != ''">
                and t3.mobile = #{bo.reportMobile}
            </if>
            <if test="bo.reportStatus != null ">
                and t1.report_status = #{bo.reportStatus}
            </if>
        </where>
    </select>


</mapper>
