<?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.passengerticket.dao.PassengerTicketDao">
    <resultMap id="BaseResultMap"
               type="com.dxhy.passengerticket.vo.CertifiedInvoiceVo">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="invoice_type" property="invoiceType"
                jdbcType="VARCHAR"/>
        <result column="invoice_code" property="invoiceCode"
                jdbcType="VARCHAR"/>
        <result column="invoice_no" property="invoiceNo"
                jdbcType="VARCHAR"/>
        <result column="invoice_date" property="invoiceDate"
                jdbcType="DATE"/>
        <result column="gf_tax_no" property="gfTaxNo"
                jdbcType="VARCHAR"/>
        <result column="gf_name" property="gfName" jdbcType="VARCHAR"/>
        <result column="xf_tax_no" property="xfTaxNo"
                jdbcType="VARCHAR"/>
        <result column="xf_name" property="xfName" jdbcType="VARCHAR"/>
        <result column="invoice_amount" property="invoiceAmount"
                jdbcType="VARCHAR"/>
        <result column="tax_amount" property="taxAmount"
                jdbcType="VARCHAR"/>
        <result column="total_amount" property="totalAmount"
                jdbcType="VARCHAR"/>
        <result column="invoice_status" property="invoiceStatus"
                jdbcType="VARCHAR"/>
        <result column="dqskssq" property="dqskssq" jdbcType="VARCHAR"/>
        <result column="source_system" property="sourceSystem"
                jdbcType="VARCHAR"/>
        <result column="invoice_name" property="invoiceName"
                jdbcType="VARCHAR"/>
        <result column="qs_date" property="qsDate" jdbcType="VARCHAR"/>
        <result column="qs_type" property="qsType" jdbcType="VARCHAR"/>
        <result column="qs_name" property="qsName" jdbcType="VARCHAR"/>
        <result column="qs_status" property="qsStatus"
                jdbcType="VARCHAR"/>
        <result column="rzh_yesorno" property="rzhYesorno"
                jdbcType="VARCHAR"/>
        <result column="create_date" property="createDate"
                jdbcType="VARCHAR"/>
        <result column="uuid" property="uuid" jdbcType="VARCHAR"/>
        <result column="select_id" property="selectId"
                jdbcType="VARCHAR"/>
    </resultMap>
    <select id="selectcertifiedInvoiceList"
            parameterType="java.util.Map"
            resultType="com.dxhy.passengerticket.vo.InvoiceMainBody"
            databaseId="mysql">
        select d.* from(
        select a.* from (

        SELECT
        id,
        invoice_type,
        invoice_code,
        invoice_no,
        invoice_date,
        gf_tax_no,
        gf_name,
        xf_tax_no,
        xf_name,
        invoice_amount,
        tax_amount,
        total_amount,
        invoice_status,
        rzh_yesorno,
        rzh_belong_date dqskssq,
        source_system,
        uuid,
        create_date,
        '' as reimbursement_status,
        qs_status
        FROM
        t_dx_record_invoice
        where invoice_type in ('01','14','03')
        and rzh_yesorno in ('0','1')
        <if test="xfName!='' and xfName!=null  ">
            and xf_name like CONCAT(#{xfName},'%')
        </if>
        <if test="gfTaxNo!=null and gfTaxNo!=''">
            AND gf_tax_no =#{gfTaxNo}
        </if>
        <if test="invoiceNo!='' and invoiceNo!=null  ">
            and invoice_no = #{invoiceNo}
        </if>
        <if test=" invoiceMaxDate!=null  ">
            and invoice_date &lt;= #{invoiceMaxDate}
        </if>
        <if test="invoiceMinDate!=null ">
            and invoice_date &gt;= #{invoiceMinDate}
        </if>
        <if
                test="invoiceType!='' and invoiceType!=null and invoiceType !='99' ">
            and invoice_type = #{invoiceType,jdbcType=VARCHAR}
        </if>
        <if
                test="invoiceStatus!='' and invoiceStatus!=null and invoiceStatus !='99' ">
            and invoice_status = #{invoiceStatus}
        </if>
        <if test="qsStatus!='' and qsStatus!=null  and qsStatus !='99' ">
            and qs_status = #{qsStatus}
        </if>
        <if
                test="rzhYesorno!='' and rzhYesorno!=null  and rzhYesorno !='99' ">
            and rzh_yesorno = #{rzhYesorno}
        </if>

        UNION ALL

        SELECT
        id,
        invoice_type,
        invoice_code,
        invoice_no,
        invoice_date,
        gf_tax_no,
        gf_name,
        xf_tax_no,
        xf_name,
        invoice_amount,
        tax_amount,
        total_amount,
        invoice_status,
        dqskssq,
        '' as rzh_yesorno,
        source_system,
        uuid,
        create_date,
        reimbursement_status,
        qs_status
        FROM
        t_dx_invoice_reimburse
        where invoice_type in ('01','14','03')

        <if test="xfName!='' and xfName!=null  ">
            and xf_name like CONCAT(#{xfName},'%')
        </if>
        <if test="gfTaxNo!=null and gfTaxNo!='' ">
            AND gf_tax_no =#{gfTaxNo}
        </if>
        <if test="invoiceNo!='' and invoiceNo!=null  ">
            and invoice_no = #{invoiceNo}
        </if>
        <if test="invoiceMaxDate!=null  ">
            and invoice_date &lt;= #{invoiceMaxDate}
        </if>
        <if test=" invoiceMinDate!=null  ">
            and invoice_date &gt;= #{invoiceMinDate}
        </if>
        <if
                test="invoiceType!='' and invoiceType!=null and invoiceType !='99' ">
            and invoice_type = #{invoiceType,jdbcType=VARCHAR}
        </if>
        <if test="invoiceStatus!='' and invoiceStatus!=null and invoiceStatus !='99' ">
            and invoice_status = #{invoiceStatus}
        </if>
        <if test="qsStatus!='' and qsStatus!=null  and qsStatus !='99' ">
            and qs_status = #{qsStatus}
        </if>
        <if
                test="reimbursementStatus !='' and reimbursementStatus != null and  reimbursementStatus !='99'  ">
            and reimbursement_status = #{reimbursementStatus}
        </if>
        ) a ORDER BY
        a.create_date limit 100000
        ) d
        GROUP BY
        d.uuid having min(d.create_date)
    </select>

    <select id="selectcertifiedInvoiceList"
            parameterType="java.util.Map"
            resultType="com.dxhy.passengerticket.vo.InvoiceMainBody"
            databaseId="oracle">
        <!-- select d.* from( -->
        select a.* from (
        SELECT
        id,
        invoice_type,
        invoice_code,
        invoice_no,
        invoice_date,
        gf_tax_no,
        gf_name,
        xf_tax_no,
        xf_name,
        invoice_amount,
        tax_amount,
        total_amount,
        invoice_status,
        rzh_yesorno,
        rzh_belong_date dqskssq,
        source_system,
        uuid,
        create_date,
        cast('' as NVARCHAR2(32)) reimbursement_status,
        qs_status
        FROM
        t_dx_record_invoice
        where invoice_type in ('01','14','03')

        <if test="xfName!='' and xfName!=null  ">
            and xf_name like CONCAT(#{xfName},'%')
        </if>
        <if test="gfTaxNo!=null and gfTaxNo!=''">
            AND gf_tax_no =#{gfTaxNo}
        </if>
        <if test="invoiceNo!='' and invoiceNo!=null  ">
            and invoice_no = #{invoiceNo}
        </if>
        <if test=" invoiceMaxDate!=null  ">
            and invoice_date &lt;= to_date(#{invoiceMaxDate},'yyyy-MM-dd hh24:mi:ss')
        </if>
        <if test="invoiceMinDate!=null ">
            and invoice_date &gt;= to_date(#{invoiceMinDate},'yyyy-MM-dd hh24:mi:ss')
        </if>
        <if
                test="invoiceType!='' and invoiceType!=null and invoiceType !='99' ">
            and invoice_type = #{invoiceType,jdbcType=VARCHAR}
        </if>
        <if test="invoiceStatus!='' and invoiceStatus!=null and invoiceStatus !='99' ">
            and invoice_status = #{invoiceStatus}
        </if>
        <if test="qsStatus!='' and qsStatus!=null  and qsStatus !='99' ">
            and qs_status = #{qsStatus}
        </if>
        <if test="rzhYesorno!='' and rzhYesorno!=null  and rzhYesorno !='99' ">
            and rzh_yesorno = #{rzhYesorno}
        </if>

        UNION ALL

        SELECT
        id,
        invoice_type,
        invoice_code,
        invoice_no,
        invoice_date,
        gf_tax_no,
        gf_name,
        xf_tax_no,
        xf_name,
        invoice_amount,
        tax_amount,
        total_amount,
        invoice_status,
        dqskssq,
        cast('' as NVARCHAR2(32)) rzh_yesorno,
        source_system,
        uuid,
        create_date,
        reimbursement_status,
        qs_status
        FROM
        t_dx_invoice_reimburse
        where invoice_type in ('01','14','03')
        <if test="xfName!='' and xfName!=null  ">
            and xf_name like CONCAT(#{xfName},'%')
        </if>
        <if test="gfTaxNo!=null and gfTaxNo!='' ">
            AND gf_tax_no =#{gfTaxNo}
        </if>
        <if test="invoiceNo!='' and invoiceNo!=null  ">
            and invoice_no = #{invoiceNo}
        </if>
        <if test="invoiceMaxDate!=null  ">
            and invoice_date &lt;= to_date(#{invoiceMaxDate},'yyyy-MM-dd hh24:mi:ss')
        </if>
        <if test=" invoiceMinDate!=null  ">
            and invoice_date &gt;= to_date(#{invoiceMinDate},'yyyy-MM-dd hh24:mi:ss')
        </if>
        <if test="invoiceType!='' and invoiceType!=null and invoiceType !='99' ">
            and invoice_type = #{invoiceType,jdbcType=VARCHAR}
        </if>
        <if
                test="invoiceStatus!='' and invoiceStatus!=null and invoiceStatus !='99' ">
            and invoice_status = #{invoiceStatus}
        </if>
        <if test="qsStatus!='' and qsStatus!=null  and qsStatus !='99' ">
            and qs_status = #{qsStatus}
        </if>

        <if
                test="reimbursementStatus !='' and reimbursementStatus != null and  reimbursementStatus !='99'  ">
            and reimbursement_status = #{reimbursementStatus}
        </if>
        ) a
        ORDER BY a.create_date

        <!--  limit 100000
        )  d
        GROUP BY
        d.uuid having min(d.create_date) -->
    </select>
    <select id="selectOtherInvoiceList"
            parameterType="java.util.Map"
            resultType="com.dxhy.passengerticket.vo.InvoiceMainBody"
            databaseId="mysql">
        select d.* from(
        select a.* from (

        SELECT
        id,
        invoice_type,
        invoice_code,
        invoice_no,
        invoice_date,
        gf_tax_no,
        gf_name,
        xf_tax_no,
        xf_name,
        invoice_amount,
        tax_amount,
        total_amount,
        invoice_status,
        rzh_yesorno,
        rzh_belong_date dqskssq,
        source_system,
        uuid,
        create_date,
        '' as reimbursement_status,
        qs_status,
        '' as is_deduction,
        '' as select_id
        FROM
        t_dx_record_invoice

        where invoice_type in
        ('04','10','11','02','91','93','94','95','96','00','97','98')
        <if test="xfName!='' and xfName!=null  ">
            and xf_name like CONCAT(#{xfName},'%')
        </if>
        and gf_tax_no =#{gfTaxNo}
        <if test="invoiceNo!='' and invoiceNo!=null  ">
            and invoice_no = #{invoiceNo}
        </if>
        <if test=" invoiceMaxDate!=null  ">
            and invoice_date &lt;= #{invoiceMaxDate}
        </if>
        <if test=" invoiceMinDate!=null  ">
            and invoice_date &gt;= #{invoiceMinDate}
        </if>
        <if
                test="invoiceType!='' and invoiceType!=null and invoiceType !='99' ">
            and invoice_type = #{invoiceType,jdbcType=VARCHAR}
        </if>
        <if
                test="invoiceStatus!='' and invoiceStatus!=null and invoiceStatus !='99' ">
            and invoice_status = #{invoiceStatus}
        </if>
        <if test="qsStatus!='' and qsStatus!=null  and qsStatus !='99' ">
            and qs_status = #{qsStatus}
        </if>
        <if
                test="rzhYesorno!='' and rzhYesorno!=null  and rzhYesorno !='99' ">
            and rzh_yesorno = #{rzhYesorno}
        </if>

        UNION ALL

        SELECT
        id,
        invoice_type,
        invoice_code,
        invoice_no,
        invoice_date,
        gf_tax_no,
        gf_name,
        xf_tax_no,
        xf_name,
        invoice_amount,
        tax_amount,
        total_amount,
        invoice_status,
        dqskssq,
        '' as rzh_yesorno,
        source_system,
        uuid,
        create_date,
        reimbursement_status,
        '' as qs_status,
        is_deduction,
        select_id
        FROM
        t_dx_invoice_reimburse

        where ( ( invoice_type in
        ('04','11','02','91','93','94','95','96','00','97','98') )
        or (invoice_type IN ('92','90','89','88','87','10')
        and is_deduction = '1'))
        <if test="xfName!='' and xfName!=null  ">
            and xf_name like CONCAT(#{xfName},'%')
        </if>
        and gf_tax_no = #{gfTaxNo}
        <if test="invoiceNo!='' and invoiceNo!=null  ">
            and invoice_no = #{invoiceNo}
        </if>
        <if test=" invoiceMaxDate!=null  ">
            and invoice_date &lt;= #{invoiceMaxDate}
        </if>
        <if test=" invoiceMinDate!=null  ">
            and invoice_date &gt;= #{invoiceMinDate}
        </if>
        <if test="invoiceType!='' and invoiceType!=null and invoiceType !='99' ">
            and invoice_type = #{invoiceType}
        </if>
        <if
                test="invoiceStatus!='' and invoiceStatus!=null and invoiceStatus !='99' ">
            and invoice_status = #{invoiceStatus}
        </if>
        <if test="qsStatus!='' and qsStatus!=null  and qsStatus !='99' ">
            and qs_status = #{qsStatus}
        </if>

        <if
                test="reimbursementStatus !='' and reimbursementStatus != null  and reimbursementStatus !='99'  ">
            and reimbursement_status = #{reimbursementStatus}
        </if>
        ) a ORDER BY
        a.create_date limit 100000
        ) d
        GROUP BY
        d.uuid having min(d.create_date)

    </select>

    <select id="selectOtherInvoiceList"
            parameterType="java.util.Map"
            resultType="com.dxhy.passengerticket.vo.InvoiceMainBody"
            databaseId="oracle">
        <!--select d.* from( -->
        select a.* from (

        SELECT
        id,
        invoice_type,
        invoice_code,
        invoice_no,
        invoice_date,
        gf_tax_no,
        gf_name,
        xf_tax_no,
        xf_name,
        invoice_amount,
        tax_amount,
        total_amount,
        invoice_status,
        rzh_yesorno,
        rzh_belong_date dqskssq,
        source_system,
        uuid,
        create_date,
        cast('' as NVARCHAR2(32)) reimbursement_status,
        qs_status,
        cast('' as NVARCHAR2(32)) is_deduction,
        cast('' as NVARCHAR2(32)) select_id
        FROM
        t_dx_record_invoice

        where invoice_type in
        ('04','10','11','02','91','93','94','95','96','00','97','98')
        <if test="xfName!='' and xfName!=null  ">
            and xf_name like CONCAT(#{xfName},'%')
        </if>
        and gf_tax_no =#{gfTaxNo}
        <if test="invoiceNo!='' and invoiceNo!=null  ">
            and invoice_no = #{invoiceNo}
        </if>
        <if test=" invoiceMinDate!=null  ">
            and invoice_date &gt;= to_date(#{invoiceMinDate},'yyyy-MM-dd hh24:mi:ss')
        </if>
        <if test=" invoiceMaxDate!=null  ">
            and invoice_date &lt;= to_date(#{invoiceMaxDate},'yyyy-MM-dd hh24:mi:ss')
        </if>

        <if
                test="invoiceType!='' and invoiceType!=null and invoiceType !='99' ">
            and invoice_type = #{invoiceType}
        </if>
        <if
                test="invoiceStatus!='' and invoiceStatus!=null and invoiceStatus !='99' ">
            and invoice_status = #{invoiceStatus}
        </if>
        <if test="qsStatus!='' and qsStatus!=null  and qsStatus !='99' ">
            and qs_status = #{qsStatus}
        </if>
        <if
                test="rzhYesorno!='' and rzhYesorno!=null  and rzhYesorno !='99' ">
            and rzh_yesorno = #{rzhYesorno}
        </if>

        UNION ALL

        SELECT
        id,
        invoice_type,
        invoice_code,
        invoice_no,
        invoice_date,
        gf_tax_no,
        gf_name,
        xf_tax_no,
        xf_name,
        invoice_amount,
        tax_amount,
        total_amount,
        invoice_status,
        dqskssq,
        cast('' as NVARCHAR2(32)) rzh_yesorno,
        source_system,
        uuid,
        create_date,
        reimbursement_status,
        cast('' as NVARCHAR2(32)) qs_status,
        is_deduction,
        select_id
        FROM
        t_dx_invoice_reimburse

        where ( ( invoice_type in
        ('04','11','02','91','93','94','95','96','00','97','98') )
        or (invoice_type IN ('92','90','89','88','87','10')
        and is_deduction = '1'))
        <if test="xfName!='' and xfName!=null  ">
            and xf_name like CONCAT(#{xfName},'%')
        </if>
        and gf_tax_no = #{gfTaxNo}
        <if test="invoiceNo!='' and invoiceNo!=null  ">
            and invoice_no = #{invoiceNo}
        </if>
        <if test=" invoiceMinDate!=null  ">
            and invoice_date &gt;= to_date(#{invoiceMinDate},'yyyy-MM-dd hh24:mi:ss')
        </if>
        <if test=" invoiceMaxDate!=null  ">
            and invoice_date &lt;= to_date(#{invoiceMaxDate},'yyyy-MM-dd hh24:mi:ss')
        </if>

        <if
                test="invoiceType!='' and invoiceType!=null and invoiceType !='99' ">
            and invoice_type = #{invoiceType}
        </if>
        <if
                test="invoiceStatus!='' and invoiceStatus!=null and invoiceStatus !='99' ">
            and invoice_status = #{invoiceStatus}
        </if>
        <if test="qsStatus!='' and qsStatus!=null  and qsStatus !='99' ">
            and qs_status = #{qsStatus}
        </if>

        <if
                test="reimbursementStatus !='' and reimbursementStatus != null  and reimbursementStatus !='99'  ">
            and reimbursement_status = #{reimbursementStatus}
        </if>
        ) a ORDER BY a.create_date
        <!-- limit 100000
        ) AS d
        GROUP BY
        d.uuid having min(d.create_date) -->

    </select>
    <select id="selectInvoiceMainBody"
            resultType="com.dxhy.passengerticket.vo.InvoiceMainBody"
            databaseId="mysql">
        select d.*
        from (
                 SELECT a.*
                 FROM (
                          SELECT invoice_code,
                                 invoice_no,
                                 invoice_date,
                                 invoice_type,
                                 invoice_amount,
                                 tax_amount,
                                 total_amount,
                                 gf_name,
                                 gf_address_and_phone,
                                 gf_bank_and_no,
                                 gf_tax_no,
                                 xf_tax_no,
                                 xf_name,
                                 xf_address_and_phone,
                                 xf_bank_and_no,
                                 invoice_status,
                                 create_date,
                                 source_system,
                                 qs_date,
                                 qs_name,
                                 qs_type,
                                 rzh_date,
                                 gx_type         rzh_type,
                                 confirm_user as gx_user_name,
                                 rzh_belong_date dqskssq,
                                 ''           AS related_business_documents,
                                 ''           AS business_document_maker,
                                 ''           AS business_document_number,
                                 ''           AS reimbursement_time,
                                 ''           AS reimbursement_status,
                                 ''           AS ticket_number,
                                 ''           AS passenger,
                                 ''           AS is_deduction,
                                 uuid,
                                 ''           AS departure_city,
                                 ''           AS reaching_city,
                                 ''           AS tax_rate,
                                 remark
                          FROM t_dx_record_invoice
                          WHERE invoice_code = #{invoiceCode}
                            and invoice_no = #{invoiceNo}
                          UNION ALL
                          SELECT invoice_code,
                                 invoice_no,
                                 invoice_date,
                                 invoice_type,
                                 invoice_amount,
                                 tax_amount,
                                 total_amount,
                                 gf_name,
                                 gf_address_and_phone,
                                 gf_bank_and_no,
                                 gf_tax_no,
                                 xf_tax_no,
                                 xf_name,
                                 xf_address_and_phone,
                                 xf_bank_and_no,
                                 invoice_status,
                                 create_date,
                                 source_system,
                                 qs_date,
                                 qs_name,
                                 qs_type,
                                 '' AS rzh_date,
                                 '' AS rzh_type,
                                 '' AS gx_user_name,
                                 '' AS dqskssq,
                                 related_business_documents,
                                 business_document_maker,
                                 business_document_number,
                                 reimbursement_time,
                                 reimbursement_status,
                                 ticket_number,
                                 passenger,
                                 is_deduction,
                                 uuid,
                                 departure_city,
                                 reaching_city,
                                 tax_rate,
                                 '' as remark
                          FROM t_dx_invoice_reimburse
                          where invoice_code = #{invoiceCode}
                            and invoice_no = #{invoiceNo}
                      ) AS a
                 ORDER BY a.create_date
                 limit 10
             ) AS d
        GROUP BY d.uuid
        having min(d.create_date)
    </select>

    <select id="selectInvoiceMainBody"
            resultType="com.dxhy.passengerticket.vo.InvoiceMainBody"
            databaseId="oracle">
        <!-- select d.* from( -->
        SELECT
        a.*
        FROM
        (
        SELECT
        invoice_code,
        invoice_no,
        invoice_date,
        invoice_type,
        invoice_amount,
        tax_amount,
        total_amount,
        gf_name,
        gf_address_and_phone,
        gf_bank_and_no,
        gf_tax_no,
        xf_tax_no,
        xf_name,
        xf_address_and_phone,
        xf_bank_and_no,
        invoice_status,
        create_date,
        source_system,
        qs_date,
        qs_name,
        qs_type,
        cast(to_char(rzh_date,'yyyy-MM-dd') as NVARCHAR2(32)) rzh_date,
        rzh_type,
        confirm_user as gx_user_name,
        rzh_belong_date dqskssq,
        cast('' as NVARCHAR2(32)) related_business_documents,
        cast('' as NVARCHAR2(32)) business_document_maker,
        cast('' as NVARCHAR2(32)) business_document_number,
        cast('' as NVARCHAR2(32)) reimbursement_time,
        cast('' as NVARCHAR2(32)) reimbursement_status,
        cast('' as NVARCHAR2(32)) ticket_number,
        cast('' as NVARCHAR2(32)) passenger,
        cast('' as NVARCHAR2(32)) is_deduction,
        uuid,
        cast('' as NVARCHAR2(32)) departure_city,
        cast('' as NVARCHAR2(32)) reaching_city,
        cast('' as NVARCHAR2(32)) tax_rate,
        cast(remark as NVARCHAR2(4000)) remark
        FROM
        t_dx_record_invoice
        WHERE invoice_code = #{invoiceCode} and invoice_no = #{invoiceNo}
        UNION ALL
        SELECT
        invoice_code,
        invoice_no,
        invoice_date,
        invoice_type,
        invoice_amount,
        tax_amount,
        total_amount,
        gf_name,
        gf_address_and_phone,
        gf_bank_and_no,
        gf_tax_no,
        xf_tax_no,
        xf_name,
        xf_address_and_phone,
        xf_bank_and_no,
        invoice_status,
        create_date,
        source_system,
        qs_date,
        qs_name,
        qs_type,
        cast('' as NVARCHAR2(32)) rzh_date,
        cast('' as NVARCHAR2(32)) rzh_type,
        cast('' as NVARCHAR2(32)) gx_user_name,
        cast('' as NVARCHAR2(32)) dqskssq,
        cast(related_business_documents as NVARCHAR2(32)) related_business_documents,
        cast(business_document_maker as NVARCHAR2(32)) business_document_maker,
        cast(business_document_number as NVARCHAR2(32)) business_document_number,
        cast(reimbursement_time as NVARCHAR2(32)) reimbursement_time,
        cast(reimbursement_status as NVARCHAR2(32)) reimbursement_status,
        cast(ticket_number as NVARCHAR2(32)) ticket_number,
        cast(passenger as NVARCHAR2(32)) passenger,
        cast(is_deduction as NVARCHAR2(32)) is_deduction,
        uuid,
        departure_city,
        reaching_city,
        tax_rate,
        cast('' as NVARCHAR2(4000)) remark
        FROM
        t_dx_invoice_reimburse
        where invoice_code = #{invoiceCode} and invoice_no = #{invoiceNo}
        ) a where rownum &lt;= 10
        ORDER BY a.create_date
        <!-- limit 10
        ) AS d
        GROUP BY
        d.uuid having min(d.create_date) -->
    </select>
    <select id="selectPassengerTheme"
            resultType="com.dxhy.passengerticket.vo.InvoiceMainBody">
        SELECT invoice_code,
               invoice_no,
               invoice_date,
               invoice_type,
               gf_name,
               gf_address_and_phone,
               gf_bank_and_no,
               gf_tax_no,
               xf_tax_no,
               xf_name,
               xf_address_and_phone,
               xf_bank_and_no,
               invoice_status,
               create_date,
               '' AS rzlx,
               source_system,
               qs_date,
               qs_name,
               qs_type,
               '' AS rzh_date,
               '' AS rzh_type,
               '' AS gx_user_name,
               '' AS dqskssq,
               related_business_documents,
               business_document_maker,
               business_document_number,
               reimbursement_time,
               reimbursement_status,
               ticket_number,
               passenger,
               is_deduction,
               uuid,
               departure_city,
               reaching_city,
               invoice_amount,
               tax_amount,
               total_amount,
               tax_rate
        FROM t_dx_invoice_reimburse
        where select_id = #{selectId}

    </select>
</mapper>
