<?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="vip.xiaonuo.biz.modular.rebaterecord.mapper.BizRebateRecordMapper">

    <select id="page" resultType="vip.xiaonuo.biz.modular.rebaterecord.entity.BizRebateRecord">
        SELECT
            t.id,
            t.rebate_amount,
            t.recharge_record_id,
            t.recommend_user_id,
            t.recharge_user_id,
            DATE_FORMAT(t.create_time, '%Y-%m-%d') AS createTime,
            t.rebate_status,
            u1.`NAME` rechargeUserName,
            u2.`NAME` recommendUserName,
            r.recharge_amount,
            r.recharge_time,
            r.rebate_ratio
        FROM
            biz_rebate_record t
        INNER JOIN biz_recharge_record r ON r.id = t.recharge_record_id
        LEFT JOIN SYS_USER u1 ON u1.ID = t.recharge_user_id
        LEFT JOIN SYS_USER u2 ON u2.ID = t.recommend_user_id
        ${ew.customSqlSegment}
    </select>
</mapper>