<?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.cf.imes.module.executor.dal.mysql.funds.balancedetails.IncomeExpenseDetailsMapper">


    <select id="selectOrganInvoicable"
            resultType="com.cf.imes.module.executor.controller.admin.funds.invoice.vo.InvoiceDetailsRespVO">

        select distinct ied.business_no as businessNo,
                        ied.trade_type as tradeType,
                        ied.create_time as createTime,
                        ied.cash_amount_change as rechargeAmount,
                        pr.id as purchaseRecordId
        from income_expense_details ied
                 left join purchase_record pr on ied.organId = pr.organId and ied.purchase_id = pr.id

            ${ew.customSqlSegment}


    </select>

</mapper>