<?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.community.huiju.dao.TransactionReportMapper">
<select id="transactionReportList" resultType="com.community.huiju.model.TransactionReport">
        SELECT
        rr.reason as reason,
        u.user_name as reportUserName,
        sro.description as description,
        u.login_name as reportPhone,
        tr.create_date
        FROM
        tp_transaction_report tr
        LEFT JOIN sys_report_reason rr ON	tr.report_reason_id = rr.id
        LEFT JOIN ta_user u ON tr.reporter_id = u.id
        LEFT JOIN ta_user_verify uv ON u.id = uv.user_id
        LEFT JOIN ta_sys_role sro ON uv.role_id = sro.id
        <where>
            tr.transaction_id=#{transactionId}
        <if test="reportPhone != null and reportPhone != ''">
            AND u.login_name like concat('%',#{reportPhone},'%')
        </if>

        <if test="reportUserNmae != null and reportUserNmae != ''">
            AND u.user_name like concat('%',#{reportUserNmae},'%')
        </if>
        </where>
        order by tr.create_date desc
</select>
</mapper>
