<?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.system.dal.mysql.funds.invoice.InvoiceRecordsMapper">
    <select id="getManageInvoiceAmountStatistics" resultType="com.cf.imes.module.system.controller.admin.funds.invoice.vo.InvoiceAmountRespVO">
        select COALESCE(sum(case when status = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@PENDINGINVOICING.code}' then invoice_amount else 0 end), 0) as pendingInvoice,
               COALESCE(sum(case when status = '${@com.cf.imes.module.system.enums.pay.InvoiceStatusEnum@INVOICINGSUCCESSFUL.code}' then invoice_amount else 0 end), 0) as invoiced
        from invoice_records
        where deleted = false
    </select>
</mapper>