<?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="cn.superdesk.uniorder.dao.mapper.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxMapperEx">


    <resultMap id="SzhtxxElectronicInvoiceFptxxVoResultMap"
               type="cn.superdesk.uniorder.dto.vo.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxListItemVo">
        <id column="id" jdbcType="BIGINT" property="id"/>
        <result column="fpqqlsh" jdbcType="VARCHAR" property="fpqqlsh"/>
        <result column="kpxm" jdbcType="VARCHAR" property="kpxm"/>
        <result column="xhf_nsrsbh" jdbcType="VARCHAR" property="xhfNsrsbh"/>
        <result column="xhfmc" jdbcType="VARCHAR" property="xhfmc"/>
        <result column="xhf_dzdh" jdbcType="VARCHAR" property="xhfDzdh"/>
        <result column="xhf_yhzh" jdbcType="VARCHAR" property="xhfYhzh"/>
        <result column="ghfmc" jdbcType="VARCHAR" property="ghfmc"/>
        <result column="ghf_nsrsbh" jdbcType="VARCHAR" property="ghfNsrsbh"/>
        <result column="ghf_yhzh" jdbcType="VARCHAR" property="ghfYhzh"/>
        <result column="ghf_dzdh" jdbcType="VARCHAR" property="ghfDzdh"/>
        <result column="ghf_sj" jdbcType="VARCHAR" property="ghfSj"/>
        <result column="ghf_email" jdbcType="VARCHAR" property="ghfEmail"/>
        <result column="bill_sent_sign" jdbcType="VARCHAR" property="billSentSign"/>
        <result column="call_back_url_pdf" jdbcType="VARCHAR" property="callBackUrlPdf"/>
        <result column="ghfqylx" jdbcType="VARCHAR" property="ghfqylx"/>
        <result column="dkbz" jdbcType="VARCHAR" property="dkbz"/>
        <result column="fjh" jdbcType="VARCHAR" property="fjh"/>
        <result column="kpy" jdbcType="VARCHAR" property="kpy"/>
        <result column="sky" jdbcType="VARCHAR" property="sky"/>
        <result column="fhr" jdbcType="VARCHAR" property="fhr"/>
        <result column="kplx" jdbcType="VARCHAR" property="kplx"/>
        <result column="yfp_dm" jdbcType="VARCHAR" property="yfpDm"/>
        <result column="yfp_hm" jdbcType="VARCHAR" property="yfpHm"/>
        <result column="qd_bz" jdbcType="VARCHAR" property="qdBz"/>
        <result column="qdxmmc" jdbcType="VARCHAR" property="qdxmmc"/>

        <result column="kphjje" jdbcType="DECIMAL" property="kphjje"/>
        <result column="hjbhsje" jdbcType="DECIMAL" property="hjbhsje"/>
        <result column="hjse" jdbcType="DECIMAL" property="hjse"/>

        <result column="bz" jdbcType="VARCHAR" property="bz"/>

        <result column="invoice_type" jdbcType="TINYINT" property="invoiceType" />
        <result column="red_reason" jdbcType="TINYINT" property="redReason" />
        <result column="blue_inv_date" jdbcType="VARCHAR" property="blueInvDate" />
        <result column="blue_inv_kind" jdbcType="VARCHAR" property="blueInvKind" />
        <result column="inv_reason" jdbcType="TINYINT" property="invReason" />

        <result column="return_code" jdbcType="VARCHAR" property="returnCode"/>
        <result column="return_msg" jdbcType="VARCHAR" property="returnMsg"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="create_user_id" jdbcType="BIGINT" property="createUserId"/>
        <result column="create_user_name" jdbcType="VARCHAR" property="createUserName"/>

        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
        <result column="update_user_id" jdbcType="BIGINT" property="updateUserId"/>
        <result column="update_user_name" jdbcType="VARCHAR" property="updateUserName"/>

        <result column="deleted" jdbcType="TINYINT" property="deleted"/>

        <!-- szhtxx_electronic_invoice_fptxx_result -->
        <result column="returned_hjbhsje" jdbcType="DECIMAL" property="returnedHjbhsje"/>
        <result column="returned_hjse" jdbcType="DECIMAL" property="returnedHjse"/>

        <result column="kprq" jdbcType="VARCHAR" property="kprq"/>
        <result column="fpdm" jdbcType="VARCHAR" property="fpdm"/>
        <result column="fphm" jdbcType="VARCHAR" property="fphm"/>
        <result column="pdf_url" jdbcType="VARCHAR" property="pdfUrl"/>
        <result column="jym" jdbcType="VARCHAR" property="jym"/>
        <result column="ssyf" jdbcType="VARCHAR" property="ssyf"/>
        <result column="returned_fjh" jdbcType="VARCHAR" property="returnedFjh"/>
        <result column="ewm" jdbcType="VARCHAR" property="ewm"/>
        <result column="szqm" jdbcType="VARCHAR" property="szqm"/>

        <!-- szhtxx_electronic_invoice_fptxx_extend_info -->
        <result column="bill_sent_sign_name" jdbcType="VARCHAR" property="billSentSignName" />
        <result column="pdf_url_original" jdbcType="VARCHAR" property="pdfUrlOriginal" />
        <result column="pdf_url_saved" jdbcType="VARCHAR" property="pdfUrlSaved" />
        <result column="ghfqylx_name" jdbcType="VARCHAR" property="ghfqylxName" />
        <result column="kplx_name" jdbcType="VARCHAR" property="kplxName" />
        <result column="qd_bz_name" jdbcType="VARCHAR" property="qdBzName" />
        <result column="remark2" jdbcType="VARCHAR" property="remark2" />
        <result column="reason_red_write" jdbcType="VARCHAR" property="reasonRedWrite" />
        <result column="is_red_write_off" jdbcType="TINYINT" property="isRedWriteOff" />
        <result column="red_tax_info_sn" jdbcType="VARCHAR" property="redTaxInfoSn" />

        <result column="product_manager_requirements_blue_or_red_invoice_number" jdbcType="VARCHAR" property="productManagerRequirementsBlueOrRedInvoiceNumber" />
        <result column="product_manager_requirements_blue_or_red_invoice_code" jdbcType="VARCHAR" property="productManagerRequirementsBlueOrRedInvoiceCode" />
        <result column="pushed_out_status" jdbcType="TINYINT" property="pushedOutStatus" />
        <result column="sent_email_status" jdbcType="TINYINT" property="sentEmailStatus" />

        <result column="extend_info_op_update_time" jdbcType="TIMESTAMP" property="extendInfoOpUpdateTime"/>
        <result column="extend_info_op_update_user_id" jdbcType="BIGINT" property="extendInfoOpUpdateUserId"/>
        <result column="extend_info_op_update_user_name" jdbcType="VARCHAR" property="extendInfoOpUpdateUserName"/>

        <result column="become_invalid_user_id" jdbcType="BIGINT" property="becomeInvalidUserId"/>
        <result column="become_invalid_user_name" jdbcType="VARCHAR" property="becomeInvalidUserName"/>
        <result column="become_invalid_time" jdbcType="TIMESTAMP" property="becomeInvalidTime"/>
        <result column="become_invalid_reason" jdbcType="VARCHAR" property="becomeInvalidReason"/>

        <result column="flag_void_sign" jdbcType="TINYINT" property="flagVoidSign" />
        <result column="flag_repair" jdbcType="TINYINT" property="flagRepair" />
        <result column="flag_list" jdbcType="TINYINT" property="flagList" />


        <!-- invoice_apply -->
        <result column="back_account_status" jdbcType="TINYINT" property="backAccountStatus"/>
        <result column="back_account_mode_record" jdbcType="TINYINT" property="backAccountModeRecord"/>
        <result column="back_account_user_id" jdbcType="BIGINT" property="backAccountUserId"/>
        <result column="back_account_time" jdbcType="TIMESTAMP" property="backAccountTime"/>

        <result column="accounting_order_id" jdbcType="BIGINT" property="accountingOrderId"/>
        <result column="accounting_order_sn" jdbcType="VARCHAR" property="accountingOrderSn"/>

        <result column="invoice_apply_id" jdbcType="BIGINT" property="invoiceApplyId"/>
        <result column="invoice_apply_sn" jdbcType="VARCHAR" property="invoiceApplySn"/>

        <result column="invoice_type_id" jdbcType="BIGINT" property="invoiceTypeId"/>
        <result column="invoice_mode" jdbcType="VARCHAR" property="invoiceMode"/>

        <result column="tax_rate" jdbcType="VARCHAR" property="taxRate"/>

        <result column="service_no" jdbcType="VARCHAR" property="serviceNo"/>
        <result column="source_from" jdbcType="VARCHAR" property="sourceFrom"/>

        <result column="sys_org_id" jdbcType="BIGINT" property="sysOrgId"/>
        <result column="sys_virt_id" jdbcType="BIGINT" property="sysVirtId"/>
        <result column="out_org_id" jdbcType="BIGINT" property="outOrgId"/>
        <result column="out_virt_id" jdbcType="BIGINT" property="outVirtId"/>

    </resultMap>

    <select id="pageQueryGenericParam" resultMap="SzhtxxElectronicInvoiceFptxxVoResultMap">

        SELECT
            szhteif.id,
            szhteif.fpqqlsh,
            szhteif.kpxm,
            szhteif.xhf_nsrsbh,
            szhteif.xhfmc,
            szhteif.xhf_dzdh,
            szhteif.xhf_yhzh,
            szhteif.ghfmc,
            szhteif.ghf_nsrsbh,
            szhteif.ghf_yhzh,
            szhteif.ghf_dzdh,
            szhteif.ghf_sj,
            szhteif.ghf_email,
            szhteif.bill_sent_sign,
            szhteif.call_back_url,
            szhteif.ghfqylx,
            szhteif.dkbz,
            szhteif.fjh,
            szhteif.kpy,
            szhteif.sky,
            szhteif.fhr,
            szhteif.kplx,
            szhteif.yfp_dm,
            szhteif.yfp_hm,
            szhteif.qd_bz,
            szhteif.qdxmmc,
            szhteif.kphjje,
            szhteif.hjbhsje,
            szhteif.hjse,
            szhteif.bz,
            szhteif.return_code,
            szhteif.return_msg,
            szhteif.create_time,
            szhteif.create_user_id,
            szhteif.create_user_name,
            szhteif.update_time,
            szhteif.update_user_id,
            szhteif.update_user_name,
            szhteif.deleted,
            szhteif.batch_id,
            szhteif.invoice_type,
            szhteif.red_reason,
            szhteif.blue_inv_date,
            szhteif.blue_inv_kind,
            szhteif.inv_reason,

            szhteifr.hjbhsje as returned_hjbhsje,
            szhteifr.hjse as returned_hjse,
            szhteifr.kprq,
            szhteifr.fpdm,
            szhteifr.fphm,
            szhteifr.pdf_url,
            szhteifr.jym,
            szhteifr.ssyf,
            szhteifr.fjh,
            szhteifr.ewm,
            szhteifr.szqm,

            szhteifei.bill_sent_sign_name,
            szhteifei.pdf_url_original,
            szhteifei.pdf_url_saved,
            szhteifei.ghfqylx_name,
            szhteifei.kplx_name,
            szhteifei.qd_bz_name,
            szhteifei.remark2,
            szhteifei.reason_red_write,
            szhteifei.is_red_write_off,
            szhteifei.red_tax_info_sn,

            szhteifei.update_time as extend_info_op_update_time,
            szhteifei.update_user_id as extend_info_op_update_user_id,
            szhteifei.update_user_name as extend_info_op_update_user_name,

            szhteifei.product_manager_requirements_blue_or_red_invoice_number,
            szhteifei.product_manager_requirements_blue_or_red_invoice_code,
            szhteifei.pushed_out_status,
            szhteifei.sent_email_status,

            szhteifei.become_invalid_user_id,
            szhteifei.become_invalid_user_name,
            szhteifei.become_invalid_time,
            szhteifei.become_invalid_reason,
            szhteifei.flag_void_sign,
            szhteifei.flag_repair,
            szhteifei.flag_list,

            inva.back_account_status,
            inva.back_account_mode_record,
            inva.back_account_user_id,
            inva.back_account_time,

            inva.accounting_order_id,
            inva.accounting_order_sn,

            inva.id as invoice_apply_id,
            inva.invoice_apply_sn,

            inva.invoice_type as invoice_type_id,
            inva.invoice_mode,

            inva.tax_rate,

            inva.service_no,
            inva.source_from,

            inva.sys_org_id,
            inva.sys_virt_id,
            inva.out_org_id,
            inva.out_virt_id

        FROM
            szhtxx_electronic_invoice_fptxx szhteif
            LEFT JOIN szhtxx_electronic_invoice_fptxx_result szhteifr ON szhteif.fpqqlsh = szhteifr.fpqqlsh
            LEFT JOIN szhtxx_electronic_invoice_fptxx_extend_info szhteifei ON szhteif.fpqqlsh = szhteifei.fpqqlsh
            LEFT JOIN invoice_apply inva ON szhteifei.invoice_apply_sn = inva.invoice_apply_sn
        <where>
            and 1 = 1
            <include refid="whereIf"></include>

            <choose>
                <when test="orderByClause != null and orderByClause != '' ">
                    order by ${orderByClause}
                </when>
                <otherwise>
                    order by szhteif.create_time desc
                    <!-- szhteifr.fphm desc -->
                </otherwise>
            </choose>
        </where>
    </select>


    <resultMap id="SzhtxxElectronicInvoiceFptxxHeadDataVoResultMap" type="cn.superdesk.uniorder.dto.vo.thirdpart.szhtxx.electronicInvoice.SzhtxxElectronicInvoiceFptxxHeadDataVo">

        <result column="fptxx_count" jdbcType="INTEGER" property="fptxxCount"/>

        <result column="kphjje" jdbcType="DECIMAL" property="kphjje"/>
        <result column="hjbhsje" jdbcType="DECIMAL" property="hjbhsje"/>
        <result column="hjse" jdbcType="DECIMAL" property="hjse"/>

    </resultMap>

    <select id="headDataGenericParam" resultMap="SzhtxxElectronicInvoiceFptxxHeadDataVoResultMap">

        SELECT

            count(szhteif.id) AS fptxx_count,
            SUM(szhteif.kphjje) AS kphjje,
            SUM(szhteif.hjbhsje) AS hjbhsje,
            SUM(szhteif.hjse) AS hjse

        FROM
            szhtxx_electronic_invoice_fptxx szhteif
            LEFT JOIN szhtxx_electronic_invoice_fptxx_result szhteifr ON szhteif.fpqqlsh = szhteifr.fpqqlsh
            LEFT JOIN szhtxx_electronic_invoice_fptxx_extend_info szhteifei ON szhteif.fpqqlsh = szhteifei.fpqqlsh
            LEFT JOIN invoice_apply inva ON szhteifei.invoice_apply_sn = inva.invoice_apply_sn
        <where>
            <include refid="whereIf"></include>
        </where>
    </select>

    <sql id="whereIf">
    and szhteif.deleted = 0
    and szhteifr.deleted = 0

    <if test="fpqqlshSelected != null and fpqqlshSelected.size > 0">
        and szhteif.fpqqlsh in
        <foreach collection="fpqqlshSelected" index="index" item="fpqqlsh" open="(" close=")" separator=",">
            #{fpqqlsh,jdbcType=VARCHAR}
        </foreach>
    </if>
    <if test="szhtxxElectronicInvoiceFptxxIdSelected != null and szhtxxElectronicInvoiceFptxxIdSelected.size > 0">
        and szhteif.id in
        <foreach collection="szhtxxElectronicInvoiceFptxxIdSelected" index="index" item="id" open="(" close=")" separator=",">
            #{id}
        </foreach>
    </if>

    <if test="szhtxxElectronicInvoiceFptxxId != null and szhtxxElectronicInvoiceFptxxId != ''">
        and szhteif.id = #{szhtxxElectronicInvoiceFptxxId,jdbcType=BIGINT}
    </if>

    <!-- 2.7.3.1-发票号 单向 精确 -->
    <if test="fphm != null and fphm != ''">
        and szhteifr.fphm = #{fphm,jdbcType=VARCHAR}
    </if>
    <!-- 2.7.3.1-发票号 区向 开始或结束的发票号 -->
    <if test="fphmStart != null and fphmStart != '' and fphmEnd != null and fphmEnd != ''">
        <!--
        and szhteifr.fphm between( #{fphmStart,jdbcType=VARCHAR},#{fphmEnd,jdbcType=VARCHAR})
        -->

        AND szhteifr.fphm &gt;= #{fphmStart,jdbcType=VARCHAR}
        AND szhteifr.fphm &lt;= #{fphmEnd,jdbcType=VARCHAR}
    </if>

    <!-- 2.7.3.2-(5)发票代码:对当前列表数据`发票代码`字段内容,`精确`查询,多张发票存在同一个发票代码; -->
    <if test="fpdm != null and fpdm != ''">
        and szhteifr.fpdm = #{fpdm,jdbcType=VARCHAR}
    </if>

    <!-- 2.7.3.2-(6)开票申请编号:对当前列表数据中`开票申请编号`字段内容,`精确`查询; -->
    <if test="invoiceApplySn != null and invoiceApplySn != ''">
        and inva.invoice_apply_sn = #{invoiceApplySn,jdbcType=VARCHAR}
    </if>
    <if test="fpqqlsh != null and fpqqlsh != ''">
        and szhteif.fpqqlsh = #{fpqqlsh,jdbcType=VARCHAR}
    </if>

    <!-- 2.7.3.2-(7)对账单编号:对当前列表数据中`对账单编号`字段内容,`精确`查询; -->
    <if test="accountingOrderSn != null and accountingOrderSn != ''">
        and inva.accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR}
    </if>

    <!-- 2.7.3.2-(8)购买方税号:对当前列表数据中`购买方税号`字段内容,`精确`查询; -->
    <if test="ghfNsrsbh != null and ghfNsrsbh != ''">
        and szhteif.ghf_nsrsbh = #{ghfNsrsbh,jdbcType=VARCHAR}
    </if>
    <if test="ghfmc != null and ghfmc != ''">
        and szhteif.ghfmc like CONCAT('%', #{ghfmc}, '%')
    </if>
    <!-- 2.7.3.2-(9)销售方税号:对当前列表数据中`销售方税号`字段内容,`精确`查询; -->
    <if test="xhfNsrsbh != null and xhfNsrsbh != ''">
        and szhteif.xhf_nsrsbh = #{xhfNsrsbh,jdbcType=VARCHAR}
    </if>

    <!-- 2.7.3.2-(10)开票人:对当前列表数据`开票人`字段内容,`模糊`查询; -->
    <if test="kpy != null and kpy != ''">
        and szhteif.kpy like CONCAT('%',#{kpy},'%')
    </if>
    <!-- 2.7.3.2-(11)收款人:对当前列表数据`收款人`字段内容,`模糊`查询; -->
    <if test="sky != null and sky != ''">
        and szhteif.sky like CONCAT('%',#{sky},'%')
    </if>
    <!-- 2.7.3.2-(12)复核人:对当前列表数据`复核人`字段内容,`模糊`查询; -->
    <if test="fhr != null and fhr != ''">
        and szhteif.fhr like CONCAT('%',#{fhr},'%')
    </if>

    <!-- 2.7.3.2-(13)回款登记人:对当前列表数据`回款登记人`字段内容,`模糊`查询; -->
    <if test="backAccountUserId != null and backAccountUserId != ''">
        and inva.back_account_user_id = #{backAccountUserId,jdbcType=BIGINT}
    </if>
    <!-- 2.7.3.2-(13)开票申请人:对当前列表数据`回款登记人`字段内容,`模糊`查询; -->
    <if test="makeInvoiceUserId != null and makeInvoiceUserId != ''">
        and inva.make_invoice_user_id = #{makeInvoiceUserId,jdbcType=BIGINT}
    </if>
    <!-- 2.7.3.2-(13)创建人:对当前列表数据`创建人`字段内容,`模糊`查询; -->
    <if test="fptxxCreateUserId != null and fptxxCreateUserId != ''">
        and szhteif.create_user_id = #{fptxxCreateUserId,jdbcType=BIGINT}
    </if>

    <!-- 2.7.3.3-企业名称;`模糊`查询; -->
    <!-- 2.7.3.3-企业名称;`模糊`查询;预留; -->
    <if test="outVirtId != null and outVirtId != ''">
        and inva.out_virt_id = #{outVirtId,jdbcType=BIGINT}
    </if>

    <!-- 2.7.3.4 发票种类; -->
    <if test="invoiceTypeId != null and invoiceTypeId != ''">
        and inva.invoice_type = #{invoiceTypeId,jdbcType=BIGINT}
    </if>

    <!-- 2.7.3.5 开票方式;-单选 -->
    <if test="invoiceMode != null and invoiceMode != ''">
        and inva.invoice_mode = #{invoiceMode,jdbcType=VARCHAR}
    </if>
    <!-- 2.7.3.5 开票方式;-多选 -->
    <if test="invoiceModeSelected != null and invoiceModeSelected.size > 0">
        and inva.invoice_mode in
        <foreach collection="invoiceModeSelected" index="index" item="invoiceMode" open="(" close=")" separator=",">
            #{invoiceMode,jdbcType=VARCHAR}
        </foreach>
    </if>



    <if test="sourceFromsSelected != null and sourceFromsSelected != '' and sourceFromsSelected.size > 0">
        and inva.source_from in
        <foreach collection="sourceFromsSelected" index="index" item="source_from" open="(" close=")" separator=",">
            #{source_from}
        </foreach>
    </if>

    <if test="serviceNosSelected != null and serviceNosSelected != '' and serviceNosSelected.size > 0">
        and inva.service_no in
        <foreach collection="serviceNosSelected" index="index" item="service_no" open="(" close=")" separator=",">
            #{service_no}
        </foreach>
    </if>

    <!-- 2.7.3.6 开票类型^_^开票类型(1-正常发票;2-红冲发票;10-特殊冲红) 引用 enum SzhtxxElectronicInvoiceFptxxKplxEnum -->
    <if test="kplx != null and kplx != ''">
        and szhteif.kplx = #{kplx,jdbcType=VARCHAR}
    </if>

    <!-- 2.7.3.7 是否红冲:0-否;1-是; -->
    <if test="isRedWriteOff != null">
        and szhteifei.is_red_write_off = #{isRedWriteOff,jdbcType=TINYINT}
    </if>

    <!-- 作废标志 -->
    <if test="flagVoidSign != null">
        and szhteifei.flag_void_sign = #{flagVoidSign,jdbcType=TINYINT}
    </if>



    <!-- 2.7.3.7 报送状态[新增]:0-未报送;1-已报送;-1报送失败 -->
    <if test="pushedOutStatus != null">
        and szhteifei.pushed_out_status = #{pushedOutStatus,jdbcType=TINYINT}
    </if>
    <!-- 2.7.3.7 邮件状态[新增]-20220427:0-未发送;1-已发送;send过去分词 sent  -->
    <if test="sentEmailStatus != null">
        and szhteifei.sent_email_status = #{sentEmailStatus,jdbcType=TINYINT}
    </if>



    <!-- 2.7.3.8 回款状态; -->
    <if test="backAccountStatus != null">
        and inva.back_account_status = #{backAccountStatus,jdbcType=TINYINT}
    </if>

    <if test="backAccountStatusSelected != null and backAccountStatusSelected.size > 0">
        and inva.back_account_status in
        <foreach collection="backAccountStatusSelected" index="index" item="backAccountStatus" open="(" close=")" separator=",">
            #{backAccountStatus}
        </foreach>
    </if>


    <!-- 2.7.3.9 开票日期; -->
    <if test="makeInvoiceTimeStart != null and makeInvoiceTimeStart != '' and makeInvoiceTimeEnd != null and makeInvoiceTimeEnd !=''">
        <!--
        and TO_DAYS(inva.make_invoice_time) &gt;= TO_DAYS(#{makeInvoiceTimeStart,jdbcType=VARCHAR})
        and TO_DAYS(inva.make_invoice_time) &lt;= TO_DAYS(#{makeInvoiceTimeEnd,jdbcType=VARCHAR})
        -->
        and TO_DAYS(szhteif.create_time) &gt;= TO_DAYS(#{makeInvoiceTimeStart,jdbcType=VARCHAR})
        and TO_DAYS(szhteif.create_time) &lt;= TO_DAYS(#{makeInvoiceTimeEnd,jdbcType=VARCHAR})
    </if>

    <!-- 2.7.3.9 回款日期; -->
    <if test="backAccountTimeStart != null and backAccountTimeStart != '' and backAccountTimeEnd != null and backAccountTimeEnd !=''">
        and TO_DAYS(inva.back_account_time) &gt;= TO_DAYS(#{backAccountTimeStart,jdbcType=VARCHAR})
        and TO_DAYS(inva.back_account_time) &lt;= TO_DAYS(#{backAccountTimeEnd,jdbcType=VARCHAR})
    </if>

    </sql>
</mapper>
