<?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.dxhy.erp.dao.RiskStatisticsDao">

    <select id="getJxData" resultType="com.dxhy.erp.model.RiskStatisticsModel"
            parameterType="com.dxhy.erp.entity.RiskStatisticsPo">
        select ifnull(sum(invoice_amount), 0) invoiceAmountSum,
               ifnull(sum(tax_amount), 0)     taxAmountSum,
               ifnull(sum(total_amount), 0)   totalAmountSum
        from t_dx_record_invoice
        where invoice_type = #{invoiceType}
          and date_format(invoice_date, '%Y%m') = #{invoiceMonth}
          and gf_tax_no = #{taxNo}
    </select>

    <select id="getXxData" resultType="com.dxhy.erp.model.RiskStatisticsModel"
            parameterType="com.dxhy.erp.entity.RiskStatisticsPo">
        select ifnull(sum(invoice_amount), 0) invoiceAmountSum,
               ifnull(sum(tax_amount), 0)     taxAmountSum,
               ifnull(sum(total_amount), 0)   totalAmountSum
        from t_dx_sale_record_invoice
        where invoice_type = #{invoiceType}
          and date_format(invoice_date, '%Y%m') = #{invoiceMonth}
          and xf_tax_no = #{taxNo}
    </select>
</mapper>
