<?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.qchjc.invoice.QchjcInvoiceApplyEntityMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntity">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="accounting_order_type" jdbcType="TINYINT" property="accountingOrderType" />
    <result column="accounting_order_id" jdbcType="BIGINT" property="accountingOrderId" />
    <result column="accounting_order_sn" jdbcType="VARCHAR" property="accountingOrderSn" />
    <result column="dim_create_by" jdbcType="TINYINT" property="dimCreateBy" />
    <result column="invoice_sn" jdbcType="VARCHAR" property="invoiceSn" />
    <result column="invoice_apply_sn" jdbcType="VARCHAR" property="invoiceApplySn" />
    <result column="invoice_apply_amount" jdbcType="DECIMAL" property="invoiceApplyAmount" />
    <result column="free_amount" jdbcType="DECIMAL" property="freeAmount" />
    <result column="un_accounting_amount" jdbcType="DECIMAL" property="unAccountingAmount" />
    <result column="jc_un_accounting_amount" jdbcType="DECIMAL" property="jcUnAccountingAmount" />
    <result column="real_amount" jdbcType="DECIMAL" property="realAmount" />
    <result column="no_check_count" jdbcType="DECIMAL" property="noCheckCount" />
    <result column="tax_rate" jdbcType="VARCHAR" property="taxRate" />
    <result column="sys_enterprise_ext_invoice_id" jdbcType="BIGINT" property="sysEnterpriseExtInvoiceId" />
    <result column="invoice_type" jdbcType="BIGINT" property="invoiceType" />
    <result column="invoice_mode" jdbcType="VARCHAR" property="invoiceMode" />
    <result column="invoice_state" jdbcType="INTEGER" property="invoiceState" />
    <result column="company_name" jdbcType="VARCHAR" property="companyName" />
    <result column="invoice_send_email" jdbcType="VARCHAR" property="invoiceSendEmail" />
    <result column="tax_payers_i_d_code" jdbcType="VARCHAR" property="taxPayersIDCode" />
    <result column="invoice_content" jdbcType="INTEGER" property="invoiceContent" />
    <result column="selected_invoice_title" jdbcType="INTEGER" property="selectedInvoiceTitle" />
    <result column="invoice_name" jdbcType="VARCHAR" property="invoiceName" />
    <result column="invoice_phone" jdbcType="VARCHAR" property="invoicePhone" />
    <result column="invoice_email" jdbcType="VARCHAR" property="invoiceEmail" />
    <result column="contacts_name" jdbcType="VARCHAR" property="contactsName" />
    <result column="contacts_email" jdbcType="VARCHAR" property="contactsEmail" />
    <result column="contacts_phone" jdbcType="VARCHAR" property="contactsPhone" />
    <result column="invoice_provice" jdbcType="INTEGER" property="invoiceProvice" />
    <result column="invoice_city" jdbcType="INTEGER" property="invoiceCity" />
    <result column="invoice_county" jdbcType="INTEGER" property="invoiceCounty" />
    <result column="invoice_address" jdbcType="VARCHAR" property="invoiceAddress" />
    <result column="invoice_address_phone" jdbcType="VARCHAR" property="invoiceAddressPhone" />
    <result column="invoice_bank_account_number" jdbcType="VARCHAR" property="invoiceBankAccountNumber" />
    <result column="invoice_bank" jdbcType="VARCHAR" property="invoiceBank" />
    <result column="invoice_account" jdbcType="VARCHAR" property="invoiceAccount" />
    <result column="apply_user_id" jdbcType="VARCHAR" property="applyUserId" />
    <result column="apply_user_name" jdbcType="VARCHAR" property="applyUserName" />
    <result column="apply_time" jdbcType="TIMESTAMP" property="applyTime" />
    <result column="audit_user_id" jdbcType="BIGINT" property="auditUserId" />
    <result column="audit_status" jdbcType="TINYINT" property="auditStatus" />
    <result column="audit_time" jdbcType="TIMESTAMP" property="auditTime" />
    <result column="invoice_status" jdbcType="TINYINT" property="invoiceStatus" />
    <result column="invoice_progressing_user_id" jdbcType="BIGINT" property="invoiceProgressingUserId" />
    <result column="invoice_progressing_time" jdbcType="TIMESTAMP" property="invoiceProgressingTime" />
    <result column="make_invoice_user_id" jdbcType="VARCHAR" property="makeInvoiceUserId" />
    <result column="make_invoice_status" jdbcType="TINYINT" property="makeInvoiceStatus" />
    <result column="make_invoice_time" jdbcType="TIMESTAMP" property="makeInvoiceTime" />
    <result column="receive_invoice_status" jdbcType="TINYINT" property="receiveInvoiceStatus" />
    <result column="receive_invoice_user_id" jdbcType="BIGINT" property="receiveInvoiceUserId" />
    <result column="receive_invoice_time" jdbcType="TIMESTAMP" property="receiveInvoiceTime" />
    <result column="invoice_number" jdbcType="VARCHAR" property="invoiceNumber" />
    <result column="mail_tick_user_id" jdbcType="VARCHAR" property="mailTickUserId" />
    <result column="mail_tick_status" jdbcType="TINYINT" property="mailTickStatus" />
    <result column="mail_tick_time" jdbcType="TIMESTAMP" property="mailTickTime" />
    <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="remark" jdbcType="VARCHAR" property="remark" />
    <result column="remark2" jdbcType="VARCHAR" property="remark2" />
    <result column="service_id" jdbcType="INTEGER" property="serviceId" />
    <result column="service_no" jdbcType="VARCHAR" property="serviceNo" />
    <result column="service_name" jdbcType="VARCHAR" property="serviceName" />
    <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="VARCHAR" property="outVirtId" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="update_user_id" jdbcType="VARCHAR" property="updateUserId" />
    <result column="sync_time" jdbcType="TIMESTAMP" property="syncTime" />
    <result column="storage_status" jdbcType="TINYINT" property="storageStatus" />
    <result column="storage_time" jdbcType="TIMESTAMP" property="storageTime" />
    <result column="jc_order_count" jdbcType="INTEGER" property="jcOrderCount" />
    <result column="unified_order_count" jdbcType="INTEGER" property="unifiedOrderCount" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntity">
    <result column="sys_enterprise_ext_invoice_snapshot" jdbcType="LONGVARCHAR" property="sysEnterpriseExtInvoiceSnapshot" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, accounting_order_type, accounting_order_id, accounting_order_sn, dim_create_by, 
    invoice_sn, invoice_apply_sn, invoice_apply_amount, free_amount, un_accounting_amount, 
    jc_un_accounting_amount, real_amount, no_check_count, tax_rate, sys_enterprise_ext_invoice_id, 
    invoice_type, invoice_mode, invoice_state, company_name, invoice_send_email, tax_payers_i_d_code, 
    invoice_content, selected_invoice_title, invoice_name, invoice_phone, invoice_email, 
    contacts_name, contacts_email, contacts_phone, invoice_provice, invoice_city, invoice_county, 
    invoice_address, invoice_address_phone, invoice_bank_account_number, invoice_bank, 
    invoice_account, apply_user_id, apply_user_name, apply_time, audit_user_id, audit_status, 
    audit_time, invoice_status, invoice_progressing_user_id, invoice_progressing_time, 
    make_invoice_user_id, make_invoice_status, make_invoice_time, receive_invoice_status, 
    receive_invoice_user_id, receive_invoice_time, invoice_number, mail_tick_user_id, 
    mail_tick_status, mail_tick_time, back_account_status, back_account_mode_record, 
    back_account_user_id, back_account_time, remark, remark2, service_id, service_no, 
    service_name, sys_org_id, sys_virt_id, out_org_id, out_virt_id, update_time, update_user_id, 
    sync_time, storage_status, storage_time, jc_order_count, unified_order_count
  </sql>
  <sql id="Blob_Column_List">
    sys_enterprise_ext_invoice_snapshot
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntityExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from qchjc_invoice_apply
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntityExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from qchjc_invoice_apply
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from qchjc_invoice_apply
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from qchjc_invoice_apply
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntityExample">
    delete from qchjc_invoice_apply
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntity">
    insert into qchjc_invoice_apply (id, accounting_order_type, accounting_order_id, 
      accounting_order_sn, dim_create_by, invoice_sn, 
      invoice_apply_sn, invoice_apply_amount, free_amount, 
      un_accounting_amount, jc_un_accounting_amount, 
      real_amount, no_check_count, tax_rate, 
      sys_enterprise_ext_invoice_id, invoice_type, invoice_mode, 
      invoice_state, company_name, invoice_send_email, 
      tax_payers_i_d_code, invoice_content, selected_invoice_title, 
      invoice_name, invoice_phone, invoice_email, 
      contacts_name, contacts_email, contacts_phone, 
      invoice_provice, invoice_city, invoice_county, 
      invoice_address, invoice_address_phone, invoice_bank_account_number, 
      invoice_bank, invoice_account, apply_user_id, 
      apply_user_name, apply_time, audit_user_id, 
      audit_status, audit_time, invoice_status, 
      invoice_progressing_user_id, invoice_progressing_time, 
      make_invoice_user_id, make_invoice_status, make_invoice_time, 
      receive_invoice_status, receive_invoice_user_id, 
      receive_invoice_time, invoice_number, mail_tick_user_id, 
      mail_tick_status, mail_tick_time, back_account_status, 
      back_account_mode_record, back_account_user_id, 
      back_account_time, remark, remark2, 
      service_id, service_no, service_name, 
      sys_org_id, sys_virt_id, out_org_id, 
      out_virt_id, update_time, update_user_id, 
      sync_time, storage_status, storage_time, 
      jc_order_count, unified_order_count, sys_enterprise_ext_invoice_snapshot
      )
    values (#{id,jdbcType=BIGINT}, #{accountingOrderType,jdbcType=TINYINT}, #{accountingOrderId,jdbcType=BIGINT}, 
      #{accountingOrderSn,jdbcType=VARCHAR}, #{dimCreateBy,jdbcType=TINYINT}, #{invoiceSn,jdbcType=VARCHAR}, 
      #{invoiceApplySn,jdbcType=VARCHAR}, #{invoiceApplyAmount,jdbcType=DECIMAL}, #{freeAmount,jdbcType=DECIMAL}, 
      #{unAccountingAmount,jdbcType=DECIMAL}, #{jcUnAccountingAmount,jdbcType=DECIMAL}, 
      #{realAmount,jdbcType=DECIMAL}, #{noCheckCount,jdbcType=DECIMAL}, #{taxRate,jdbcType=VARCHAR}, 
      #{sysEnterpriseExtInvoiceId,jdbcType=BIGINT}, #{invoiceType,jdbcType=BIGINT}, #{invoiceMode,jdbcType=VARCHAR}, 
      #{invoiceState,jdbcType=INTEGER}, #{companyName,jdbcType=VARCHAR}, #{invoiceSendEmail,jdbcType=VARCHAR}, 
      #{taxPayersIDCode,jdbcType=VARCHAR}, #{invoiceContent,jdbcType=INTEGER}, #{selectedInvoiceTitle,jdbcType=INTEGER}, 
      #{invoiceName,jdbcType=VARCHAR}, #{invoicePhone,jdbcType=VARCHAR}, #{invoiceEmail,jdbcType=VARCHAR}, 
      #{contactsName,jdbcType=VARCHAR}, #{contactsEmail,jdbcType=VARCHAR}, #{contactsPhone,jdbcType=VARCHAR}, 
      #{invoiceProvice,jdbcType=INTEGER}, #{invoiceCity,jdbcType=INTEGER}, #{invoiceCounty,jdbcType=INTEGER}, 
      #{invoiceAddress,jdbcType=VARCHAR}, #{invoiceAddressPhone,jdbcType=VARCHAR}, #{invoiceBankAccountNumber,jdbcType=VARCHAR}, 
      #{invoiceBank,jdbcType=VARCHAR}, #{invoiceAccount,jdbcType=VARCHAR}, #{applyUserId,jdbcType=VARCHAR}, 
      #{applyUserName,jdbcType=VARCHAR}, #{applyTime,jdbcType=TIMESTAMP}, #{auditUserId,jdbcType=BIGINT}, 
      #{auditStatus,jdbcType=TINYINT}, #{auditTime,jdbcType=TIMESTAMP}, #{invoiceStatus,jdbcType=TINYINT}, 
      #{invoiceProgressingUserId,jdbcType=BIGINT}, #{invoiceProgressingTime,jdbcType=TIMESTAMP}, 
      #{makeInvoiceUserId,jdbcType=VARCHAR}, #{makeInvoiceStatus,jdbcType=TINYINT}, #{makeInvoiceTime,jdbcType=TIMESTAMP}, 
      #{receiveInvoiceStatus,jdbcType=TINYINT}, #{receiveInvoiceUserId,jdbcType=BIGINT}, 
      #{receiveInvoiceTime,jdbcType=TIMESTAMP}, #{invoiceNumber,jdbcType=VARCHAR}, #{mailTickUserId,jdbcType=VARCHAR}, 
      #{mailTickStatus,jdbcType=TINYINT}, #{mailTickTime,jdbcType=TIMESTAMP}, #{backAccountStatus,jdbcType=TINYINT}, 
      #{backAccountModeRecord,jdbcType=TINYINT}, #{backAccountUserId,jdbcType=BIGINT}, 
      #{backAccountTime,jdbcType=TIMESTAMP}, #{remark,jdbcType=VARCHAR}, #{remark2,jdbcType=VARCHAR}, 
      #{serviceId,jdbcType=INTEGER}, #{serviceNo,jdbcType=VARCHAR}, #{serviceName,jdbcType=VARCHAR}, 
      #{sysOrgId,jdbcType=BIGINT}, #{sysVirtId,jdbcType=BIGINT}, #{outOrgId,jdbcType=BIGINT}, 
      #{outVirtId,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=VARCHAR}, 
      #{syncTime,jdbcType=TIMESTAMP}, #{storageStatus,jdbcType=TINYINT}, #{storageTime,jdbcType=TIMESTAMP}, 
      #{jcOrderCount,jdbcType=INTEGER}, #{unifiedOrderCount,jdbcType=INTEGER}, #{sysEnterpriseExtInvoiceSnapshot,jdbcType=LONGVARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntity">
    <selectKey resultType="java.lang.Long" keyProperty="id" order="AFTER">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into qchjc_invoice_apply
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="accountingOrderType != null">
        accounting_order_type,
      </if>
      <if test="accountingOrderId != null">
        accounting_order_id,
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn,
      </if>
      <if test="dimCreateBy != null">
        dim_create_by,
      </if>
      <if test="invoiceSn != null">
        invoice_sn,
      </if>
      <if test="invoiceApplySn != null">
        invoice_apply_sn,
      </if>
      <if test="invoiceApplyAmount != null">
        invoice_apply_amount,
      </if>
      <if test="freeAmount != null">
        free_amount,
      </if>
      <if test="unAccountingAmount != null">
        un_accounting_amount,
      </if>
      <if test="jcUnAccountingAmount != null">
        jc_un_accounting_amount,
      </if>
      <if test="realAmount != null">
        real_amount,
      </if>
      <if test="noCheckCount != null">
        no_check_count,
      </if>
      <if test="taxRate != null">
        tax_rate,
      </if>
      <if test="sysEnterpriseExtInvoiceId != null">
        sys_enterprise_ext_invoice_id,
      </if>
      <if test="invoiceType != null">
        invoice_type,
      </if>
      <if test="invoiceMode != null">
        invoice_mode,
      </if>
      <if test="invoiceState != null">
        invoice_state,
      </if>
      <if test="companyName != null">
        company_name,
      </if>
      <if test="invoiceSendEmail != null">
        invoice_send_email,
      </if>
      <if test="taxPayersIDCode != null">
        tax_payers_i_d_code,
      </if>
      <if test="invoiceContent != null">
        invoice_content,
      </if>
      <if test="selectedInvoiceTitle != null">
        selected_invoice_title,
      </if>
      <if test="invoiceName != null">
        invoice_name,
      </if>
      <if test="invoicePhone != null">
        invoice_phone,
      </if>
      <if test="invoiceEmail != null">
        invoice_email,
      </if>
      <if test="contactsName != null">
        contacts_name,
      </if>
      <if test="contactsEmail != null">
        contacts_email,
      </if>
      <if test="contactsPhone != null">
        contacts_phone,
      </if>
      <if test="invoiceProvice != null">
        invoice_provice,
      </if>
      <if test="invoiceCity != null">
        invoice_city,
      </if>
      <if test="invoiceCounty != null">
        invoice_county,
      </if>
      <if test="invoiceAddress != null">
        invoice_address,
      </if>
      <if test="invoiceAddressPhone != null">
        invoice_address_phone,
      </if>
      <if test="invoiceBankAccountNumber != null">
        invoice_bank_account_number,
      </if>
      <if test="invoiceBank != null">
        invoice_bank,
      </if>
      <if test="invoiceAccount != null">
        invoice_account,
      </if>
      <if test="applyUserId != null">
        apply_user_id,
      </if>
      <if test="applyUserName != null">
        apply_user_name,
      </if>
      <if test="applyTime != null">
        apply_time,
      </if>
      <if test="auditUserId != null">
        audit_user_id,
      </if>
      <if test="auditStatus != null">
        audit_status,
      </if>
      <if test="auditTime != null">
        audit_time,
      </if>
      <if test="invoiceStatus != null">
        invoice_status,
      </if>
      <if test="invoiceProgressingUserId != null">
        invoice_progressing_user_id,
      </if>
      <if test="invoiceProgressingTime != null">
        invoice_progressing_time,
      </if>
      <if test="makeInvoiceUserId != null">
        make_invoice_user_id,
      </if>
      <if test="makeInvoiceStatus != null">
        make_invoice_status,
      </if>
      <if test="makeInvoiceTime != null">
        make_invoice_time,
      </if>
      <if test="receiveInvoiceStatus != null">
        receive_invoice_status,
      </if>
      <if test="receiveInvoiceUserId != null">
        receive_invoice_user_id,
      </if>
      <if test="receiveInvoiceTime != null">
        receive_invoice_time,
      </if>
      <if test="invoiceNumber != null">
        invoice_number,
      </if>
      <if test="mailTickUserId != null">
        mail_tick_user_id,
      </if>
      <if test="mailTickStatus != null">
        mail_tick_status,
      </if>
      <if test="mailTickTime != null">
        mail_tick_time,
      </if>
      <if test="backAccountStatus != null">
        back_account_status,
      </if>
      <if test="backAccountModeRecord != null">
        back_account_mode_record,
      </if>
      <if test="backAccountUserId != null">
        back_account_user_id,
      </if>
      <if test="backAccountTime != null">
        back_account_time,
      </if>
      <if test="remark != null">
        remark,
      </if>
      <if test="remark2 != null">
        remark2,
      </if>
      <if test="serviceId != null">
        service_id,
      </if>
      <if test="serviceNo != null">
        service_no,
      </if>
      <if test="serviceName != null">
        service_name,
      </if>
      <if test="sysOrgId != null">
        sys_org_id,
      </if>
      <if test="sysVirtId != null">
        sys_virt_id,
      </if>
      <if test="outOrgId != null">
        out_org_id,
      </if>
      <if test="outVirtId != null">
        out_virt_id,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="updateUserId != null">
        update_user_id,
      </if>
      <if test="syncTime != null">
        sync_time,
      </if>
      <if test="storageStatus != null">
        storage_status,
      </if>
      <if test="storageTime != null">
        storage_time,
      </if>
      <if test="jcOrderCount != null">
        jc_order_count,
      </if>
      <if test="unifiedOrderCount != null">
        unified_order_count,
      </if>
      <if test="sysEnterpriseExtInvoiceSnapshot != null">
        sys_enterprise_ext_invoice_snapshot,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderType != null">
        #{accountingOrderType,jdbcType=TINYINT},
      </if>
      <if test="accountingOrderId != null">
        #{accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderSn != null">
        #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="dimCreateBy != null">
        #{dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="invoiceSn != null">
        #{invoiceSn,jdbcType=VARCHAR},
      </if>
      <if test="invoiceApplySn != null">
        #{invoiceApplySn,jdbcType=VARCHAR},
      </if>
      <if test="invoiceApplyAmount != null">
        #{invoiceApplyAmount,jdbcType=DECIMAL},
      </if>
      <if test="freeAmount != null">
        #{freeAmount,jdbcType=DECIMAL},
      </if>
      <if test="unAccountingAmount != null">
        #{unAccountingAmount,jdbcType=DECIMAL},
      </if>
      <if test="jcUnAccountingAmount != null">
        #{jcUnAccountingAmount,jdbcType=DECIMAL},
      </if>
      <if test="realAmount != null">
        #{realAmount,jdbcType=DECIMAL},
      </if>
      <if test="noCheckCount != null">
        #{noCheckCount,jdbcType=DECIMAL},
      </if>
      <if test="taxRate != null">
        #{taxRate,jdbcType=VARCHAR},
      </if>
      <if test="sysEnterpriseExtInvoiceId != null">
        #{sysEnterpriseExtInvoiceId,jdbcType=BIGINT},
      </if>
      <if test="invoiceType != null">
        #{invoiceType,jdbcType=BIGINT},
      </if>
      <if test="invoiceMode != null">
        #{invoiceMode,jdbcType=VARCHAR},
      </if>
      <if test="invoiceState != null">
        #{invoiceState,jdbcType=INTEGER},
      </if>
      <if test="companyName != null">
        #{companyName,jdbcType=VARCHAR},
      </if>
      <if test="invoiceSendEmail != null">
        #{invoiceSendEmail,jdbcType=VARCHAR},
      </if>
      <if test="taxPayersIDCode != null">
        #{taxPayersIDCode,jdbcType=VARCHAR},
      </if>
      <if test="invoiceContent != null">
        #{invoiceContent,jdbcType=INTEGER},
      </if>
      <if test="selectedInvoiceTitle != null">
        #{selectedInvoiceTitle,jdbcType=INTEGER},
      </if>
      <if test="invoiceName != null">
        #{invoiceName,jdbcType=VARCHAR},
      </if>
      <if test="invoicePhone != null">
        #{invoicePhone,jdbcType=VARCHAR},
      </if>
      <if test="invoiceEmail != null">
        #{invoiceEmail,jdbcType=VARCHAR},
      </if>
      <if test="contactsName != null">
        #{contactsName,jdbcType=VARCHAR},
      </if>
      <if test="contactsEmail != null">
        #{contactsEmail,jdbcType=VARCHAR},
      </if>
      <if test="contactsPhone != null">
        #{contactsPhone,jdbcType=VARCHAR},
      </if>
      <if test="invoiceProvice != null">
        #{invoiceProvice,jdbcType=INTEGER},
      </if>
      <if test="invoiceCity != null">
        #{invoiceCity,jdbcType=INTEGER},
      </if>
      <if test="invoiceCounty != null">
        #{invoiceCounty,jdbcType=INTEGER},
      </if>
      <if test="invoiceAddress != null">
        #{invoiceAddress,jdbcType=VARCHAR},
      </if>
      <if test="invoiceAddressPhone != null">
        #{invoiceAddressPhone,jdbcType=VARCHAR},
      </if>
      <if test="invoiceBankAccountNumber != null">
        #{invoiceBankAccountNumber,jdbcType=VARCHAR},
      </if>
      <if test="invoiceBank != null">
        #{invoiceBank,jdbcType=VARCHAR},
      </if>
      <if test="invoiceAccount != null">
        #{invoiceAccount,jdbcType=VARCHAR},
      </if>
      <if test="applyUserId != null">
        #{applyUserId,jdbcType=VARCHAR},
      </if>
      <if test="applyUserName != null">
        #{applyUserName,jdbcType=VARCHAR},
      </if>
      <if test="applyTime != null">
        #{applyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="auditUserId != null">
        #{auditUserId,jdbcType=BIGINT},
      </if>
      <if test="auditStatus != null">
        #{auditStatus,jdbcType=TINYINT},
      </if>
      <if test="auditTime != null">
        #{auditTime,jdbcType=TIMESTAMP},
      </if>
      <if test="invoiceStatus != null">
        #{invoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="invoiceProgressingUserId != null">
        #{invoiceProgressingUserId,jdbcType=BIGINT},
      </if>
      <if test="invoiceProgressingTime != null">
        #{invoiceProgressingTime,jdbcType=TIMESTAMP},
      </if>
      <if test="makeInvoiceUserId != null">
        #{makeInvoiceUserId,jdbcType=VARCHAR},
      </if>
      <if test="makeInvoiceStatus != null">
        #{makeInvoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="makeInvoiceTime != null">
        #{makeInvoiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="receiveInvoiceStatus != null">
        #{receiveInvoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="receiveInvoiceUserId != null">
        #{receiveInvoiceUserId,jdbcType=BIGINT},
      </if>
      <if test="receiveInvoiceTime != null">
        #{receiveInvoiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="invoiceNumber != null">
        #{invoiceNumber,jdbcType=VARCHAR},
      </if>
      <if test="mailTickUserId != null">
        #{mailTickUserId,jdbcType=VARCHAR},
      </if>
      <if test="mailTickStatus != null">
        #{mailTickStatus,jdbcType=TINYINT},
      </if>
      <if test="mailTickTime != null">
        #{mailTickTime,jdbcType=TIMESTAMP},
      </if>
      <if test="backAccountStatus != null">
        #{backAccountStatus,jdbcType=TINYINT},
      </if>
      <if test="backAccountModeRecord != null">
        #{backAccountModeRecord,jdbcType=TINYINT},
      </if>
      <if test="backAccountUserId != null">
        #{backAccountUserId,jdbcType=BIGINT},
      </if>
      <if test="backAccountTime != null">
        #{backAccountTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        #{remark,jdbcType=VARCHAR},
      </if>
      <if test="remark2 != null">
        #{remark2,jdbcType=VARCHAR},
      </if>
      <if test="serviceId != null">
        #{serviceId,jdbcType=INTEGER},
      </if>
      <if test="serviceNo != null">
        #{serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="serviceName != null">
        #{serviceName,jdbcType=VARCHAR},
      </if>
      <if test="sysOrgId != null">
        #{sysOrgId,jdbcType=BIGINT},
      </if>
      <if test="sysVirtId != null">
        #{sysVirtId,jdbcType=BIGINT},
      </if>
      <if test="outOrgId != null">
        #{outOrgId,jdbcType=BIGINT},
      </if>
      <if test="outVirtId != null">
        #{outVirtId,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null">
        #{updateUserId,jdbcType=VARCHAR},
      </if>
      <if test="syncTime != null">
        #{syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="storageStatus != null">
        #{storageStatus,jdbcType=TINYINT},
      </if>
      <if test="storageTime != null">
        #{storageTime,jdbcType=TIMESTAMP},
      </if>
      <if test="jcOrderCount != null">
        #{jcOrderCount,jdbcType=INTEGER},
      </if>
      <if test="unifiedOrderCount != null">
        #{unifiedOrderCount,jdbcType=INTEGER},
      </if>
      <if test="sysEnterpriseExtInvoiceSnapshot != null">
        #{sysEnterpriseExtInvoiceSnapshot,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntityExample" resultType="java.lang.Long">
    select count(*) from qchjc_invoice_apply
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update qchjc_invoice_apply
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.accountingOrderType != null">
        accounting_order_type = #{record.accountingOrderType,jdbcType=TINYINT},
      </if>
      <if test="record.accountingOrderId != null">
        accounting_order_id = #{record.accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="record.accountingOrderSn != null">
        accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="record.dimCreateBy != null">
        dim_create_by = #{record.dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="record.invoiceSn != null">
        invoice_sn = #{record.invoiceSn,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceApplySn != null">
        invoice_apply_sn = #{record.invoiceApplySn,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceApplyAmount != null">
        invoice_apply_amount = #{record.invoiceApplyAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.freeAmount != null">
        free_amount = #{record.freeAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.unAccountingAmount != null">
        un_accounting_amount = #{record.unAccountingAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.jcUnAccountingAmount != null">
        jc_un_accounting_amount = #{record.jcUnAccountingAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.realAmount != null">
        real_amount = #{record.realAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.noCheckCount != null">
        no_check_count = #{record.noCheckCount,jdbcType=DECIMAL},
      </if>
      <if test="record.taxRate != null">
        tax_rate = #{record.taxRate,jdbcType=VARCHAR},
      </if>
      <if test="record.sysEnterpriseExtInvoiceId != null">
        sys_enterprise_ext_invoice_id = #{record.sysEnterpriseExtInvoiceId,jdbcType=BIGINT},
      </if>
      <if test="record.invoiceType != null">
        invoice_type = #{record.invoiceType,jdbcType=BIGINT},
      </if>
      <if test="record.invoiceMode != null">
        invoice_mode = #{record.invoiceMode,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceState != null">
        invoice_state = #{record.invoiceState,jdbcType=INTEGER},
      </if>
      <if test="record.companyName != null">
        company_name = #{record.companyName,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceSendEmail != null">
        invoice_send_email = #{record.invoiceSendEmail,jdbcType=VARCHAR},
      </if>
      <if test="record.taxPayersIDCode != null">
        tax_payers_i_d_code = #{record.taxPayersIDCode,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceContent != null">
        invoice_content = #{record.invoiceContent,jdbcType=INTEGER},
      </if>
      <if test="record.selectedInvoiceTitle != null">
        selected_invoice_title = #{record.selectedInvoiceTitle,jdbcType=INTEGER},
      </if>
      <if test="record.invoiceName != null">
        invoice_name = #{record.invoiceName,jdbcType=VARCHAR},
      </if>
      <if test="record.invoicePhone != null">
        invoice_phone = #{record.invoicePhone,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceEmail != null">
        invoice_email = #{record.invoiceEmail,jdbcType=VARCHAR},
      </if>
      <if test="record.contactsName != null">
        contacts_name = #{record.contactsName,jdbcType=VARCHAR},
      </if>
      <if test="record.contactsEmail != null">
        contacts_email = #{record.contactsEmail,jdbcType=VARCHAR},
      </if>
      <if test="record.contactsPhone != null">
        contacts_phone = #{record.contactsPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceProvice != null">
        invoice_provice = #{record.invoiceProvice,jdbcType=INTEGER},
      </if>
      <if test="record.invoiceCity != null">
        invoice_city = #{record.invoiceCity,jdbcType=INTEGER},
      </if>
      <if test="record.invoiceCounty != null">
        invoice_county = #{record.invoiceCounty,jdbcType=INTEGER},
      </if>
      <if test="record.invoiceAddress != null">
        invoice_address = #{record.invoiceAddress,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceAddressPhone != null">
        invoice_address_phone = #{record.invoiceAddressPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceBankAccountNumber != null">
        invoice_bank_account_number = #{record.invoiceBankAccountNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceBank != null">
        invoice_bank = #{record.invoiceBank,jdbcType=VARCHAR},
      </if>
      <if test="record.invoiceAccount != null">
        invoice_account = #{record.invoiceAccount,jdbcType=VARCHAR},
      </if>
      <if test="record.applyUserId != null">
        apply_user_id = #{record.applyUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.applyUserName != null">
        apply_user_name = #{record.applyUserName,jdbcType=VARCHAR},
      </if>
      <if test="record.applyTime != null">
        apply_time = #{record.applyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.auditUserId != null">
        audit_user_id = #{record.auditUserId,jdbcType=BIGINT},
      </if>
      <if test="record.auditStatus != null">
        audit_status = #{record.auditStatus,jdbcType=TINYINT},
      </if>
      <if test="record.auditTime != null">
        audit_time = #{record.auditTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.invoiceStatus != null">
        invoice_status = #{record.invoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="record.invoiceProgressingUserId != null">
        invoice_progressing_user_id = #{record.invoiceProgressingUserId,jdbcType=BIGINT},
      </if>
      <if test="record.invoiceProgressingTime != null">
        invoice_progressing_time = #{record.invoiceProgressingTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.makeInvoiceUserId != null">
        make_invoice_user_id = #{record.makeInvoiceUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.makeInvoiceStatus != null">
        make_invoice_status = #{record.makeInvoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="record.makeInvoiceTime != null">
        make_invoice_time = #{record.makeInvoiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.receiveInvoiceStatus != null">
        receive_invoice_status = #{record.receiveInvoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="record.receiveInvoiceUserId != null">
        receive_invoice_user_id = #{record.receiveInvoiceUserId,jdbcType=BIGINT},
      </if>
      <if test="record.receiveInvoiceTime != null">
        receive_invoice_time = #{record.receiveInvoiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.invoiceNumber != null">
        invoice_number = #{record.invoiceNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.mailTickUserId != null">
        mail_tick_user_id = #{record.mailTickUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.mailTickStatus != null">
        mail_tick_status = #{record.mailTickStatus,jdbcType=TINYINT},
      </if>
      <if test="record.mailTickTime != null">
        mail_tick_time = #{record.mailTickTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.backAccountStatus != null">
        back_account_status = #{record.backAccountStatus,jdbcType=TINYINT},
      </if>
      <if test="record.backAccountModeRecord != null">
        back_account_mode_record = #{record.backAccountModeRecord,jdbcType=TINYINT},
      </if>
      <if test="record.backAccountUserId != null">
        back_account_user_id = #{record.backAccountUserId,jdbcType=BIGINT},
      </if>
      <if test="record.backAccountTime != null">
        back_account_time = #{record.backAccountTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.remark != null">
        remark = #{record.remark,jdbcType=VARCHAR},
      </if>
      <if test="record.remark2 != null">
        remark2 = #{record.remark2,jdbcType=VARCHAR},
      </if>
      <if test="record.serviceId != null">
        service_id = #{record.serviceId,jdbcType=INTEGER},
      </if>
      <if test="record.serviceNo != null">
        service_no = #{record.serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="record.serviceName != null">
        service_name = #{record.serviceName,jdbcType=VARCHAR},
      </if>
      <if test="record.sysOrgId != null">
        sys_org_id = #{record.sysOrgId,jdbcType=BIGINT},
      </if>
      <if test="record.sysVirtId != null">
        sys_virt_id = #{record.sysVirtId,jdbcType=BIGINT},
      </if>
      <if test="record.outOrgId != null">
        out_org_id = #{record.outOrgId,jdbcType=BIGINT},
      </if>
      <if test="record.outVirtId != null">
        out_virt_id = #{record.outVirtId,jdbcType=VARCHAR},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateUserId != null">
        update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.syncTime != null">
        sync_time = #{record.syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.storageStatus != null">
        storage_status = #{record.storageStatus,jdbcType=TINYINT},
      </if>
      <if test="record.storageTime != null">
        storage_time = #{record.storageTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.jcOrderCount != null">
        jc_order_count = #{record.jcOrderCount,jdbcType=INTEGER},
      </if>
      <if test="record.unifiedOrderCount != null">
        unified_order_count = #{record.unifiedOrderCount,jdbcType=INTEGER},
      </if>
      <if test="record.sysEnterpriseExtInvoiceSnapshot != null">
        sys_enterprise_ext_invoice_snapshot = #{record.sysEnterpriseExtInvoiceSnapshot,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update qchjc_invoice_apply
    set id = #{record.id,jdbcType=BIGINT},
      accounting_order_type = #{record.accountingOrderType,jdbcType=TINYINT},
      accounting_order_id = #{record.accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      dim_create_by = #{record.dimCreateBy,jdbcType=TINYINT},
      invoice_sn = #{record.invoiceSn,jdbcType=VARCHAR},
      invoice_apply_sn = #{record.invoiceApplySn,jdbcType=VARCHAR},
      invoice_apply_amount = #{record.invoiceApplyAmount,jdbcType=DECIMAL},
      free_amount = #{record.freeAmount,jdbcType=DECIMAL},
      un_accounting_amount = #{record.unAccountingAmount,jdbcType=DECIMAL},
      jc_un_accounting_amount = #{record.jcUnAccountingAmount,jdbcType=DECIMAL},
      real_amount = #{record.realAmount,jdbcType=DECIMAL},
      no_check_count = #{record.noCheckCount,jdbcType=DECIMAL},
      tax_rate = #{record.taxRate,jdbcType=VARCHAR},
      sys_enterprise_ext_invoice_id = #{record.sysEnterpriseExtInvoiceId,jdbcType=BIGINT},
      invoice_type = #{record.invoiceType,jdbcType=BIGINT},
      invoice_mode = #{record.invoiceMode,jdbcType=VARCHAR},
      invoice_state = #{record.invoiceState,jdbcType=INTEGER},
      company_name = #{record.companyName,jdbcType=VARCHAR},
      invoice_send_email = #{record.invoiceSendEmail,jdbcType=VARCHAR},
      tax_payers_i_d_code = #{record.taxPayersIDCode,jdbcType=VARCHAR},
      invoice_content = #{record.invoiceContent,jdbcType=INTEGER},
      selected_invoice_title = #{record.selectedInvoiceTitle,jdbcType=INTEGER},
      invoice_name = #{record.invoiceName,jdbcType=VARCHAR},
      invoice_phone = #{record.invoicePhone,jdbcType=VARCHAR},
      invoice_email = #{record.invoiceEmail,jdbcType=VARCHAR},
      contacts_name = #{record.contactsName,jdbcType=VARCHAR},
      contacts_email = #{record.contactsEmail,jdbcType=VARCHAR},
      contacts_phone = #{record.contactsPhone,jdbcType=VARCHAR},
      invoice_provice = #{record.invoiceProvice,jdbcType=INTEGER},
      invoice_city = #{record.invoiceCity,jdbcType=INTEGER},
      invoice_county = #{record.invoiceCounty,jdbcType=INTEGER},
      invoice_address = #{record.invoiceAddress,jdbcType=VARCHAR},
      invoice_address_phone = #{record.invoiceAddressPhone,jdbcType=VARCHAR},
      invoice_bank_account_number = #{record.invoiceBankAccountNumber,jdbcType=VARCHAR},
      invoice_bank = #{record.invoiceBank,jdbcType=VARCHAR},
      invoice_account = #{record.invoiceAccount,jdbcType=VARCHAR},
      apply_user_id = #{record.applyUserId,jdbcType=VARCHAR},
      apply_user_name = #{record.applyUserName,jdbcType=VARCHAR},
      apply_time = #{record.applyTime,jdbcType=TIMESTAMP},
      audit_user_id = #{record.auditUserId,jdbcType=BIGINT},
      audit_status = #{record.auditStatus,jdbcType=TINYINT},
      audit_time = #{record.auditTime,jdbcType=TIMESTAMP},
      invoice_status = #{record.invoiceStatus,jdbcType=TINYINT},
      invoice_progressing_user_id = #{record.invoiceProgressingUserId,jdbcType=BIGINT},
      invoice_progressing_time = #{record.invoiceProgressingTime,jdbcType=TIMESTAMP},
      make_invoice_user_id = #{record.makeInvoiceUserId,jdbcType=VARCHAR},
      make_invoice_status = #{record.makeInvoiceStatus,jdbcType=TINYINT},
      make_invoice_time = #{record.makeInvoiceTime,jdbcType=TIMESTAMP},
      receive_invoice_status = #{record.receiveInvoiceStatus,jdbcType=TINYINT},
      receive_invoice_user_id = #{record.receiveInvoiceUserId,jdbcType=BIGINT},
      receive_invoice_time = #{record.receiveInvoiceTime,jdbcType=TIMESTAMP},
      invoice_number = #{record.invoiceNumber,jdbcType=VARCHAR},
      mail_tick_user_id = #{record.mailTickUserId,jdbcType=VARCHAR},
      mail_tick_status = #{record.mailTickStatus,jdbcType=TINYINT},
      mail_tick_time = #{record.mailTickTime,jdbcType=TIMESTAMP},
      back_account_status = #{record.backAccountStatus,jdbcType=TINYINT},
      back_account_mode_record = #{record.backAccountModeRecord,jdbcType=TINYINT},
      back_account_user_id = #{record.backAccountUserId,jdbcType=BIGINT},
      back_account_time = #{record.backAccountTime,jdbcType=TIMESTAMP},
      remark = #{record.remark,jdbcType=VARCHAR},
      remark2 = #{record.remark2,jdbcType=VARCHAR},
      service_id = #{record.serviceId,jdbcType=INTEGER},
      service_no = #{record.serviceNo,jdbcType=VARCHAR},
      service_name = #{record.serviceName,jdbcType=VARCHAR},
      sys_org_id = #{record.sysOrgId,jdbcType=BIGINT},
      sys_virt_id = #{record.sysVirtId,jdbcType=BIGINT},
      out_org_id = #{record.outOrgId,jdbcType=BIGINT},
      out_virt_id = #{record.outVirtId,jdbcType=VARCHAR},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
      sync_time = #{record.syncTime,jdbcType=TIMESTAMP},
      storage_status = #{record.storageStatus,jdbcType=TINYINT},
      storage_time = #{record.storageTime,jdbcType=TIMESTAMP},
      jc_order_count = #{record.jcOrderCount,jdbcType=INTEGER},
      unified_order_count = #{record.unifiedOrderCount,jdbcType=INTEGER},
      sys_enterprise_ext_invoice_snapshot = #{record.sysEnterpriseExtInvoiceSnapshot,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update qchjc_invoice_apply
    set id = #{record.id,jdbcType=BIGINT},
      accounting_order_type = #{record.accountingOrderType,jdbcType=TINYINT},
      accounting_order_id = #{record.accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{record.accountingOrderSn,jdbcType=VARCHAR},
      dim_create_by = #{record.dimCreateBy,jdbcType=TINYINT},
      invoice_sn = #{record.invoiceSn,jdbcType=VARCHAR},
      invoice_apply_sn = #{record.invoiceApplySn,jdbcType=VARCHAR},
      invoice_apply_amount = #{record.invoiceApplyAmount,jdbcType=DECIMAL},
      free_amount = #{record.freeAmount,jdbcType=DECIMAL},
      un_accounting_amount = #{record.unAccountingAmount,jdbcType=DECIMAL},
      jc_un_accounting_amount = #{record.jcUnAccountingAmount,jdbcType=DECIMAL},
      real_amount = #{record.realAmount,jdbcType=DECIMAL},
      no_check_count = #{record.noCheckCount,jdbcType=DECIMAL},
      tax_rate = #{record.taxRate,jdbcType=VARCHAR},
      sys_enterprise_ext_invoice_id = #{record.sysEnterpriseExtInvoiceId,jdbcType=BIGINT},
      invoice_type = #{record.invoiceType,jdbcType=BIGINT},
      invoice_mode = #{record.invoiceMode,jdbcType=VARCHAR},
      invoice_state = #{record.invoiceState,jdbcType=INTEGER},
      company_name = #{record.companyName,jdbcType=VARCHAR},
      invoice_send_email = #{record.invoiceSendEmail,jdbcType=VARCHAR},
      tax_payers_i_d_code = #{record.taxPayersIDCode,jdbcType=VARCHAR},
      invoice_content = #{record.invoiceContent,jdbcType=INTEGER},
      selected_invoice_title = #{record.selectedInvoiceTitle,jdbcType=INTEGER},
      invoice_name = #{record.invoiceName,jdbcType=VARCHAR},
      invoice_phone = #{record.invoicePhone,jdbcType=VARCHAR},
      invoice_email = #{record.invoiceEmail,jdbcType=VARCHAR},
      contacts_name = #{record.contactsName,jdbcType=VARCHAR},
      contacts_email = #{record.contactsEmail,jdbcType=VARCHAR},
      contacts_phone = #{record.contactsPhone,jdbcType=VARCHAR},
      invoice_provice = #{record.invoiceProvice,jdbcType=INTEGER},
      invoice_city = #{record.invoiceCity,jdbcType=INTEGER},
      invoice_county = #{record.invoiceCounty,jdbcType=INTEGER},
      invoice_address = #{record.invoiceAddress,jdbcType=VARCHAR},
      invoice_address_phone = #{record.invoiceAddressPhone,jdbcType=VARCHAR},
      invoice_bank_account_number = #{record.invoiceBankAccountNumber,jdbcType=VARCHAR},
      invoice_bank = #{record.invoiceBank,jdbcType=VARCHAR},
      invoice_account = #{record.invoiceAccount,jdbcType=VARCHAR},
      apply_user_id = #{record.applyUserId,jdbcType=VARCHAR},
      apply_user_name = #{record.applyUserName,jdbcType=VARCHAR},
      apply_time = #{record.applyTime,jdbcType=TIMESTAMP},
      audit_user_id = #{record.auditUserId,jdbcType=BIGINT},
      audit_status = #{record.auditStatus,jdbcType=TINYINT},
      audit_time = #{record.auditTime,jdbcType=TIMESTAMP},
      invoice_status = #{record.invoiceStatus,jdbcType=TINYINT},
      invoice_progressing_user_id = #{record.invoiceProgressingUserId,jdbcType=BIGINT},
      invoice_progressing_time = #{record.invoiceProgressingTime,jdbcType=TIMESTAMP},
      make_invoice_user_id = #{record.makeInvoiceUserId,jdbcType=VARCHAR},
      make_invoice_status = #{record.makeInvoiceStatus,jdbcType=TINYINT},
      make_invoice_time = #{record.makeInvoiceTime,jdbcType=TIMESTAMP},
      receive_invoice_status = #{record.receiveInvoiceStatus,jdbcType=TINYINT},
      receive_invoice_user_id = #{record.receiveInvoiceUserId,jdbcType=BIGINT},
      receive_invoice_time = #{record.receiveInvoiceTime,jdbcType=TIMESTAMP},
      invoice_number = #{record.invoiceNumber,jdbcType=VARCHAR},
      mail_tick_user_id = #{record.mailTickUserId,jdbcType=VARCHAR},
      mail_tick_status = #{record.mailTickStatus,jdbcType=TINYINT},
      mail_tick_time = #{record.mailTickTime,jdbcType=TIMESTAMP},
      back_account_status = #{record.backAccountStatus,jdbcType=TINYINT},
      back_account_mode_record = #{record.backAccountModeRecord,jdbcType=TINYINT},
      back_account_user_id = #{record.backAccountUserId,jdbcType=BIGINT},
      back_account_time = #{record.backAccountTime,jdbcType=TIMESTAMP},
      remark = #{record.remark,jdbcType=VARCHAR},
      remark2 = #{record.remark2,jdbcType=VARCHAR},
      service_id = #{record.serviceId,jdbcType=INTEGER},
      service_no = #{record.serviceNo,jdbcType=VARCHAR},
      service_name = #{record.serviceName,jdbcType=VARCHAR},
      sys_org_id = #{record.sysOrgId,jdbcType=BIGINT},
      sys_virt_id = #{record.sysVirtId,jdbcType=BIGINT},
      out_org_id = #{record.outOrgId,jdbcType=BIGINT},
      out_virt_id = #{record.outVirtId,jdbcType=VARCHAR},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{record.updateUserId,jdbcType=VARCHAR},
      sync_time = #{record.syncTime,jdbcType=TIMESTAMP},
      storage_status = #{record.storageStatus,jdbcType=TINYINT},
      storage_time = #{record.storageTime,jdbcType=TIMESTAMP},
      jc_order_count = #{record.jcOrderCount,jdbcType=INTEGER},
      unified_order_count = #{record.unifiedOrderCount,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntity">
    update qchjc_invoice_apply
    <set>
      <if test="accountingOrderType != null">
        accounting_order_type = #{accountingOrderType,jdbcType=TINYINT},
      </if>
      <if test="accountingOrderId != null">
        accounting_order_id = #{accountingOrderId,jdbcType=BIGINT},
      </if>
      <if test="accountingOrderSn != null">
        accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      </if>
      <if test="dimCreateBy != null">
        dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      </if>
      <if test="invoiceSn != null">
        invoice_sn = #{invoiceSn,jdbcType=VARCHAR},
      </if>
      <if test="invoiceApplySn != null">
        invoice_apply_sn = #{invoiceApplySn,jdbcType=VARCHAR},
      </if>
      <if test="invoiceApplyAmount != null">
        invoice_apply_amount = #{invoiceApplyAmount,jdbcType=DECIMAL},
      </if>
      <if test="freeAmount != null">
        free_amount = #{freeAmount,jdbcType=DECIMAL},
      </if>
      <if test="unAccountingAmount != null">
        un_accounting_amount = #{unAccountingAmount,jdbcType=DECIMAL},
      </if>
      <if test="jcUnAccountingAmount != null">
        jc_un_accounting_amount = #{jcUnAccountingAmount,jdbcType=DECIMAL},
      </if>
      <if test="realAmount != null">
        real_amount = #{realAmount,jdbcType=DECIMAL},
      </if>
      <if test="noCheckCount != null">
        no_check_count = #{noCheckCount,jdbcType=DECIMAL},
      </if>
      <if test="taxRate != null">
        tax_rate = #{taxRate,jdbcType=VARCHAR},
      </if>
      <if test="sysEnterpriseExtInvoiceId != null">
        sys_enterprise_ext_invoice_id = #{sysEnterpriseExtInvoiceId,jdbcType=BIGINT},
      </if>
      <if test="invoiceType != null">
        invoice_type = #{invoiceType,jdbcType=BIGINT},
      </if>
      <if test="invoiceMode != null">
        invoice_mode = #{invoiceMode,jdbcType=VARCHAR},
      </if>
      <if test="invoiceState != null">
        invoice_state = #{invoiceState,jdbcType=INTEGER},
      </if>
      <if test="companyName != null">
        company_name = #{companyName,jdbcType=VARCHAR},
      </if>
      <if test="invoiceSendEmail != null">
        invoice_send_email = #{invoiceSendEmail,jdbcType=VARCHAR},
      </if>
      <if test="taxPayersIDCode != null">
        tax_payers_i_d_code = #{taxPayersIDCode,jdbcType=VARCHAR},
      </if>
      <if test="invoiceContent != null">
        invoice_content = #{invoiceContent,jdbcType=INTEGER},
      </if>
      <if test="selectedInvoiceTitle != null">
        selected_invoice_title = #{selectedInvoiceTitle,jdbcType=INTEGER},
      </if>
      <if test="invoiceName != null">
        invoice_name = #{invoiceName,jdbcType=VARCHAR},
      </if>
      <if test="invoicePhone != null">
        invoice_phone = #{invoicePhone,jdbcType=VARCHAR},
      </if>
      <if test="invoiceEmail != null">
        invoice_email = #{invoiceEmail,jdbcType=VARCHAR},
      </if>
      <if test="contactsName != null">
        contacts_name = #{contactsName,jdbcType=VARCHAR},
      </if>
      <if test="contactsEmail != null">
        contacts_email = #{contactsEmail,jdbcType=VARCHAR},
      </if>
      <if test="contactsPhone != null">
        contacts_phone = #{contactsPhone,jdbcType=VARCHAR},
      </if>
      <if test="invoiceProvice != null">
        invoice_provice = #{invoiceProvice,jdbcType=INTEGER},
      </if>
      <if test="invoiceCity != null">
        invoice_city = #{invoiceCity,jdbcType=INTEGER},
      </if>
      <if test="invoiceCounty != null">
        invoice_county = #{invoiceCounty,jdbcType=INTEGER},
      </if>
      <if test="invoiceAddress != null">
        invoice_address = #{invoiceAddress,jdbcType=VARCHAR},
      </if>
      <if test="invoiceAddressPhone != null">
        invoice_address_phone = #{invoiceAddressPhone,jdbcType=VARCHAR},
      </if>
      <if test="invoiceBankAccountNumber != null">
        invoice_bank_account_number = #{invoiceBankAccountNumber,jdbcType=VARCHAR},
      </if>
      <if test="invoiceBank != null">
        invoice_bank = #{invoiceBank,jdbcType=VARCHAR},
      </if>
      <if test="invoiceAccount != null">
        invoice_account = #{invoiceAccount,jdbcType=VARCHAR},
      </if>
      <if test="applyUserId != null">
        apply_user_id = #{applyUserId,jdbcType=VARCHAR},
      </if>
      <if test="applyUserName != null">
        apply_user_name = #{applyUserName,jdbcType=VARCHAR},
      </if>
      <if test="applyTime != null">
        apply_time = #{applyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="auditUserId != null">
        audit_user_id = #{auditUserId,jdbcType=BIGINT},
      </if>
      <if test="auditStatus != null">
        audit_status = #{auditStatus,jdbcType=TINYINT},
      </if>
      <if test="auditTime != null">
        audit_time = #{auditTime,jdbcType=TIMESTAMP},
      </if>
      <if test="invoiceStatus != null">
        invoice_status = #{invoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="invoiceProgressingUserId != null">
        invoice_progressing_user_id = #{invoiceProgressingUserId,jdbcType=BIGINT},
      </if>
      <if test="invoiceProgressingTime != null">
        invoice_progressing_time = #{invoiceProgressingTime,jdbcType=TIMESTAMP},
      </if>
      <if test="makeInvoiceUserId != null">
        make_invoice_user_id = #{makeInvoiceUserId,jdbcType=VARCHAR},
      </if>
      <if test="makeInvoiceStatus != null">
        make_invoice_status = #{makeInvoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="makeInvoiceTime != null">
        make_invoice_time = #{makeInvoiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="receiveInvoiceStatus != null">
        receive_invoice_status = #{receiveInvoiceStatus,jdbcType=TINYINT},
      </if>
      <if test="receiveInvoiceUserId != null">
        receive_invoice_user_id = #{receiveInvoiceUserId,jdbcType=BIGINT},
      </if>
      <if test="receiveInvoiceTime != null">
        receive_invoice_time = #{receiveInvoiceTime,jdbcType=TIMESTAMP},
      </if>
      <if test="invoiceNumber != null">
        invoice_number = #{invoiceNumber,jdbcType=VARCHAR},
      </if>
      <if test="mailTickUserId != null">
        mail_tick_user_id = #{mailTickUserId,jdbcType=VARCHAR},
      </if>
      <if test="mailTickStatus != null">
        mail_tick_status = #{mailTickStatus,jdbcType=TINYINT},
      </if>
      <if test="mailTickTime != null">
        mail_tick_time = #{mailTickTime,jdbcType=TIMESTAMP},
      </if>
      <if test="backAccountStatus != null">
        back_account_status = #{backAccountStatus,jdbcType=TINYINT},
      </if>
      <if test="backAccountModeRecord != null">
        back_account_mode_record = #{backAccountModeRecord,jdbcType=TINYINT},
      </if>
      <if test="backAccountUserId != null">
        back_account_user_id = #{backAccountUserId,jdbcType=BIGINT},
      </if>
      <if test="backAccountTime != null">
        back_account_time = #{backAccountTime,jdbcType=TIMESTAMP},
      </if>
      <if test="remark != null">
        remark = #{remark,jdbcType=VARCHAR},
      </if>
      <if test="remark2 != null">
        remark2 = #{remark2,jdbcType=VARCHAR},
      </if>
      <if test="serviceId != null">
        service_id = #{serviceId,jdbcType=INTEGER},
      </if>
      <if test="serviceNo != null">
        service_no = #{serviceNo,jdbcType=VARCHAR},
      </if>
      <if test="serviceName != null">
        service_name = #{serviceName,jdbcType=VARCHAR},
      </if>
      <if test="sysOrgId != null">
        sys_org_id = #{sysOrgId,jdbcType=BIGINT},
      </if>
      <if test="sysVirtId != null">
        sys_virt_id = #{sysVirtId,jdbcType=BIGINT},
      </if>
      <if test="outOrgId != null">
        out_org_id = #{outOrgId,jdbcType=BIGINT},
      </if>
      <if test="outVirtId != null">
        out_virt_id = #{outVirtId,jdbcType=VARCHAR},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null">
        update_user_id = #{updateUserId,jdbcType=VARCHAR},
      </if>
      <if test="syncTime != null">
        sync_time = #{syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="storageStatus != null">
        storage_status = #{storageStatus,jdbcType=TINYINT},
      </if>
      <if test="storageTime != null">
        storage_time = #{storageTime,jdbcType=TIMESTAMP},
      </if>
      <if test="jcOrderCount != null">
        jc_order_count = #{jcOrderCount,jdbcType=INTEGER},
      </if>
      <if test="unifiedOrderCount != null">
        unified_order_count = #{unifiedOrderCount,jdbcType=INTEGER},
      </if>
      <if test="sysEnterpriseExtInvoiceSnapshot != null">
        sys_enterprise_ext_invoice_snapshot = #{sysEnterpriseExtInvoiceSnapshot,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntity">
    update qchjc_invoice_apply
    set accounting_order_type = #{accountingOrderType,jdbcType=TINYINT},
      accounting_order_id = #{accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      invoice_sn = #{invoiceSn,jdbcType=VARCHAR},
      invoice_apply_sn = #{invoiceApplySn,jdbcType=VARCHAR},
      invoice_apply_amount = #{invoiceApplyAmount,jdbcType=DECIMAL},
      free_amount = #{freeAmount,jdbcType=DECIMAL},
      un_accounting_amount = #{unAccountingAmount,jdbcType=DECIMAL},
      jc_un_accounting_amount = #{jcUnAccountingAmount,jdbcType=DECIMAL},
      real_amount = #{realAmount,jdbcType=DECIMAL},
      no_check_count = #{noCheckCount,jdbcType=DECIMAL},
      tax_rate = #{taxRate,jdbcType=VARCHAR},
      sys_enterprise_ext_invoice_id = #{sysEnterpriseExtInvoiceId,jdbcType=BIGINT},
      invoice_type = #{invoiceType,jdbcType=BIGINT},
      invoice_mode = #{invoiceMode,jdbcType=VARCHAR},
      invoice_state = #{invoiceState,jdbcType=INTEGER},
      company_name = #{companyName,jdbcType=VARCHAR},
      invoice_send_email = #{invoiceSendEmail,jdbcType=VARCHAR},
      tax_payers_i_d_code = #{taxPayersIDCode,jdbcType=VARCHAR},
      invoice_content = #{invoiceContent,jdbcType=INTEGER},
      selected_invoice_title = #{selectedInvoiceTitle,jdbcType=INTEGER},
      invoice_name = #{invoiceName,jdbcType=VARCHAR},
      invoice_phone = #{invoicePhone,jdbcType=VARCHAR},
      invoice_email = #{invoiceEmail,jdbcType=VARCHAR},
      contacts_name = #{contactsName,jdbcType=VARCHAR},
      contacts_email = #{contactsEmail,jdbcType=VARCHAR},
      contacts_phone = #{contactsPhone,jdbcType=VARCHAR},
      invoice_provice = #{invoiceProvice,jdbcType=INTEGER},
      invoice_city = #{invoiceCity,jdbcType=INTEGER},
      invoice_county = #{invoiceCounty,jdbcType=INTEGER},
      invoice_address = #{invoiceAddress,jdbcType=VARCHAR},
      invoice_address_phone = #{invoiceAddressPhone,jdbcType=VARCHAR},
      invoice_bank_account_number = #{invoiceBankAccountNumber,jdbcType=VARCHAR},
      invoice_bank = #{invoiceBank,jdbcType=VARCHAR},
      invoice_account = #{invoiceAccount,jdbcType=VARCHAR},
      apply_user_id = #{applyUserId,jdbcType=VARCHAR},
      apply_user_name = #{applyUserName,jdbcType=VARCHAR},
      apply_time = #{applyTime,jdbcType=TIMESTAMP},
      audit_user_id = #{auditUserId,jdbcType=BIGINT},
      audit_status = #{auditStatus,jdbcType=TINYINT},
      audit_time = #{auditTime,jdbcType=TIMESTAMP},
      invoice_status = #{invoiceStatus,jdbcType=TINYINT},
      invoice_progressing_user_id = #{invoiceProgressingUserId,jdbcType=BIGINT},
      invoice_progressing_time = #{invoiceProgressingTime,jdbcType=TIMESTAMP},
      make_invoice_user_id = #{makeInvoiceUserId,jdbcType=VARCHAR},
      make_invoice_status = #{makeInvoiceStatus,jdbcType=TINYINT},
      make_invoice_time = #{makeInvoiceTime,jdbcType=TIMESTAMP},
      receive_invoice_status = #{receiveInvoiceStatus,jdbcType=TINYINT},
      receive_invoice_user_id = #{receiveInvoiceUserId,jdbcType=BIGINT},
      receive_invoice_time = #{receiveInvoiceTime,jdbcType=TIMESTAMP},
      invoice_number = #{invoiceNumber,jdbcType=VARCHAR},
      mail_tick_user_id = #{mailTickUserId,jdbcType=VARCHAR},
      mail_tick_status = #{mailTickStatus,jdbcType=TINYINT},
      mail_tick_time = #{mailTickTime,jdbcType=TIMESTAMP},
      back_account_status = #{backAccountStatus,jdbcType=TINYINT},
      back_account_mode_record = #{backAccountModeRecord,jdbcType=TINYINT},
      back_account_user_id = #{backAccountUserId,jdbcType=BIGINT},
      back_account_time = #{backAccountTime,jdbcType=TIMESTAMP},
      remark = #{remark,jdbcType=VARCHAR},
      remark2 = #{remark2,jdbcType=VARCHAR},
      service_id = #{serviceId,jdbcType=INTEGER},
      service_no = #{serviceNo,jdbcType=VARCHAR},
      service_name = #{serviceName,jdbcType=VARCHAR},
      sys_org_id = #{sysOrgId,jdbcType=BIGINT},
      sys_virt_id = #{sysVirtId,jdbcType=BIGINT},
      out_org_id = #{outOrgId,jdbcType=BIGINT},
      out_virt_id = #{outVirtId,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{updateUserId,jdbcType=VARCHAR},
      sync_time = #{syncTime,jdbcType=TIMESTAMP},
      storage_status = #{storageStatus,jdbcType=TINYINT},
      storage_time = #{storageTime,jdbcType=TIMESTAMP},
      jc_order_count = #{jcOrderCount,jdbcType=INTEGER},
      unified_order_count = #{unifiedOrderCount,jdbcType=INTEGER},
      sys_enterprise_ext_invoice_snapshot = #{sysEnterpriseExtInvoiceSnapshot,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.thirdpart.qchjc.invoice.QchjcInvoiceApplyEntity">
    update qchjc_invoice_apply
    set accounting_order_type = #{accountingOrderType,jdbcType=TINYINT},
      accounting_order_id = #{accountingOrderId,jdbcType=BIGINT},
      accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR},
      dim_create_by = #{dimCreateBy,jdbcType=TINYINT},
      invoice_sn = #{invoiceSn,jdbcType=VARCHAR},
      invoice_apply_sn = #{invoiceApplySn,jdbcType=VARCHAR},
      invoice_apply_amount = #{invoiceApplyAmount,jdbcType=DECIMAL},
      free_amount = #{freeAmount,jdbcType=DECIMAL},
      un_accounting_amount = #{unAccountingAmount,jdbcType=DECIMAL},
      jc_un_accounting_amount = #{jcUnAccountingAmount,jdbcType=DECIMAL},
      real_amount = #{realAmount,jdbcType=DECIMAL},
      no_check_count = #{noCheckCount,jdbcType=DECIMAL},
      tax_rate = #{taxRate,jdbcType=VARCHAR},
      sys_enterprise_ext_invoice_id = #{sysEnterpriseExtInvoiceId,jdbcType=BIGINT},
      invoice_type = #{invoiceType,jdbcType=BIGINT},
      invoice_mode = #{invoiceMode,jdbcType=VARCHAR},
      invoice_state = #{invoiceState,jdbcType=INTEGER},
      company_name = #{companyName,jdbcType=VARCHAR},
      invoice_send_email = #{invoiceSendEmail,jdbcType=VARCHAR},
      tax_payers_i_d_code = #{taxPayersIDCode,jdbcType=VARCHAR},
      invoice_content = #{invoiceContent,jdbcType=INTEGER},
      selected_invoice_title = #{selectedInvoiceTitle,jdbcType=INTEGER},
      invoice_name = #{invoiceName,jdbcType=VARCHAR},
      invoice_phone = #{invoicePhone,jdbcType=VARCHAR},
      invoice_email = #{invoiceEmail,jdbcType=VARCHAR},
      contacts_name = #{contactsName,jdbcType=VARCHAR},
      contacts_email = #{contactsEmail,jdbcType=VARCHAR},
      contacts_phone = #{contactsPhone,jdbcType=VARCHAR},
      invoice_provice = #{invoiceProvice,jdbcType=INTEGER},
      invoice_city = #{invoiceCity,jdbcType=INTEGER},
      invoice_county = #{invoiceCounty,jdbcType=INTEGER},
      invoice_address = #{invoiceAddress,jdbcType=VARCHAR},
      invoice_address_phone = #{invoiceAddressPhone,jdbcType=VARCHAR},
      invoice_bank_account_number = #{invoiceBankAccountNumber,jdbcType=VARCHAR},
      invoice_bank = #{invoiceBank,jdbcType=VARCHAR},
      invoice_account = #{invoiceAccount,jdbcType=VARCHAR},
      apply_user_id = #{applyUserId,jdbcType=VARCHAR},
      apply_user_name = #{applyUserName,jdbcType=VARCHAR},
      apply_time = #{applyTime,jdbcType=TIMESTAMP},
      audit_user_id = #{auditUserId,jdbcType=BIGINT},
      audit_status = #{auditStatus,jdbcType=TINYINT},
      audit_time = #{auditTime,jdbcType=TIMESTAMP},
      invoice_status = #{invoiceStatus,jdbcType=TINYINT},
      invoice_progressing_user_id = #{invoiceProgressingUserId,jdbcType=BIGINT},
      invoice_progressing_time = #{invoiceProgressingTime,jdbcType=TIMESTAMP},
      make_invoice_user_id = #{makeInvoiceUserId,jdbcType=VARCHAR},
      make_invoice_status = #{makeInvoiceStatus,jdbcType=TINYINT},
      make_invoice_time = #{makeInvoiceTime,jdbcType=TIMESTAMP},
      receive_invoice_status = #{receiveInvoiceStatus,jdbcType=TINYINT},
      receive_invoice_user_id = #{receiveInvoiceUserId,jdbcType=BIGINT},
      receive_invoice_time = #{receiveInvoiceTime,jdbcType=TIMESTAMP},
      invoice_number = #{invoiceNumber,jdbcType=VARCHAR},
      mail_tick_user_id = #{mailTickUserId,jdbcType=VARCHAR},
      mail_tick_status = #{mailTickStatus,jdbcType=TINYINT},
      mail_tick_time = #{mailTickTime,jdbcType=TIMESTAMP},
      back_account_status = #{backAccountStatus,jdbcType=TINYINT},
      back_account_mode_record = #{backAccountModeRecord,jdbcType=TINYINT},
      back_account_user_id = #{backAccountUserId,jdbcType=BIGINT},
      back_account_time = #{backAccountTime,jdbcType=TIMESTAMP},
      remark = #{remark,jdbcType=VARCHAR},
      remark2 = #{remark2,jdbcType=VARCHAR},
      service_id = #{serviceId,jdbcType=INTEGER},
      service_no = #{serviceNo,jdbcType=VARCHAR},
      service_name = #{serviceName,jdbcType=VARCHAR},
      sys_org_id = #{sysOrgId,jdbcType=BIGINT},
      sys_virt_id = #{sysVirtId,jdbcType=BIGINT},
      out_org_id = #{outOrgId,jdbcType=BIGINT},
      out_virt_id = #{outVirtId,jdbcType=VARCHAR},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{updateUserId,jdbcType=VARCHAR},
      sync_time = #{syncTime,jdbcType=TIMESTAMP},
      storage_status = #{storageStatus,jdbcType=TINYINT},
      storage_time = #{storageTime,jdbcType=TIMESTAMP},
      jc_order_count = #{jcOrderCount,jdbcType=INTEGER},
      unified_order_count = #{unifiedOrderCount,jdbcType=INTEGER}
    where id = #{id,jdbcType=BIGINT}
  </update>

    <select id="queryQchjcInvoiceApplyVoListByAccountingOrderSn" resultType="cn.superdesk.uniorder.dto.vo.thirdpart.qchjc.invoice.QchjcInvoiceApplyVo">
      SELECT
        t1.invoice_sn AS invoiceSn,
        t2.purchase_virt_name AS purchaseVirtName,
        t1.apply_user_name AS applyUserName,
        t1.jc_order_count AS orderCount,
        t1.invoice_apply_amount AS invoiceApplyAmount,
        t1.invoice_apply_sn AS invoiceApplySn,
        t1.invoice_number AS invoiceNumber,
        t1.jc_order_count AS jcOrderCount,
        t1.unified_order_count AS unifiedOrderCount,
        CASE
          t1.invoice_type
          WHEN 1 THEN
            '电子普通发票'
          WHEN 2 THEN
            '纸质专用发票'
          WHEN 3 THEN
            '纸质普通发票'
          WHEN 4 THEN
            '电子专用发票'
          END AS invoiceType,
        CASE
          t1.invoice_mode
          WHEN 'offLine' THEN
            '线下开票'
          WHEN 'szhtxxElectronicInvoice' THEN
            '深圳航天信息电子发票'
          WHEN 'szhtxxPaperInvoice' THEN
            '深圳航信纸质发票'
          END AS invoiceMode
      FROM
        qchjc_invoice_apply t1
          LEFT JOIN qchjc_accounting_score_customer t2 ON t1.accounting_order_sn = t2.accounting_order_sn
      WHERE
        t1.accounting_order_sn = #{accountingOrderSn,jdbcType=VARCHAR}
    </select>
  <select id="selectInvoiceApplyResByQchjcApplyId" resultType="java.lang.String">
    SELECT
      CONCAT( invoice_apply_sn, '-', goods_quantity, '-', invoice_apply_amount )
    FROM
      invoice_apply
    WHERE
        id IN (
        SELECT
          invoice_apply_id
        FROM
          invoice_apply_x_goods
        WHERE
            unified_order_goods_id IN ( SELECT unified_id FROM qchjc_order_goods WHERE qch_customer_invoice_apply_id = #{id} ))
  </select>

</mapper>