<?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.TDxRecordInvoiceOutDao">

    <select id="countOutInvoice" resultType="java.lang.Integer">
        select count(1) from t_dx_record_invoice_out t left join t_dx_record_invoice d on t.uuid = d.uuid
        where
        d.gf_tax_no = #{buyerTaxNo}
        and t.out_belong_date = #{outTaxPeriod}
        <if test="outReason !=null and outReason !=''">
            and t.out_reason = #{outReason}
        </if>
    </select>
    <select id="selectOutInvoice" resultType="com.dxhy.erp.entity.TDxRecordInvoiceOut">
        select t.* from t_dx_record_invoice_out t left join t_dx_record_invoice d on t.uuid = d.uuid
        where
        d.gf_tax_no = #{data.buyerTaxNo}
        and t.out_belong_date = #{data.outTaxPeriod}
        <if test="data.outReason !=null and data.outReason !=''">
            and t.out_reason = #{data.outReason}
        </if>
        order by t.out_date limit #{data.start},#{data.num}
    </select>
</mapper>
