<?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.base.dao.BaseTDxRecordInvoiceDao">

    <resultMap id="SggxcxResultMap" type="com.dxhy.base.entity.BaseTDxRecordInvoice">
        <result column="id" property="id"/>
        <result column="dept_name" property="deptName"/>
        <result column="invoice_code" property="invoiceCode"/>
        <result column="invoice_no" property="invoiceNo"/>
        <result column="gf_name" property="gfName"/>
        <result column="gf_tax_no" property="gfTaxNo"/>
        <result column="xf_name" property="xfName"/>
        <result column="invoice_date" property="invoiceDate"/>
        <result column="invoice_amount" property="invoiceAmount"/>
        <result column="dk_tax_amount" property="dkTaxAmount"/>
        <result column="tax_amount" property="taxAmount"/>
        <result column="qs_date" property="qsDate"/>
        <result column="qs_type" property="qsType"/>
        <result column="qs_status" property="qsStatus"/>
        <result column="dept_id" property="deptId"/>
        <result column="invoice_type" property="invoiceType"/>
        <result column="qs_name" property="qsName"/>
        <result column="invoice_status" property="invoiceStatus"/>
        <result column="authStatus" property="authStatus"/>
        <result column="inaccount_status" property="inAccountStatus"/>
        <result column="payment_date" property="paymentDate"/>
        <result column="payment_status" property="paymentStatus"/>
        <result column="voucher_number" property="voucherNumber"/>
        <result column="sn_voucher_number" property="snVoucherNumber"/>
        <result column="image_id" property="imageNumber"/>
        <result column="ele_invoice_no" property="eleInvoiceNo"/>
        <result column="bzdh" property="bzdh"/>
        <result column="comp_code" property="compCode"/>
        <result column="suspend_status" property="suspendStatus"/>
        <result column="suspend_date" property="suspendDate"/>
        <result column="bzr" property="bzr"/>
    </resultMap>
    <resultMap id="hjResultMap"
               type="com.dxhy.base.entity.BaseTDxRecordInvoice">
        <result column="hjsl" property="sfygx"/>
        <result column="hjje" property="invoiceAmount"/>
        <result column="hjse" property="taxAmount"/>
    </resultMap>
    <resultMap id="boforeTjResultMap" type="com.dxhy.base.entity.BaseTDxRecordInvoice">
        <result column="sl" property="id"/>
    </resultMap>


    <select id="selectDksh" parameterType="java.util.Map"
            resultType="com.dxhy.base.entity.BaseTDxDkCount">
        select t.current_tax_period skssq,t.taxno taxno,d.tj_status tjStatus,tj_date tjDate from
        t_dx_tax_current
        t,t_dx_dk_count d
        where t.taxno=d.taxno
        and t.current_tax_period=d.skssq
        and t.taxno in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>
    <select id="selectSggxcx" parameterType="java.util.Map"
            resultMap="SggxcxResultMap" databaseId="mysql">
        select t.invoice_type,t.dept_id,t.dept_name,t.comp_code,t.bzr
        ,t.id,t.invoice_code,t.invoice_no,t.gf_name,t.gf_tax_no,t.xf_name,
        DATE_FORMAT(t.invoice_date,'%Y-%m-%d')invoice_date,t.invoice_amount,t.tax_amount,t.invoice_status,DATE_FORMAT(t.qs_date,'%Y-%m-%d')qs_date
        ,t.qs_type,t.qs_status,t.dk_tax_amount,t.qs_name,t.sn_voucher_number,t.posting_time,t.image_id,t.account_period,
        case date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date when
        true then 1
        else 2 end authStatus,t.bzdh,t.suspend_status,t.suspend_date,
        t.inaccount_status,t.payment_status,DATE_FORMAT(t.payment_date,'%Y-%m-%d')payment_date,t.settlement_no,t.ele_invoice_no
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq}
        and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
        and t.rzh_yesorno = '0'
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.company = #{company}
        <if test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '1'.toString()">
            and t.invoice_status in ('0','7')
            and t.invoice_amount>0
            and t.tax_amount>=0
            and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date
            and d.tj_status in('0','3')
        </if>

        <if test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '0'.toString()">
            and (t.invoice_status in ('1','2','3','4','8','80') or t.invoice_amount &lt;0 or t.tax_amount &lt;0 or
            date_format(t.invoice_date,'%Y%m%d') &lt;= c.select_start_date or
            date_format(t.invoice_date,'%Y%m%d') &gt;=
            c.select_end_date or d.tj_status in ('1','2'))

        </if>
        <if test="sign !='88'">
            and t.gf_tax_no in
            <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>

<!--        and t.comp_code in-->
<!--        <foreach collection="companyCodes" index="index" item="companyCode" open="(" close=")" separator=",">-->
<!--            #{companyCode}-->
<!--        </foreach>-->
        <if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
            and (t.comp_code in
            <foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
                #{companyCode}
            </foreach>
            or t.comp_code is null or t.comp_code = ''
            )
        </if>
        <if test="companyCode != null and companyCode != '99' and companyCode != '88' and companyCode != '' and companyCode != 'null'" >
            and t.comp_code = #{companyCode}
        </if>
        <if test="companyCode != null and companyCode != ''  and companyCode == '88'">
            and (t.comp_code = '' or t.comp_code is null)
        </if>
        <if test="suspendStatus != null and suspendStatus != '' and suspendStatus != 'null' and suspendStatus != '99' and suspendStatus == '1'.toString()">
            and t.suspend_status = '1'
        </if>
        <if test="suspendStatus != null and suspendStatus != '' and suspendStatus != 'null' and suspendStatus != '99' and suspendStatus == '0'.toString()">
            and (t.suspend_status = '' or t.suspend_status is null or t.suspend_status = '0')
        </if>
        <if test="suspendDate != null and suspendDate != '' and suspendDate != 'null' ">
            and t.suspend_date = #{suspendDate}
        </if>
        <if test="bzr != null and bzr != '' and bzr != 'null'">
            and t.bzr like concat('%',#{bzr},'%')
        </if>
        <if test="qszt != null and qszt != '' and qszt != 'null' ">
            and t.qs_status = #{qszt}
        </if>
        <if test="bzdh != null and bzdh != '' and bzdh != 'null' and bzdh != '99'">
            and t.bzdh = #{bzdh}
        </if>
        <if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()">
            and t.inaccount_status = #{inAccountStatus}
        </if>
        <if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
            and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null)
        </if>
        <if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
        </if>
        <if test="voucherNumber != null and voucherNumber != ''">
            and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
        </if>
        <if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
            <![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
        </if>
        <if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
            <![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d')  <= #{paymentDateEnd} ]]>
        </if>
        <if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
            and t.payment_status = #{paymentStatus}
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
            and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if test="settlementNo != null and settlementNo != ''">
            and t.settlement_no like concat(#{settlementNo},'%')
        </if>
        <if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <!-- 按签收人查询 -->
        <if  test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>

        <if test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
        <if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
            and t.sn_voucher_number = #{snVoucherNumber}
        </if>
        <if test="postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99' and postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99'">
            and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
        </if>
        <if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
            and t.image_id = #{imageNumber}
        </if>
        <if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
            and t.account_period = #{accountPeriod}
        </if>
<!--        <if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">-->
<!--            order by t.qs_date desc,t.invoice_date desc-->
<!--        </if>-->
<!--        <if test="qsksrq==null or qsksrq=='' or qsjsrq==null or qsjsrq==''">-->
<!--            order by t.invoice_date desc-->
<!--        </if>-->
        order by t.bzdh desc
    </select>
    <select id="selectDksh" parameterType="java.util.Map"
            resultType="com.dxhy.base.entity.BaseTDxDkCount"
            databaseId="oracle">
        select t.current_tax_period skssq,t.taxno taxno,d.tj_status tjStatus,tj_date tjDate from
        t_dx_tax_current
        t,t_dx_dk_count d
        where t.taxno=d.taxno
        and t.current_tax_period=d.skssq
        and t.taxno in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
    </select>

    <select id="selectSggxcx" parameterType="java.util.Map"
            resultMap="SggxcxResultMap" databaseId="oracle">
        select t.invoice_type,t.dept_id
        ,t.id,t.invoice_code,t.invoice_no,t.gf_name,t.gf_tax_no,t.xf_name,
        to_char(t.invoice_date,'yyyy-MM-dd')invoice_date,t.invoice_amount,t.tax_amount,t.invoice_status,to_char(t.qs_date,'yyyy-MM-dd')qs_date
        ,t.qs_type,t.qs_status,t.dk_tax_amount,t.qs_name,t.voucher_number,
        case to_char(t.invoice_date,'yyyy-MM-dd') between c.select_start_date and c.select_end_date when
        true then 1
        else 2 end authStatus,
        t.in_account_status,t.payment_status,to_char(t.payment_date,'yyyy-MM-dd')payment_date,t.settlement_no,t.ele_invoice_no
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE to_char(t.invoice_date,'yyyy-MM-dd') between #{kpksrq} and #{kpjsrq}
        and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
        and t.rzh_yesorno = '0'
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.company = #{company}
        <if
                test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '1'.toString()">
            and t.invoice_status = '0'
            and t.invoice_amount>0
            and t.tax_amount>=0
            and to_char(t.invoice_date,'yyyyMMdd') between c.select_start_date and c.select_end_date
            and d.tj_status in('0','3')
        </if>

        <if
                test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '0'.toString()">
            and (t.invoice_status &lt;&gt; '0' or t.invoice_amount &lt;0 or t.tax_amount &lt;0 or
            to_char(t.invoice_date,'yyyyMMdd') &lt;= c.select_start_date or
            to_char(t.invoice_date,'yyyyMMdd') &gt;=
            c.select_end_date or d.tj_status in ('1','2'))

        </if>
        and t.gf_tax_no in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="qszt != null and qszt != '' and qszt != 'null' ">
            and t.qs_status = #{qszt}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and to_char(t.qs_date,'yyyy-MM-dd') between #{qsksrq} and #{qsjsrq}
        </if>
        <if test="voucherNumber != null and voucherNumber != ''">
            and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
        </if>
        <if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
            <![CDATA[ AND to_char(t.payment_date,'yyyy-MM-dd') >= #{paymentDateStart} ]]>
        </if>
        <if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
            <![CDATA[ AND to_char(t.payment_date,'yyyy-MM-dd')  <= #{paymentDateEnd} ]]>
        </if>
        <if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
            and t.payment_status = #{paymentStatus}
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
            and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='99' and invoiceSource!='null' and invoiceSource!=''">
            and t.invoice_source =#{invoiceSource}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if
                test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
            <![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
        </if>
        <if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
            <![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d')  <= #{paymentDateEnd} ]]>
        </if>
        <if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
            and t.payment_status = #{paymentStatus}
        </if>
        <if test="settlementNo != null and settlementNo != ''">
            and t.settlement_no like concat(#{settlementNo},'%')
        </if>
        <if
                test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <!-- 按签收人查询 -->
        <if
                test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>

        <if
                test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='99' and invoiceSource!='null' and invoiceSource!=''">
            and t.invoice_source =#{invoiceSource}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>
        <!-- 按签收人查询 -->
        <if
                test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>
        <if test='inAccountStatus!=null and inAccountStatus!="" and inAccountStatus !="99"'>
            and t.in_account_status = #{inAccountStatus}
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
        <if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
            and t.sn_voucher_number = #{snVoucherNumber}
        </if>
        <if test="postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'">
            and t.postingTime = #{postingTime}
        </if>
        <if test="imageId != null and imageId != '' and imageId != 'null' and imageId != '99'">
            and t.image_id = #{imageId}
        </if>
        <if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
            and t.account_period = #{accountPeriod}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            order by t.qs_date desc,t.invoice_date desc
        </if>
        <if test="qsksrq==null or qsksrq=='' or qsjsrq==null or qsjsrq==''">
            order by t.invoice_date desc
        </if>

    </select>

    <select id="selectHj" parameterType="java.util.Map"
            resultMap="hjResultMap" databaseId="mysql">
        select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq}
        and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
        and t.rzh_yesorno = '0'
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.company = #{company}
<!--        <if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != 99" >-->
<!--            t.comp_code = #{companyCode}-->
<!--        </if>-->
        <if test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '1'.toString()">
            and t.invoice_status in ('0','7')
            and t.invoice_amount>0
            and t.tax_amount>=0
            and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date
            and d.tj_status in('0','3')
        </if>

        <if test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '0'.toString()">
            and (t.invoice_status in ('1','2','3','4','8','80') or t.invoice_amount &lt;0 or t.tax_amount &lt;0 or
            date_format(t.invoice_date,'%Y%m%d') &lt;= c.select_start_date or
            date_format(t.invoice_date,'%Y%m%d') &gt;=
            c.select_end_date or d.tj_status in ('1','2'))

        </if>
        <if test="sign !='88'">
            and t.gf_tax_no in
            <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>

<!--        and t.comp_code in-->
<!--        <foreach collection="companyCodes" index="index" item="companyCode" open="(" close=")" separator=",">-->
<!--            #{companyCode}-->
<!--        </foreach>-->
        <if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
            and (t.comp_code in
            <foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
                #{companyCode}
            </foreach>
            or t.comp_code is null or t.comp_code = ''
            )
        </if>
        <if test="companyCode != null and companyCode != '99' and companyCode != '88' and companyCode != '' and companyCode != 'null'" >
            and t.comp_code = #{companyCode}
        </if>
        <if test="companyCode != null and companyCode != ''  and companyCode == '88'">
            and (t.comp_code = '' or t.comp_code is null)
        </if>
        <if test="qszt != null and qszt != '' and qszt != 'null' ">
            and t.qs_status = #{qszt}
        </if>
        <if test="suspendStatus != null and suspendStatus != '' and suspendStatus != 'null' and suspendStatus != '99' and suspendStatus == '1'.toString()">
            and t.suspend_status = '1'
        </if>
        <if test="suspendStatus != null and suspendStatus != '' and suspendStatus != 'null' and suspendStatus != '99' and suspendStatus == '0'.toString()">
            and (t.suspend_status = '' or t.suspend_status is null or t.suspend_status = '0')
        </if>
        <if test="suspendDate != null and suspendDate != '' and suspendDate != 'null' ">
            and t.suspend_date = #{suspendDate}
        </if>
        <if test="bzr != null and bzr != '' and bzr != 'null'">
            and t.bzr like concat('%',#{bzr},'%')
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
        </if>
        <if test="voucherNumber != null and voucherNumber != ''">
            and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
            and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if
                test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
            <![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
        </if>
        <if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
            <![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d')  <= #{paymentDateEnd} ]]>
        </if>
        <if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
            and t.payment_status = #{paymentStatus}
        </if>
        <if
                test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <if
                test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='99' and invoiceSource!='null' and invoiceSource!=''">
            and t.invoice_source =#{invoiceSource}
        </if>
        <if test="bzdh != null and bzdh != '' and bzdh != 'null' and bzdh != '99'">
            and t.bzdh = #{bzdh}
        </if>
        <if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()">
            and t.inaccount_status = #{inAccountStatus}
        </if>
        <if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
            and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null)
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>


        <!-- 按签收人查询 -->
        <if
                test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>
        <if test="settlementNo != null and settlementNo != ''">
            and t.settlement_no like concat(#{settlementNo},'%')
        </if>
<!--        <if test='inAccountStatus!=null and inAccountStatus!="" and inAccountStatus !="99"'>-->
<!--            and t.inaccount_status = #{inAccountStatus}-->
<!--        </if>-->
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
        <if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
            and t.sn_voucher_number = #{snVoucherNumber}
        </if>
        <if test="postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99' and postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99'">
            and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
        </if>
        <if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
            and t.image_id = #{imageNumber}
        </if>
        <if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
            and t.account_period = #{accountPeriod}
        </if>
        order by t.bzdh desc
    </select>

    <select id="selectHj" parameterType="java.util.Map"
            resultMap="hjResultMap" databaseId="oracle">
        select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE to_char(t.invoice_date,'yyyy-mm-dd') between #{kpksrq} and #{kpjsrq}
        and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
        and t.rzh_yesorno = '0'
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.company = #{company}
        <if
                test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '1'.toString()">
            and t.invoice_status in ('0','7')
            and t.invoice_amount>0
            and t.tax_amount>=0
            and to_char(t.invoice_date,'yyyymmdd') between c.select_start_date and c.select_end_date
            and d.tj_status in('0','3')
        </if>

        <if
                test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '0'.toString()">
            and (t.invoice_status in ('1','2','3','4','8','80') or t.invoice_amount &lt;0 or t.tax_amount &lt;0 or
            to_char(t.invoice_date,'yyyymmdd') &lt;= c.select_start_date or
            to_char(t.invoice_date,'yyyymmdd') &gt;=
            c.select_end_date or d.tj_status in ('1','2'))

        </if>
        and t.gf_tax_no in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="qszt != null and qszt != '' and qszt != 'null' ">
            and t.qs_status = #{qszt}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and to_char(t.qs_date,'yyyy-mm-dd') between #{qsksrq} and #{qsjsrq}
        </if>
        <if test="voucherNumber != null and voucherNumber != ''">
            and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
            and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if
                test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
            <![CDATA[ AND to_char(t.payment_date,'yyyy-mm-dd') >= #{paymentDateStart} ]]>
        </if>
        <if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
            <![CDATA[ AND to_char(t.payment_date,'yyyy-mm-dd')  <= #{paymentDateEnd} ]]>
        </if>
        <if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
            and t.payment_status = #{paymentStatus}
        </if>
        <if
                test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <if
                test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='null' and invoiceSource!='' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>

        <!-- 按签收人查询 -->
        <if
                test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>
        <if test="settlementNo != null and settlementNo != ''">
            and t.settlement_no like concat(#{settlementNo},'%')
        </if>
        <if test='inAccountStatus!=null and inAccountStatus!="" and inAccountStatus !="99"'>
            and t.in_account_status = #{inAccountStatus}
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
    </select>
    <select id="selectYqBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap">
        select count(1) sl
        from t_dx_record_invoice t
        WHERE (t.yqsq_status in ('1','2') or (t.yqsq_status = '4' and auth_status in ('2','3') ))
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>
    <select id="selectBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap" databaseId="mysql">
        select count(1) sl
        from t_dx_record_invoice t left join t_dx_tax_current c
        on t.gf_tax_no=c.taxno
        WHERE (t.auth_status in('1','2','3') or t.cxrz_status in ('1','2') or t.cxbdk_status in
        ('1','2'))
        and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>

    <select id="selectBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap" databaseId="oracle">
        select count(1) sl
        from t_dx_record_invoice t left join t_dx_tax_current c
        on t.gf_tax_no=c.taxno
        WHERE (t.auth_status in('1','2','3') or t.cxrz_status in ('1','2') or t.cxbdk_status in
        ('1','2'))
        and to_char(t.invoice_date,'yyyyMMdd') between c.select_start_date and c.select_end_date
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>
    <select id="selectExportBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap" databaseId="mysql">
        select count(1) sl
        from t_dx_export_invoice t left join t_dx_tax_current c
        on t.gf_tax_no=c.taxno
        WHERE (t.auth_status in('1','2','3') or t.cxrz_status in ('1','2') or t.cxbdk_status in
        ('1','2'))
        and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>

    <select id="selectExportBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap" databaseId="oracle">
        select count(1) sl
        from t_dx_export_invoice t left join t_dx_tax_current c
        on t.gf_tax_no=c.taxno
        WHERE (t.auth_status in('1','2','3') or t.cxrz_status in ('1','2') or t.cxbdk_status in
        ('1','2'))
        and to_char(t.invoice_date,'yyyyMMdd') between c.select_start_date and c.select_end_date
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>

    <select id="selectCustomsBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap" databaseId="mysql">
        select count(1) sl
        from t_dx_customs_record t left join t_dx_tax_current c
        on t.gf_tax_no=c.taxno
        WHERE (t.auth_status in('1','2','3') or t.cxrz_status in ('1','2') or t.cxbdk_status in
        ('1','2'))
        and date_format(t.fill_in_date,'%Y%m%d') between c.select_start_date and c.select_end_date
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>
    <select id="selectCustomsBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap" databaseId="oracle">
        select count(1) sl
        from t_dx_customs_record t left join t_dx_tax_current c
        on t.gf_tax_no=c.taxno
        WHERE (t.auth_status in('1','2','3') or t.cxrz_status in ('1','2') or t.cxbdk_status in
        ('1','2'))
        and to_char(t.fill_in_date,'yyyyMMdd') between c.select_start_date and c.select_end_date
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>
    <select id="selectExportCustomsBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap" databaseId="mysql">
        select count(1) sl
        from t_dx_export_customs t left join t_dx_tax_current c
        on t.gf_tax_no=c.taxno
        WHERE (t.auth_status in('1','2','3') or t.cxrz_status in ('1','2') or t.cxbdk_status in
        ('1','2'))
        and date_format(t.fill_in_date,'%Y%m%d') between c.select_start_date and c.select_end_date
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>
    <select id="selectExportCustomsBeforeTj" parameterType="java.util.Map"
            resultMap="boforeTjResultMap" databaseId="oracle">
        select count(1) sl
        from t_dx_export_customs t left join t_dx_tax_current c
        on t.gf_tax_no=c.taxno
        WHERE (t.auth_status in('1','2','3') or t.cxrz_status in ('1','2') or t.cxbdk_status in
        ('1','2'))
        and to_char(t.fill_in_date,'yyyyMMdd') between c.select_start_date and c.select_end_date
        <if test="gfsh != null and gfsh != '' and gfsh != 'null' ">
            and t.gf_tax_no = #{gfsh}
        </if>


    </select>

    <update id="updateGx" parameterType="java.util.Map" databaseId="mysql">
        update t_dx_record_invoice
        set sfygx='1',
            auth_status='1',
            gx_type=#{gxType},
            rzlx='1',
            bdk_status=#{bdkStatus},
            dk_tax_amount=#{dkTaxAmount},
            gx_date=now(),
            gx_user_name=#{userName},
            gx_user_account=#{userAccount},
            cxrz_status='0',
            cxrz_date=null
        where id = #{id}
    </update>
    <update id="updateGx" parameterType="java.util.Map" databaseId="oracle">
        update t_dx_record_invoice
        set sfygx='1',
            auth_status='1',
            gx_type=#{gxType},
            rzlx='1',
            bdk_status=#{bdkStatus},
            dk_tax_amount=#{dkTaxAmount},
            gx_date=sysdate,
            gx_user_name=#{userName},
            gx_user_account=#{userAccount},
            cxrz_status='0',
            cxrz_date=null
        where id = #{id}
    </update>
    <update id="updateCxGx" parameterType="java.util.Map">
        update t_dx_record_invoice
        set sfygx='0',
            auth_status='0',
            gx_type=null,
            rzlx='0',
            bdk_status='0',
            dk_tax_amount=#{taxAmount},
            gx_date=null,
            gx_user_name=null,
            gx_user_account=null
        where id = #{id}
    </update>

    <select id="selectZngx" resultType="com.dxhy.base.entity.BaseTDxRecordInvoice" databaseId="mysql">
        select
        t.id,
        t.invoice_code invoiceCode,
        t.invoice_no invoiceNo,
        t.invoice_date invoiceDate,
        t.gf_name gfName,
        t.xf_name xfName,
        t.invoice_amount invoiceAmount,
        t.tax_amount taxAmount,
        t.qs_status qsStatus,
        t.qs_date qsDate,
        t.qs_type qsType,
        t.ele_invoice_no as eleInvoiceNo,
        t.dept_name deptName
        from t_dx_record_invoice t
        left join t_dx_tax_current tdtc on t.gf_tax_no=tdtc.taxno
        where date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq}
        and t.rzh_yesorno = '0'
        and t.invoice_status in ('0','7')
        and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
        and t.export_mark = '0'
        and t.invoice_amount>0
        and t.tax_amount>=0
        and t.auth_status in ('0','5','6')
        <![CDATA[ and date_format(t.invoice_date,'%Y%m%d') >= tdtc.select_start_date and date_format(t.invoice_date,'%Y%m%d')<=tdtc.select_end_date ]]>
        <if test="gfsh!=null and gfsh != ''">
            and t.gf_tax_no = #{gfsh}
        </if>
        <if test="qszt!=null and qszt != ''">
            and t.qs_status = #{qszt}
        </if>
        <if test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business!=null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>
        <if test="qsfs!=null and qsfs!=''">
            and t.qs_type = #{qsfs}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
            and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="xfmc!=null and xfmc!=''">
            and xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
        <if test='yxsxfs == "-1"'>
            order by invoice_date desc,tax_amount
        </if>
        <if test='yxsxfs == "1"'>
            order by invoice_date asc,tax_amount
        </if>
    </select>
    <select id="selectZngx" resultType="com.dxhy.base.entity.BaseTDxRecordInvoice"
            databaseId="oracle">
        select
        t.id,
        t.invoice_code invoiceCode,
        t.invoice_no invoiceNo,
        t.invoice_date invoiceDate,
        t.gf_name gfName,
        t.xf_name xfName,
        t.invoice_amount invoiceAmount,
        t.tax_amount taxAmount,
        t.qs_status qsStatus,
        t.qs_date qsDate,
        t.qs_type qsType,
        t.ele_invoice_no as eleInvoiceNo,
        t.dept_name deptName
        from t_dx_record_invoice t
        left join t_dx_tax_current tdtc on t.gf_tax_no=tdtc.taxno
        where to_char(t.invoice_date,'yyyy-MM-dd') between #{kpksrq} and #{kpjsrq}
        and t.rzh_yesorno = '0'
        and t.invoice_status in ('0','7')
        and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
        and t.invoice_amount>0
        and t.tax_amount>=0
        and t.auth_status in ('0','5','6')
        <![CDATA[ and to_char(t.invoice_date,'yyyy-MM-dd') >= tdtc.select_start_date and to_char(t.invoice_date,'yyyy-MM-dd')<=tdtc.select_end_date ]]>
        <if test="gfsh!=null and gfsh != ''">
            and t.gf_tax_no = #{gfsh}
        </if>
        <if test="qszt!=null and qszt != ''">
            and t.qs_status = #{qszt}
        </if>
        <if
                test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business!=null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>
        <if test="qsfs!=null and qsfs!=''">
            and t.qs_type = #{qsfs}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and to_char(t.qs_date,'yyyy-MM-dd') between #{qsksrq} and #{qsjsrq}
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
            and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="xfmc!=null and xfmc!=''">
            and xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
        <if test='yxsxfs == "-1"'>
            order by invoice_date desc,tax_amount
        </if>
        <if test='yxsxfs == "1"'>
            order by invoice_date asc,tax_amount
        </if>
    </select>


    <select id="selectDkse" parameterType="java.util.Map"
            resultType="com.dxhy.base.entity.BaseTDxRecordInvoice" databaseId="mysql">
        select sum(t.dk_tax_amount) dkTaxAmount
        from t_dx_record_invoice t
        WHERE t.invoice_type in ('01', '03', '08', '14')
          and t.bdk_status = '1'
          and t.auth_status in ('2', '3', '4')
          and t.gf_tax_no = #{gfsh}
          and t.rzh_belong_date = #{skssq}

    </select>
    <select id="selectCustomsDkse" parameterType="java.util.Map"
            resultType="java.math.BigDecimal" databaseId="mysql">
        select sum(t.yx_tax_amount) dkTaxAmount
        from t_dx_customs_record t
        WHERE t.data_type = '17'
          and t.bdk_status = '1'
          and t.auth_status in ('2', '3', '4')
          and t.gf_tax_no = #{gfsh}
          and t.rzh_belong_date = #{skssq}

    </select>

    <select id="selectRzhAll" parameterType="java.util.Map"
            resultMap="SggxcxResultMap" databaseId="mysql">
        select t.invoice_type,t.dept_id
        ,t.id,t.invoice_code,t.invoice_no,t.gf_name,t.gf_tax_no,t.xf_name,
        DATE_FORMAT(t.invoice_date,'%Y-%m-%d')invoice_date,t.invoice_amount,t.tax_amount,t.invoice_status,DATE_FORMAT(t.qs_date,'%Y-%m-%d')qs_date
        ,t.qs_type,t.qs_status,t.dk_tax_amount,t.qs_name
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq}
        and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
        and t.rzh_yesorno = '0'
        and t.invoice_status in ('0','7')
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.invoice_amount>0
        and t.tax_amount>=0
        and d.tj_status in('0','3')
        and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date
        and t.gf_tax_no in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="qszt != null and qszt != '' and qszt != 'null' ">
            and t.qs_status = #{qszt}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
        </if>
        <if
                test="invoiceType != null and invoiceType != '' and invoiceType != 'null' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if
                test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if
                test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <!-- 按签收人查询 -->
        <if
                test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>

        <if
                test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>
        <if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            order by t.qs_date desc,t.invoice_date desc
        </if>
        <if test="qsksrq==null or qsksrq=='' or qsjsrq==null or qsjsrq==''">
            order by t.invoice_date desc
        </if>

    </select>

    <select id="selectRzhAll" parameterType="java.util.Map"
            resultMap="SggxcxResultMap" databaseId="oracle">
        select t.invoice_type,t.dept_id
        ,t.id,t.invoice_code,t.invoice_no,t.gf_name,t.gf_tax_no,t.xf_name,
        to_char(t.invoice_date,'yyyy-mm-dd
        hh:mm:ss')invoice_date,t.invoice_amount,t.tax_amount,t.invoice_status,
        to_char(t.qs_date,'yyyy-mm-dd hh:mm:ss')qs_date,t.qs_type,t.qs_status,t.dk_tax_amount,t.qs_name
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE to_char(t.invoice_date,'yyyy-MM-dd') between #{kpksrq} and #{kpjsrq}
        and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
        and t.rzh_yesorno = '0'
        and t.invoice_status in ('0','7')
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.invoice_amount>0
        and t.tax_amount>=0
        and d.tj_status in('0','3')
        and to_char(t.invoice_date,'yyyyMMdd') between c.select_start_date and c.select_end_date
        and t.gf_tax_no in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="qszt != null and qszt != '' and qszt != 'null' ">
            and t.qs_status = #{qszt}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and to_char(t.qs_date,'yyyy-MM-dd') between #{qsksrq} and #{qsjsrq}
        </if>
        <if
                test="invoiceType != null and invoiceType != '' and invoiceType != 'null' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if
                test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if
                test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <!-- 按签收人查询 -->
        <if
                test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>

        <if
                test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>
        <if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            order by t.qs_date desc,t.invoice_date desc
        </if>
        <if test="qsksrq==null or qsksrq=='' or qsjsrq==null or qsjsrq==''">
            order by t.invoice_date desc
        </if>

    </select>
    <select id="selectRzhAllHj" parameterType="java.util.Map"
            resultMap="hjResultMap" databaseId="mysql">
        select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.dk_tax_amount)hjse
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{kpksrq} and #{kpjsrq}
        and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
        and t.rzh_yesorno = '0'
        and t.invoice_status in ('0','7')
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.invoice_amount>0
        and t.tax_amount>=0
        and d.tj_status in('0','3')
        and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date
        and t.gf_tax_no in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="qszt != null and qszt != '' and qszt != 'null' ">
            and t.qs_status = #{qszt}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
        </if>
        <if
                test="invoiceType != null and invoiceType != '' and invoiceType != 'null' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if
                test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if
                test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <if
                test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>

        <!-- 按签收人查询 -->
        <if
                test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>

    </select>
    <select id="selectRzhAllHj" parameterType="java.util.Map"
            resultMap="hjResultMap" databaseId="oracle">
        select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.dk_tax_amount)hjse
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE to_char(t.invoice_date,'yyyy-MM-dd') between #{kpksrq} and #{kpjsrq}
        and t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08')
        and t.rzh_yesorno = '0'
        and t.invoice_status in ('0','7')
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.invoice_amount>0
        and t.tax_amount>=0
        and d.tj_status in('0','3')
        and to_char(t.invoice_date,'yyyyMMdd') between c.select_start_date and c.select_end_date
        and t.gf_tax_no in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>
        <if test="qszt != null and qszt != '' and qszt != 'null' ">
            and t.qs_status = #{qszt}
        </if>
        <if
                test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and to_char(t.qs_date,'yyyy-MM-dd') between #{qsksrq} and #{qsjsrq}
        </if>
        <if
                test="invoiceType != null and invoiceType != '' and invoiceType != 'null' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if
                test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if
                test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <if
                test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>

        <!-- 按签收人查询 -->
        <if
                test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
    </select>

    <select id="selectInTellingCheck" parameterType="java.util.Map"
            resultMap="SggxcxResultMap" databaseId="mysql">
        select t.invoice_type,t.dept_id,t.dept_name,t.comp_code
        ,t.id,t.invoice_code,t.invoice_no,t.gf_name,t.gf_tax_no,t.xf_name,
        DATE_FORMAT(t.invoice_date,'%Y-%m-%d')invoice_date,t.invoice_amount,t.tax_amount,t.invoice_status,DATE_FORMAT(t.qs_date,'%Y-%m-%d')qs_date
        ,t.qs_type,t.qs_status,t.dk_tax_amount,t.qs_name,t.sn_voucher_number,t.posting_time,t.image_id,t.account_period,
        case date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date when
        true then 1
        else 2 end authStatus,t.bzdh,t.bzr,t.suspend_status,t.suspend_date,
        t.inaccount_status,t.payment_status,DATE_FORMAT(t.payment_date,'%Y-%m-%d')payment_date,t.settlement_no,t.ele_invoice_no
        from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
        left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
        WHERE  (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
        and t.rzh_yesorno = '0'
        and t.auth_status in('0','5','6')
        and t.export_mark = '0'
        and t.company = #{company}
        and t.invoice_status = '0'
        and t.tax_amount > 0
        and t.gf_tax_no in
        <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
            #{item}
        </foreach>

        <if test="companyCode != null and companyCode != '99' and companyCode != '88' and companyCode != '' and companyCode != 'null'" >
            and t.comp_code = #{companyCode}
        </if>
        <if test="companyCode != null and companyCode != ''  and companyCode == '88'">
            and (t.comp_code = '' or t.comp_code is null)
        </if>

        <if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus == '0'.toString()">
            and t.inaccount_status = '1'
        </if>

        <if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
        </if>
        <if test="voucherNumber != null and voucherNumber != ''">
            and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
        </if>
        <if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
            <![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
        </if>
        <if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
            <![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d')  <= #{paymentDateEnd} ]]>
        </if>
        <if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
            and t.payment_status = #{paymentStatus}
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
            and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
        </if>
        <if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
            and t.invoice_type = #{invoiceType}
        </if>
        <if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
            and t.invoice_source = #{invoiceSource}
        </if>
        <if test="fpzt != null and fpzt != '' and fpzt != 'null'">
            and t.invoice_status = #{fpzt}
        </if>
        <if test="qsfs != null and qsfs != '' and qsfs != 'null' ">
            and t.qs_type = #{qsfs}
        </if>
        <if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
            and t.xf_name like concat(#{xfmc},'%')
        </if>
        <if test="qsr != null and qsr != '' and qsr != 'null' ">
            and t.qs_name = #{qsr}
        </if>
        <if test="settlementNo != null and settlementNo != ''">
            and t.settlement_no like concat(#{settlementNo},'%')
        </if>
        <if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
            and t.invoice_no = #{invoiceNo}
        </if>
        <!-- 按签收人查询 -->
        <if  test="position != null and position != '' and position != 'null' and position == '1'.toString()">
            and t.qs_name = #{username}
        </if>

        <if test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
            and t.dept_id = #{businessCode}
        </if>
        <if test="businessCode==''">
            and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
        </if>
        <if test='businessCode == "99" and business != null and business.size()>0'>
            and (t.dept_id in
            <foreach collection="business" index="index" item="item" open="(" separator="," close="">
                #{item.businessCode}
            </foreach>
            ) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
        </if>
        <if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
            and t.ele_invoice_no = #{eleInvoiceNo}
        </if>
        <if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
            and t.sn_voucher_number = #{snVoucherNumber}
        </if>
        <if test="postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99' and postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99'">
            and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
        </if>
        <if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
            and t.image_id = #{imageNumber}
        </if>
        <if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
            and t.account_period = #{accountPeriod}
        </if>
        <if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
            order by t.qs_date desc,t.invoice_date desc
        </if>
        <if test="qsksrq==null or qsksrq=='' or qsjsrq==null or qsjsrq==''">
            order by t.invoice_date desc
        </if>

    </select>

    <update id="updateSuspendType" parameterType="java.util.Map" databaseId="mysql">
        update t_dx_record_invoice
        set suspend_status = #{suspendStatus},
        suspend_date = #{suspendDate}
        where uuid in
        <foreach collection="uuids" item="uuid" index="index" open="(" separator="," close=")">
            #{uuid}
        </foreach>
    </update>

    <select id="findSuspendStatus" parameterType="java.util.List" resultType="java.lang.String">
        select suspend_status from t_dx_record_invoice
        where uuid in
        <foreach collection="uuids" item="uuid" index="index" open="(" separator="," close=")">
            #{uuid}
        </foreach>
    </select>
</mapper>
