<?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.bussiness.mapper.BussinessDebitMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="bussinessDebitResultMap" type="org.springblade.modules.guosen.bussiness.entity.BussinessDebit">
        <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="bussiness_id" property="bussinessId"/>
        <result column="type" property="type"/>
        <result column="price" property="price"/>
        <result column="relation_id" property="relationId"/>
        <result column="fee" property="fee"/>
        <result column="fail_reason" property="failReason"/>
        <result column="method" property="method"/>
        <result column="bussiness_order_id" property="bussinessOrderId"/>
        <result column="freeze" property="freeze"/>
        <result column="current_remain" property="currentRemain"/>
        <result column="request_ip" property="requestIp"/>
        <result column="third_order_no" property="thirdOrderNo"/>
        <result column="request_no" property="requestNo"/>
        <result column="transfer_order_id" property="transferOrderId"/>
        <result column="debit_notify_url" property="debitNotifyUrl"/>
        <result column="branch_bank_code" property="branchBankCode"/>
    </resultMap>


    <select id="selectBussinessDebitPage" resultMap="bussinessDebitResultMap">
        select * from cyzh_bussiness_debit where is_deleted = 0
    </select>

    <select id="getByBussinessOrderId" resultMap="bussinessDebitResultMap">
        select * from cyzh_bussiness_debit where is_deleted = 0
        AND bussiness_id = #{bussinessId}
        AND bussiness_order_id = #{bussinessOrderId}
    </select>

    <select id="getByTransferOrderId" resultMap="bussinessDebitResultMap">
        select * from cyzh_bussiness_debit where is_deleted = 0
        AND bussiness_id = #{bussinessId}
        AND transfer_order_id = #{transferOrderId}
    </select>

</mapper>
