<?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="org.springblade.modules.guosen.withdrawRecords.mapper.WithdrawRecordsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="withdrawRecordsResultMap" type="org.springblade.modules.guosen.withdrawRecords.entity.WithdrawRecords">
        <result column="id" property="id"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
        <result column="user_id" property="userId"/>
        <result column="note" property="note"/>
        <result column="openid" property="openid"/>
        <result column="withdraw_status" property="withdrawStatus"/>
        <result column="grant_time" property="grantTime"/>
        <result column="hot_value" property="hotValue"/>
        <result column="cash_value" property="cashValue"/>
        <result column="type" property="type"/>
        <result column="update_affair" property="updateAffair"/>
        <result column="bank_code" property="bankCode"/>
        <result column="finish_time" property="finishTime"/>
        <result column="order_no" property="orderNo"/>
        <result column="fee" property="fee"/>
        <result column="debit_amount" property="debitAmount"/>
        <result column="request_no" property="requestNo"/>
        <result column="receiver_account_name" property="receiverAccountName"/>
        <result column="receiver_account_no" property="receiverAccountNo"/>
        <result column="fee_undertaker_merchant_no" property="feeUndertakerMerchantNo"/>
        <result column="receive_amount" property="receiveAmount"/>
        <result column="order_amount" property="orderAmount"/>
        <result column="order_time" property="orderTime"/>
        <result column="receive_type" property="receiveType"/>
        <result column="merchant_no" property="merchantNo"/>
        <result column="bussiness_order_no" property="bussinessOrderNo"/>
        <result column="yee_status" property="yeeStatus"/>
        <result column="fail_reason" property="failReason"/>
    </resultMap>


    <select id="selectWithdrawRecordsPage" resultType="org.springblade.modules.guosen.withdrawRecords.vo.WithdrawRecordsVO">
        select a.* ,b.nick_name,b.phone,b.avatar
        from
        cyzh_withdraw_records as a
        left join cyzh_login_user as b on a.user_id=b.id
        where a.is_deleted = 0
        <if test="withdrawRecordsDTO != null and withdrawRecordsDTO != ''" >
            <if test="withdrawRecordsDTO.nickName !=null and withdrawRecordsDTO.nickName!=''">
                and b.nick_name like concat('%',#{withdrawRecordsDTO.nickName},'%')
            </if>
            <if test="withdrawRecordsDTO.phone !=null and withdrawRecordsDTO.phone!=''">
                and b.phone like concat('%',#{withdrawRecordsDTO.phone},'%')
            </if>
            <if test="withdrawRecordsDTO.withdrawStatus !=null and withdrawRecordsDTO.withdrawStatus!=''">
                and a.withdraw_status=#{withdrawRecordsDTO.withdrawStatus}
            </if>
        </if>
    </select>

</mapper>
