emis-service/emis-biz/src/main/resources/mapper/EmisSettleInvoiceRecordMapper.xml
2025-05-05 15:48:05 +08:00

522 lines
35 KiB
XML

<?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.xdadan.erp.emis.mapper.EmisSettleInvoiceRecordMapper">
<resultMap type="EmisSettleInvoiceRecord" id="EmisSettleInvoiceRecordResult" extends="com.xdadan.erp.emis.mapper.EmisBaseMapper.EmisBaseResult">
<result property="id" column="id" />
<result property="applySeqNo" column="apply_seq_no" />
<result property="applyDate" column="apply_date" />
<result property="applyManCode" column="apply_man_code" />
<result property="applySiteCode" column="apply_site_code" />
<result property="customerCode" column="customer_code" />
<result property="customerName" column="customer_name" />
<result property="settleBillNo" column="settle_bill_no" />
<result property="settleBillName" column="settle_bill_name" />
<result property="applyMoney" column="apply_money" />
<result property="invoiceType" column="invoice_type" />
<result property="openbillScope" column="openbill_scope" />
<result property="companyName" column="company_name" />
<result property="companyTaxNo" column="company_tax_no" />
<result property="companyTel" column="company_tel" />
<result property="companyAddress" column="company_address" />
<result property="invioceRemark" column="invioce_remark" />
<result property="bankName" column="bank_name" />
<result property="bankAccNo" column="bank_acc_no" />
<result property="contact" column="contact" />
<result property="phone" column="phone" />
<result property="realTaxType" column="real_tax_type" />
<result property="origOpenMoney" column="orig_open_money" />
<result property="addTaxRate" column="add_tax_rate" />
<result property="addOpenMoney" column="add_open_money" />
<result property="openMoneyMax" column="open_money_max" />
<result property="openMoney" column="open_money" />
<result property="invoiceNo" column="invoice_no" />
<result property="recedMoney" column="reced_money" />
<result property="paymentStatus" column="payment_status" />
<result property="invoiceStatus" column="invoice_status" />
<result property="invoiceStatusDesc" column="invoice_status_desc" />
<result property="recieveAddress" column="recieve_address" />
<result property="email" column="email" />
<result property="filePath" column="file_path" />
<result property="blAudit" column="bl_audit" />
<result property="auditDate" column="audit_date" />
<result property="auditManCode" column="audit_man_code" />
<result property="auditSiteCode" column="audit_site_code" />
<result property="auditNote" column="audit_note" />
<result property="opManCode" column="op_man_code" />
<result property="opDate" column="op_date" />
<result property="opSiteCode" column="op_site_code" />
<result property="openChId" column="open_ch_id" />
<result property="openChStatus" column="open_ch_status" />
<result property="openChStatusDesc" column="open_ch_status_desc" />
<result property="openComCode" column="open_com_code" />
<association property="applyManName" column="apply_man_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode"/>
<association property="applySiteName" column="apply_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="auditManName" column="audit_man_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode"/>
<association property="auditSiteName" column="audit_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
<association property="opManName" column="op_man_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectEmpNameByCode"/>
<association property="opSiteName" column="op_site_code" select="com.xdadan.erp.emis.mapper.EmisBaseMapper.selectSiteNameByCode"/>
</resultMap>
<sql id="selectEmisSettleInvoiceRecordVo">
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, openbill_scope, company_name, company_tax_no, company_tel, company_address, invioce_remark, bank_name, bank_acc_no, contact, phone, real_tax_type, orig_open_money, add_tax_rate, add_open_money, open_money_max, open_money, invoice_no, reced_money, payment_status, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_settle_invoice_record
</sql>
<select id="selectEmisSettleInvoiceRecordList" parameterType="EmisSettleInvoiceRecord" resultMap="EmisSettleInvoiceRecordResult">
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, openbill_scope, company_name, company_tax_no, company_tel, company_address, invioce_remark, bank_name, bank_acc_no, contact, phone, real_tax_type, orig_open_money, add_tax_rate, add_open_money, open_money_max, open_money, invoice_no, reced_money, payment_status, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_settle_invoice_record a
<where>
del_flag='0'
<if test="id != null "> and id = #{id}</if>
<if test="applySeqNo != null and applySeqNo != ''"> and apply_seq_no = #{applySeqNo}</if>
<if test="applyDate != null "> and apply_date = #{applyDate}</if>
<if test="applyManCode != null and applyManCode != ''"> and apply_man_code = #{applyManCode}</if>
<if test="applySiteCode != null and applySiteCode != ''"> and apply_site_code = #{applySiteCode}</if>
<if test="customerCode != null and customerCode != ''"> and customer_code = #{customerCode}</if>
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
<if test="settleBillName != null and settleBillName != ''"> and settle_bill_name like concat('%', #{settleBillName}, '%')</if>
<if test="applyMoney != null "> and apply_money = #{applyMoney}</if>
<if test="paymentStatus != null and paymentStatus != ''"> and payment_status=#{paymentStatus}</if>
<if test="invoiceType != null and invoiceType != ''"> and invoice_type = #{invoiceType}</if>
<if test="companyName != null and companyName != ''"> and company_name like concat('%', #{companyName}, '%')</if>
<if test="companyTaxNo != null and companyTaxNo != ''"> and company_tax_no = #{companyTaxNo}</if>
<if test="companyTel != null and companyTel != ''"> and company_tel like concat('%', #{companyTel}, '%')</if>
<if test="companyAddress != null and companyAddress != ''"> and company_address like concat('%', #{companyAddress}, '%')</if>
<if test="bankName != null and bankName != ''"> and bank_name like concat('%', #{bankName}, '%')</if>
<if test="bankAccNo != null and bankAccNo != ''"> and bank_acc_no like concat('%', #{bankAccNo}, '%')</if>
<if test="contact != null and contact != ''"> and contact like concat('%', #{contact}, '%')</if>
<if test="phone != null and phone != ''"> and phone like concat('%', #{phone}, '%')</if>
<if test="realTaxType != null and realTaxType != ''"> and real_tax_type = #{realTaxType}</if>
<if test="openMoneyMax != null "> and open_money_max = #{openMoneyMax}</if>
<if test="openMoney != null "> and open_money = #{openMoney}</if>
<if test="invoiceNo != null and invoiceNo != ''"> and invoice_no = #{invoiceNo}</if>
<if test="invoiceStatus != null and invoiceStatus != ''"> and invoice_status = #{invoiceStatus}</if>
<if test="invoiceStatusDesc != null and invoiceStatusDesc != ''"> and invoice_status_desc like concat('%', #{invoiceStatusDesc}, '%')</if>
<if test="recieveAddress != null and recieveAddress != ''"> and recieve_address like concat('%', #{recieveAddress}, '%')</if>
<if test="email != null and email != ''"> and email like concat('%', #{email}, '%')</if>
<if test="filePath != null and filePath != ''"> and file_path like concat('%', #{filePath}, '%')</if>
<if test="remark != null and remark != ''"> and remark like concat('%', #{remark}, '%')</if>
<if test="blAudit != null and blAudit != ''"> and bl_audit = #{blAudit}</if>
<if test="auditDate != null "> and audit_date = #{auditDate}</if>
<if test="auditManCode != null and auditManCode != ''"> and audit_man_code like concat('%', #{auditManCode}, '%')</if>
<if test="auditSiteCode != null and auditSiteCode != ''"> and audit_site_code like concat('%', #{auditSiteCode}, '%')</if>
<if test="opManCode != null and opManCode != ''"> and op_man_code like concat('%', #{opManCode}, '%')</if>
<if test="opDate != null "> and op_date = #{opDate}</if>
<if test="opSiteCode != null and opSiteCode != ''"> and op_site_code = #{opSiteCode}</if>
<if test="openChId != null and openChId != ''"> and open_ch_id = #{openChId}</if>
<if test="openChStatus != null and openChStatus != ''"> and open_ch_status = #{openChStatus}</if>
<if test="openChStatusDesc != null and openChStatusDesc != ''"> and open_ch_status_desc = #{openChStatusDesc}</if>
<if test="openComCode != null and openComCode != ''"> and open_com_code = #{openComCode}</if>
<if test="delFlag != null and delFlag != ''"> and del_flag like concat('%', #{delFlag}, '%')</if>
<if test="createBy != null and createBy != ''"> and create_by like concat('%', #{createBy}, '%')</if>
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="createSite != null and createSite != ''"> and create_site like concat('%', #{createSite}, '%')</if>
<if test="updateSite != null and updateSite != ''"> and update_site like concat('%', #{updateSite}, '%')</if>
<if test="settleBillNo != null and settleBillNo != ''">
<!--
AND apply_seq_no IN (
SELECT x1.apply_seq_no FROM
emis_settle_invoice_record x1,
emis_settle_bill x2
WHERE
x1.del_flag = '0'
AND x2.del_flag = '0'
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
AND FIND_IN_SET( x2.settle_bill_no, #{settleBillNo})
) -->
and EXISTS(
select 1 from emis_settle_invoice_bill_rel x3
where x3.del_flag = '0'
and a.apply_seq_no=x3.apply_seq_no
AND FIND_IN_SET(x3.settle_bill_no, #{settleBillNo})
)
</if>
<if test="params.billCode != null and params.billCode != ''">
and EXISTS(
select 1 from emis_settle_bill x2,emis_settle_invoice_bill_rel x3,emis_settle_sub_bill x4
where x2.del_flag = '0' and x3.del_flag = '0' and x4.del_flag='0'
and a.apply_seq_no=x3.apply_seq_no
and x2.settle_bill_no=x3.settle_bill_no
and x4.settle_bill_no=x2.settle_bill_no
and FIND_IN_SET(x4.`bill_code`,#{params.billCode})
)
<!--
AND apply_seq_no IN (
SELECT x1.apply_seq_no FROM
emis_settle_invoice_record x1,
emis_settle_bill x2
WHERE
x1.del_flag = '0'
AND x2.del_flag = '0'
AND FIND_IN_SET( x2.settle_bill_no, x1.settle_bill_no )
AND exists (
select 1 from emis_settle_sub_bill b
where x2.settle_bill_no=b.settle_bill_no
and ( FIND_IN_SET(b.`bill_code`,#{params.billCode}) )
)
)
-->
</if>
<if test="params.beginApplyDate != null and params.beginApplyDate != ''">
and apply_date <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endApplyDate != null and params.endApplyDate != ''">
and apply_date <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != ''">
and create_time <![CDATA[ >= ]]> #{params.beginCreateTime}
</if>
<if test="params.endCreateTime != null and params.endCreateTime != ''">
and create_time <![CDATA[ <= ]]> #{params.endCreateTime}
</if>
<if test="params.privSiteCode != null and params.privSiteCode != '88888'">
and EXISTS(
select 1 from emis_settle_bill x2,emis_settle_invoice_bill_rel x3
where x2.del_flag = '0' and x3.del_flag = '0'
and a.apply_seq_no=x3.apply_seq_no and x2.settle_bill_no=x3.settle_bill_no
AND (
x2.salesmen = #{params.privEmpName}
OR x2.payee = #{params.privEmpName}
OR x2.salesmen IN (
SELECT salesmen
FROM emis_salesmen_rel esr
where esr.del_flag='0' and esr.bl_open='1'
and now() <![CDATA[ >= ]]> esr.start_date and now() <![CDATA[ <= ]]> esr.end_date
and esr.sales_ass = #{params.privEmpName}
)
)
)
</if>
</where>
order by create_time desc
</select>
<select id="selectInvoiceRecordListBySettleBillNo" parameterType="String" resultMap="EmisSettleInvoiceRecordResult">
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, contact, phone, real_tax_type, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_settle_invoice_record a
where del_flag = '0' and FIND_IN_SET( a.settle_bill_no,#{settleBillNo} )
</select>
<select id="selectInvoiceRecordByApplySeqNo" parameterType="String" resultMap="EmisSettleInvoiceRecordResult">
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, company_name, company_tax_no, company_tel, company_address, bank_name, bank_acc_no, contact, phone, real_tax_type, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_settle_invoice_record a
where a.apply_seq_no = #{applySeqNo}
</select>
<!-- 检查是否有重复太抬头开票,未审核 -->
<select id="checkOpenBillRepeat" parameterType="EmisSettleInvoiceRecord" resultType="int">
select count(1) from emis_settle_invoice_record
where del_flag='0'
and settle_bill_no = #{settleBillNo}
and apply_money = #{applyMoney}
and invoice_type = #{invoiceType}
and company_tax_no = #{companyTaxNo}
<if test="remark != null and remark != ''">
and remark = #{remark}
</if>
and bl_audit = '0'
limit 1
</select>
<select id="checkUnique" parameterType="EmisSettleInvoiceRecord" resultType="int">
select count(1) from emis_settle_invoice_record
where del_flag='0'
and id = #{id}
and apply_seq_no = #{applySeqNo}
and apply_date = #{applyDate}
and apply_man_code = #{applyManCode}
and apply_site_code = #{applySiteCode}
and customer_code = #{customerCode}
and customer_name = #{customerName}
and settle_bill_no = #{settleBillNo}
and settle_bill_name = #{settleBillName}
and apply_money = #{applyMoney}
and invoice_type = #{invoiceType}
and company_name = #{companyName}
and company_tax_no = #{companyTaxNo}
and company_tel = #{companyTel}
and company_address = #{companyAddress}
and bank_name = #{bankName}
and bank_acc_no = #{bankAccNo}
and contact = #{contact}
and phone = #{phone}
and real_tax_type = #{realTaxType}
and open_money_max = #{openMoneyMax}
and open_money = #{openMoney}
and invoice_no = #{invoiceNo}
and invoice_status = #{invoiceStatus}
and invoice_status_desc = #{invoiceStatusDesc}
and recieve_address = #{recieveAddress}
and email = #{email}
and file_path = #{filePath}
and remark = #{remark}
and bl_audit = #{blAudit}
and audit_date = #{auditDate}
and audit_man_code = #{auditManCode}
and audit_site_code = #{auditSiteCode}
and op_man_code = #{opManCode}
and op_date = #{opDate}
and op_site_code = #{opSiteCode}
and open_ch_id = #{openChId}
and open_ch_status = #{openChStatus}
and open_ch_status_desc = #{openChStatusDesc}
and open_com_code = #{openComCode}
and del_flag = #{delFlag}
and create_by = #{createBy}
and create_time = #{createTime}
and update_by = #{updateBy}
and update_time = #{updateTime}
and create_site = #{createSite}
and update_site = #{updateSite}
limit 1
</select>
<select id="selectEmisSettleInvoiceRecordById" parameterType="Long" resultMap="EmisSettleInvoiceRecordResult">
select id, apply_seq_no, apply_date, apply_man_code, apply_site_code, customer_code, customer_name, settle_bill_no, settle_bill_name, apply_money, invoice_type, openbill_scope, company_name, company_tax_no, company_tel, company_address, invioce_remark, bank_name, bank_acc_no, contact, phone, real_tax_type, orig_open_money, add_tax_rate, add_open_money, open_money_max, open_money, invoice_no, invoice_status, invoice_status_desc, recieve_address, email, file_path, remark, bl_audit, audit_date, audit_man_code, audit_site_code, audit_note, op_man_code, op_date, op_site_code, open_ch_id, open_ch_status, open_ch_status_desc, open_com_code, del_flag, create_by, create_time, update_by, update_time, create_site, update_site
from emis_settle_invoice_record a
where a.id = #{id}
</select>
<insert id="insertEmisSettleInvoiceRecord" parameterType="EmisSettleInvoiceRecord" useGeneratedKeys="true" keyProperty="id">
insert into emis_settle_invoice_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="applySeqNo != null and applySeqNo != ''">apply_seq_no,</if>
<if test="applyDate != null">apply_date,</if>
<if test="applyManCode != null and applyManCode != ''">apply_man_code,</if>
<if test="applySiteCode != null and applySiteCode != ''">apply_site_code,</if>
<if test="customerCode != null and customerCode != ''">customer_code,</if>
<if test="customerName != null and customerName != ''">customer_name,</if>
<if test="settleBillNo != null and settleBillNo != ''">settle_bill_no,</if>
<if test="settleBillName != null and settleBillName != ''">settle_bill_name,</if>
<if test="applyMoney != null">apply_money,</if>
<if test="invoiceType != null and invoiceType != ''">invoice_type,</if>
<if test="openbillScope != null and openbillScope != ''">openbill_scope,</if>
<if test="companyName != null and companyName != ''">company_name,</if>
<if test="companyTaxNo != null and companyTaxNo != ''">company_tax_no,</if>
<if test="companyTel != null and companyTel != ''">company_tel,</if>
<if test="companyAddress != null and companyAddress != ''">company_address,</if>
<if test="invioceRemark != null and invioceRemark != ''">invioce_remark,</if>
<if test="bankName != null and bankName != ''">bank_name,</if>
<if test="bankAccNo != null and bankAccNo != ''">bank_acc_no,</if>
<if test="contact != null and contact != ''">contact,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="realTaxType != null and realTaxType != ''">real_tax_type,</if>
<if test="origOpenMoney != null">orig_open_money,</if>
<if test="addTaxRate != null">add_tax_rate,</if>
<if test="addOpenMoney != null">add_open_money,</if>
<if test="openMoneyMax != null">open_money_max,</if>
<if test="openMoney != null">open_money,</if>
<if test="invoiceNo != null and invoiceNo != ''">invoice_no,</if>
<if test="invoiceStatus != null and invoiceStatus != ''">invoice_status,</if>
<if test="invoiceStatusDesc != null and invoiceStatusDesc != ''">invoice_status_desc,</if>
<if test="recieveAddress != null and recieveAddress != ''">recieve_address,</if>
<if test="email != null and email != ''">email,</if>
<if test="filePath != null and filePath != ''">file_path,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="blAudit != null and blAudit != ''">bl_audit,</if>
<if test="auditDate != null">audit_date,</if>
<if test="auditManCode != null and auditManCode != ''">audit_man_code,</if>
<if test="auditSiteCode != null and auditSiteCode != ''">audit_site_code,</if>
<if test="auditNote != null and auditNote != ''">audit_note,</if>
<if test="opManCode != null and opManCode != ''">op_man_code,</if>
<if test="opDate != null">op_date,</if>
<if test="opSiteCode != null and opSiteCode != ''">op_site_code,</if>
<if test="openChId != null and openChId != ''">open_ch_id,</if>
<if test="openChStatus != null and openChStatus != ''">open_ch_status,</if>
<if test="openChStatusDesc != null and openChStatusDesc != ''">open_ch_status_desc,</if>
<if test="openComCode != null and openComCode != ''">open_com_code,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="createSite != null and createSite != ''">create_site,</if>
<if test="updateSite != null and updateSite != ''">update_site,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="applySeqNo != null and applySeqNo != ''">#{applySeqNo},</if>
<if test="applyDate != null">#{applyDate},</if>
<if test="applyManCode != null and applyManCode != ''">#{applyManCode},</if>
<if test="applySiteCode != null and applySiteCode != ''">#{applySiteCode},</if>
<if test="customerCode != null and customerCode != ''">#{customerCode},</if>
<if test="customerName != null and customerName != ''">#{customerName},</if>
<if test="settleBillNo != null and settleBillNo != ''">#{settleBillNo},</if>
<if test="settleBillName != null and settleBillName != ''">#{settleBillName},</if>
<if test="applyMoney != null">#{applyMoney},</if>
<if test="invoiceType != null and invoiceType != ''">#{invoiceType},</if>
<if test="openbillScope != null and openbillScope != ''">#{openbillScope},</if>
<if test="companyName != null and companyName != ''">#{companyName},</if>
<if test="companyTaxNo != null and companyTaxNo != ''">#{companyTaxNo},</if>
<if test="companyTel != null and companyTel != ''">#{companyTel},</if>
<if test="companyAddress != null and companyAddress != ''">#{companyAddress},</if>
<if test="invioceRemark != null and invioceRemark != ''">#{invioceRemark},</if>
<if test="bankName != null and bankName != ''">#{bankName},</if>
<if test="bankAccNo != null and bankAccNo != ''">#{bankAccNo},</if>
<if test="contact != null and contact != ''">#{contact},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="realTaxType != null and realTaxType != ''">#{realTaxType},</if>
<if test="origOpenMoney != null">#{origOpenMoney},</if>
<if test="addTaxRate != null">#{addTaxRate},</if>
<if test="addOpenMoney != null">#{addOpenMoney},</if>
<if test="openMoneyMax != null">#{openMoneyMax},</if>
<if test="openMoney != null">#{openMoney},</if>
<if test="invoiceNo != null and invoiceNo != ''">#{invoiceNo},</if>
<if test="invoiceStatus != null and invoiceStatus != ''">#{invoiceStatus},</if>
<if test="invoiceStatusDesc != null and invoiceStatusDesc != ''">#{invoiceStatusDesc},</if>
<if test="recieveAddress != null and recieveAddress != ''">#{recieveAddress},</if>
<if test="email != null and email != ''">#{email},</if>
<if test="filePath != null and filePath != ''">#{filePath},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="blAudit != null and blAudit != ''">#{blAudit},</if>
<if test="auditDate != null">#{auditDate},</if>
<if test="auditManCode != null and auditManCode != ''">#{auditManCode},</if>
<if test="auditSiteCode != null and auditSiteCode != ''">#{auditSiteCode},</if>
<if test="auditNote != null and auditNote != ''">#{auditNote},</if>
<if test="opManCode != null and opManCode != ''">#{opManCode},</if>
<if test="opDate != null">#{opDate},</if>
<if test="opSiteCode != null and opSiteCode != ''">#{opSiteCode},</if>
<if test="openChId != null and openChId != ''">#{openChId},</if>
<if test="openChStatus != null and openChStatus != ''">#{openChStatus},</if>
<if test="openChStatusDesc != null and openChStatusDesc != ''">#{openChStatusDesc},</if>
<if test="openComCode != null and openComCode != ''">#{openComCode},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="createSite != null and createSite != ''">#{createSite},</if>
<if test="updateSite != null and updateSite != ''">#{updateSite},</if>
</trim>
</insert>
<insert id="insertInvoiceRecordBillRel">
insert into emis_settle_invoice_bill_rel(apply_seq_no,settle_bill_no)
values(#{applySeqNo},#{settleBillNo})
</insert>
<update id="updateEmisSettleInvoiceRecord" parameterType="EmisSettleInvoiceRecord">
update emis_settle_invoice_record
<trim prefix="SET" suffixOverrides=",">
<if test="applyDate != null">apply_date = #{applyDate},</if>
<if test="applyManCode != null and applyManCode != ''">apply_man_code = #{applyManCode},</if>
<if test="applySiteCode != null and applySiteCode != ''">apply_site_code = #{applySiteCode},</if>
<if test="customerCode != null and customerCode != ''">customer_code = #{customerCode},</if>
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
<if test="settleBillNo != null and settleBillNo != ''">settle_bill_no = #{settleBillNo},</if>
<if test="settleBillName != null and settleBillName != ''">settle_bill_name = #{settleBillName},</if>
<if test="applyMoney != null">apply_money = #{applyMoney},</if>
<if test="invoiceType != null and invoiceType != ''">invoice_type = #{invoiceType},</if>
<if test="openbillScope != null and openbillScope != ''">openbill_scope = #{openbillScope},</if>
<if test="companyName != null and companyName != ''">company_name = #{companyName},</if>
<if test="companyTaxNo != null and companyTaxNo != ''">company_tax_no = #{companyTaxNo},</if>
<if test="companyTel != null and companyTel != ''">company_tel = #{companyTel},</if>
<if test="companyAddress != null and companyAddress != ''">company_address = #{companyAddress},</if>
<if test="invioceRemark != null and invioceRemark != ''">invioce_remark = #{invioceRemark},</if>
<if test="bankName != null and bankName != ''">bank_name = #{bankName},</if>
<if test="bankAccNo != null and bankAccNo != ''">bank_acc_no = #{bankAccNo},</if>
<if test="contact != null and contact != ''">contact = #{contact},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="realTaxType != null and realTaxType != ''">real_tax_type = #{realTaxType},</if>
<if test="origOpenMoney != null">orig_open_money = #{origOpenMoney},</if>
<if test="addTaxRate != null">add_tax_rate = #{addTaxRate},</if>
<if test="addOpenMoney != null">add_open_money = #{addOpenMoney},</if>
<if test="openMoneyMax != null">open_money_max = #{openMoneyMax},</if>
<if test="openMoney != null">open_money = #{openMoney},</if>
<if test="invoiceNo != null and invoiceNo != ''">invoice_no = #{invoiceNo},</if>
<if test="invoiceStatus != null and invoiceStatus != ''">invoice_status = #{invoiceStatus},</if>
<if test="invoiceStatusDesc != null and invoiceStatusDesc != ''">invoice_status_desc = #{invoiceStatusDesc},</if>
<if test="recieveAddress != null and recieveAddress != ''">recieve_address = #{recieveAddress},</if>
<if test="email != null and email != ''">email = #{email},</if>
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="blAudit != null and blAudit != ''">bl_audit = #{blAudit},</if>
<if test="auditDate != null">audit_date = #{auditDate},</if>
<if test="auditManCode != null and auditManCode != ''">audit_man_code = #{auditManCode},</if>
<if test="auditSiteCode != null and auditSiteCode != ''">audit_site_code = #{auditSiteCode},</if>
<if test="auditNote != null and auditNote != ''">audit_note = #{auditNote},</if>
<if test="opManCode != null and opManCode != ''">op_man_code = #{opManCode},</if>
<if test="opDate != null">op_date = #{opDate},</if>
<if test="opSiteCode != null and opSiteCode != ''">op_site_code = #{opSiteCode},</if>
<if test="openChId != null and openChId != ''">open_ch_id = #{openChId},</if>
<if test="openChStatus != null and openChStatus != ''">open_ch_status = #{openChStatus},</if>
<if test="openChStatusDesc != null and openChStatusDesc != ''">open_ch_status_desc = #{openChStatusDesc},</if>
<if test="openComCode != null and openComCode != ''">open_com_code = #{openComCode},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createSite != null and createSite != ''">create_site = #{createSite},</if>
<if test="updateSite != null and updateSite != ''">update_site = #{updateSite},</if>
</trim>
where id = #{id}
</update>
<update id="auditCenterPass" parameterType="EmisSettleInvoiceRecord">
update emis_settle_invoice_record
set bl_audit='1',
invoice_status='1',
audit_date=now(),
audit_man_code = #{auditManCode},
audit_site_code = #{auditSiteCode}
where id = #{id}
</update>
<update id="updateHasPayByApplySeqNo" parameterType="string">
update emis_settle_invoice_record
set payment_status='1'
where apply_seq_no = #{applySeqNo}
</update>
<update id="auditCenterNoPass" parameterType="EmisSettleInvoiceRecord">
update emis_settle_invoice_record
set bl_audit='2',
invoice_status='3',
audit_note = #{auditNote},
audit_date=now(),
audit_man_code = #{auditManCode},
audit_site_code = #{auditSiteCode}
where id = #{id}
</update>
<delete id="deleteEmisSettleInvoiceRecordById" parameterType="Long">
update emis_settle_invoice_record where id = #{id}
</delete>
<delete id="deleteEmisSettleInvoiceRecordByIds" parameterType="String">
delete from emis_settle_invoice_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>