You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
736 lines
38 KiB
736 lines
38 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
<mapper namespace="com.dxhy.core.dao.FpxxZhDao">
|
|
|
|
<resultMap id="BaseResultMap"
|
|
type="com.dxhy.core.model.FpRzRespVO">
|
|
<result column="invoice_code" property="invoiceCode"/>
|
|
<result column="invoice_no" property="invoiceNo"/>
|
|
<result column="kprq" property="invoiceDate"/>
|
|
<result column="invoice_type" property="invoiceType"/>
|
|
<result column="gfsh" property="gfsh"/>
|
|
<result column="gfmc" property="gfmc"/>
|
|
<result column="xf_tax_no" property="xfsh"/>
|
|
<result column="xf_name" property="xfmc"/>
|
|
<result column="invoice_amount" property="invoiceAmount"/>
|
|
<result column="tax_amount" property="taxAmount"/>
|
|
<result column="dk_tax_amount" property="dkTaxAmount"/>
|
|
<result column="invoice_status" property="invoiceStatus"/>
|
|
<result column="rzh_date" property="rzsj"/>
|
|
<result column="qs_date" property="qsrq"/>
|
|
<result column="rzh_type" property="rzhType"/>
|
|
<result column="dqskssq" property="skssq"/>
|
|
<result column="auth_status" property="rzclzt"/>
|
|
<result column="qs_type" property="qsfs"/>
|
|
<result column="qs_status" property="qszt"/>
|
|
<result column="confirm_user" property="rzr"/>
|
|
<result column="qs_name" property="qsr"/>
|
|
<result column="rzh_yesorno" property="rzzt"/>
|
|
<result column="deptId" property="deptId"/>
|
|
<result column="deptName" property="businessName"/>
|
|
<result column="cxrz_status" property="cxrzStatus"/>
|
|
<result column="bdk_status" property="bdkStatus"/>
|
|
<result column="export_mark" property="exportMark"/>
|
|
<result column="voucher_number" property="voucherNumber"/>
|
|
<result column="ele_invoice_no" property="eleInvoiceNo"/>
|
|
<result column="bzdh" property="bzdh"/>
|
|
<result column="bzr" property="bzr"/>
|
|
<result column="inaccount_status" property="inAccountStatus"/>
|
|
<result column="comp_code" property="compCode"/>
|
|
<result column="account_period" property="accountPeriod"/>
|
|
<result column="image_id" property="imageNumber"/>
|
|
<result column="posting_time" property="postingTime"/>
|
|
<result column="sn_voucher_number" property="snVoucherNumber"/>
|
|
<result column="tax_rate" property="taxRate"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="RzcxhjResultMap"
|
|
type="com.dxhy.core.model.FpRzRespVO">
|
|
<result column="hjsl" property="id"/>
|
|
<result column="hjje" property="invoiceAmount"/>
|
|
<result column="hjse" property="taxAmount"/>
|
|
</resultMap>
|
|
|
|
<resultMap id="authenticationListMap"
|
|
type="com.dxhy.core.model.AuthenticationCheckListVO">
|
|
<result column="id" jdbcType="BIGINT" property="id"/>
|
|
<result column="invoice_code" jdbcType="VARCHAR" property="invoiceCode"/>
|
|
<result column="invoice_no" jdbcType="VARCHAR" property="invoiceNo"/>
|
|
<result column="invoice_type" jdbcType="VARCHAR" property="invoiceType"/>
|
|
<result column="invoice_status" jdbcType="VARCHAR" property="invoiceStatus"/>
|
|
<result column="invoice_date" jdbcType="TIMESTAMP" property="invoiceDate"/>
|
|
<result column="gf_tax_no" jdbcType="VARCHAR" property="buyerTax"/>
|
|
<result column="gf_name" jdbcType="VARCHAR" property="buyerName"/>
|
|
<result column="xf_tax_no" jdbcType="VARCHAR" property="sellerTax"/>
|
|
<result column="xf_name" jdbcType="VARCHAR" property="sellerName"/>
|
|
<result column="invoice_amount" jdbcType="VARCHAR" property="invoiceAmount"/>
|
|
<result column="tax_amount" jdbcType="VARCHAR" property="taxAmount"/>
|
|
<result column="qs_status" jdbcType="VARCHAR" property="signInStatus"/>
|
|
<result column="qs_date" jdbcType="TIMESTAMP" property="signInDate"/>
|
|
<result column="qs_type" jdbcType="VARCHAR" property="signInType"/>
|
|
<result column="qs_name" jdbcType="VARCHAR" property="signInPeople"/>
|
|
<result column="rzh_date" jdbcType="TIMESTAMP" property="authenticationDate"/>
|
|
<result column="rzh_yesorno" jdbcType="VARCHAR" property="authenticationStatus"/>
|
|
<result column="auth_status" jdbcType="VARCHAR" property="authenticationDetailStatus"/>
|
|
<result column="rzlx" jdbcType="VARCHAR" property="authenticationType"/>
|
|
<result column="gx_user_name" jdbcType="VARCHAR" property="authenticationPerson"/>
|
|
<result column="rzh_belong_date" jdbcType="VARCHAR" property="taxPeriod"/>
|
|
<result column="dept_id" jdbcType="VARCHAR" property="deptId"/>
|
|
<result column="sn_voucher_number" jdbcType="VARCHAR" property="snVoucherNumber"/>
|
|
<result column="account_period" jdbcType="VARCHAR" property="accountPeriod"/>
|
|
<result column="posting_time" jdbcType="VARCHAR" property="postingTime"/>
|
|
<result column="inaccount_status" jdbcType="VARCHAR" property="inaccountStatus"/>
|
|
<result column="image_id" jdbcType="VARCHAR" property="imageNumber"/>
|
|
<result column="comp_code" jdbcType="VARCHAR" property="compCode"/>
|
|
<result column="bzdh" jdbcType="VARCHAR" property="bzdh"/>
|
|
<result column="bzr" jdbcType="VARCHAR" property="bzr"/>
|
|
</resultMap>
|
|
|
|
<sql id="Authentication_Check_Column_List">
|
|
t.id,invoice_code,invoice_no,invoice_type,invoice_status,DATE_FORMAT(invoice_date,'%Y-%m-%d') invoice_date,gf_tax_no,gf_name,xf_tax_no,xf_name,invoice_amount,tax_amount,qs_status,date_format(qs_date,'%Y-%m-%d') qs_date,qs_type,qs_name,date_format(rzh_date,'%Y-%m-%d') rzh_date,rzh_yesorno,auth_status,rzlx,gx_user_name,rzh_belong_date,b.business_name dept_id,sn_voucher_number,posting_time,image_id,account_period,bzdh,bzr,inaccount_status,comp_code
|
|
</sql>
|
|
|
|
<select id="selectByPramsMap" parameterType="java.util.Map"
|
|
resultMap="BaseResultMap" databaseId="mysql">
|
|
select
|
|
t.invoice_code,t.invoice_no,t.invoice_type,DATE_FORMAT(t.invoice_date,'%Y-%m-%d')kprq,t.gf_tax_no
|
|
gfsh,t.gf_name
|
|
gfmc,t.dept_id deptId,t.dept_name deptName,t.bzdh,t.bzr,
|
|
t.xf_tax_no,t.xf_name,t.tax_amount,t.dk_tax_amount,t.invoice_status,t.invoice_amount,
|
|
date_format(t.rzh_date,'%Y-%m-%d') rzh_date,date_format(t.qs_date, '%Y-%m-%d')
|
|
qs_date,t.rzh_type,t.sn_voucher_number,t.posting_time,t.image_id,t.account_period,comp_code,
|
|
t.gx_user_name,t.rzh_belong_date
|
|
dqskssq,t.auth_status,t.qs_type,t.qs_status,t.confirm_user,t.qs_name,t.rzh_yesorno,t.cxrz_status,t.bdk_status, t.ele_invoice_no,
|
|
t.export_mark,t.inaccount_status,t.payment_status,DATE_FORMAT(t.payment_date,'%Y-%m-%d')payment_date,t.voucher_number,t.tax_rate
|
|
from t_dx_record_invoice t
|
|
WHERE t.invoice_date between #{kpksrq} and #{kpjsrq}
|
|
and t.invoice_type in ('01','03','08','14','31','283','161','183','185')
|
|
and t.export_mark = '0'
|
|
and t.auth_status in ('0','2','3','4','5','6')
|
|
and t.company = #{company}
|
|
and t.gf_tax_no = #{gfsh}
|
|
and t.comp_code = #{companyCode}
|
|
|
|
<if test="rzclzt != null and rzclzt != '0'.toString() and rzclzt != '6'.toString()">
|
|
and t.bdk_status in ('1','2')
|
|
</if>
|
|
<if test="rzclzt != null and (rzclzt == '0'.toString() or rzclzt == '6'.toString())">
|
|
AND t.inaccount_status = '1'
|
|
AND t.rzh_yesorno = '0'
|
|
<if test=" bzdh == ''">
|
|
and t.bzdh is not null
|
|
</if>
|
|
</if>
|
|
<if test="invoiceStatus != null and invoiceStatus != '' and invoiceStatus != 'null' ">
|
|
and t.invoice_status = #{invoiceStatus}
|
|
</if>
|
|
<if test="voucherNumber != null and voucherNumber != ''">
|
|
and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
|
|
</if>
|
|
<if test="bzdh != null and bzdh != '' and bzdh != 'null'">
|
|
and t.bzdh = #{bzdh}
|
|
</if>
|
|
<if test="bzr != null and bzr != '' and bzr != 'null'">
|
|
and t.bzr like concat('%',#{bzr},'%')
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()">
|
|
and t.inaccount_status = #{inAccountStatus}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
|
|
and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null)
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
|
|
and t.qs_status = #{qszt}
|
|
</if>
|
|
<if test="qsfs != null and qsfs != '' and qsfs != 'null'">
|
|
and t.qs_type = #{qsfs}
|
|
</if>
|
|
<if test="wrzfpStart != null and wrzfpStart != '' and wrzfpStart != 'null' and wrzfpEnd != null and wrzfpEnd != '' and wrzfpEnd != 'null'">
|
|
and rzh_yesorno = '0' and date_format(t.invoice_date,'%Y-%m-%d') between #{wrzfpStart} and #{wrzfpEnd}
|
|
</if>
|
|
<if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
|
|
and t.qs_date between #{qsksrq} and #{qsjsrq}
|
|
</if>
|
|
<if test="rzksrq != null and rzksrq != '' and rzksrq != 'null' and rzjsrq != null and rzjsrq != '' and rzjsrq != 'null'">
|
|
and t.rzh_date between #{rzksrq} and #{rzjsrq}
|
|
</if>
|
|
<if test="rzzt != null and rzzt != '' and rzzt != 'null' and rzzt != '3'">
|
|
and t.rzh_yesorno = #{rzzt}
|
|
</if>
|
|
<if test="rzzt != null and rzzt != '' and rzzt != 'null' and rzzt == '3'">
|
|
and (t.rzh_yesorno = '1' or t.rzh_yesorno = '2')
|
|
</if>
|
|
<if test="imageId != null and imageId != '' and imageId != 'null' ">
|
|
and t.image_id = #{imageId}
|
|
</if>
|
|
<if test="rzclzt !=null and rzclzt != ''">
|
|
and t.auth_status = #{rzclzt}
|
|
</if>
|
|
<if test="rzlx!=null and rzlx!=''">
|
|
and t.bdk_status = #{rzlx}
|
|
</if>
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
|
|
and (t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08') )
|
|
</if>
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' ">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
<if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
|
|
and t.ele_invoice_no = #{eleInvoiceNo}
|
|
</if>
|
|
<if
|
|
test="qsfs != null and qsfs != '' and qsfs != 'null' ">
|
|
and t.qs_type = #{qsfs}
|
|
</if>
|
|
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
|
|
and t.xf_name like concat(#{xfmc},'%')
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and t.qs_name = #{qsr}
|
|
</if>
|
|
<if test="rzhr != null and rzhr != '' and rzhr != 'null' ">
|
|
and t.confirm_user in
|
|
<foreach collection="rzhr" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if
|
|
test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
|
|
and t.invoice_no = #{invoiceNo}
|
|
</if>
|
|
<if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
|
|
<![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
|
|
</if>
|
|
<if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
|
|
<![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') <= #{paymentDateEnd} ]]>
|
|
</if>
|
|
<if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
|
|
and t.payment_status = #{paymentStatus}
|
|
</if>
|
|
<if
|
|
test="skssq != null and skssq != '' and skssq != 'null' ">
|
|
and t.rzh_belong_date = #{skssq}
|
|
</if>
|
|
<if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' ">
|
|
and t.sn_voucher_number = #{snVoucherNumber}
|
|
</if>
|
|
<if
|
|
test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
|
|
and t.dept_id = #{businessCode}
|
|
</if>
|
|
<if test="businessCode==''">
|
|
and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
|
|
</if>
|
|
<if test='businessCode == "99" and business!=null and business.size()>0'>
|
|
and (t.dept_id in
|
|
<foreach collection="business" index="index" item="item" open="(" separator="," close="">
|
|
#{item.businessCode}
|
|
</foreach>
|
|
) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
|
|
</if>
|
|
<!-- <if test='inAccountStatus!=null and inAccountStatus!="" and inAccountStatus !="99"'>-->
|
|
<!-- and t.in_account_status = #{inAccountStatus}-->
|
|
<!-- </if>-->
|
|
<if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
|
|
and t.sn_voucher_number = #{snVoucherNumber}
|
|
</if>
|
|
<if test="postingTimeStart != null and postingTimeEnd != null and postingTimeStart != '' and postingTimeEnd != ''">
|
|
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
|
|
</if>
|
|
<if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
|
|
and t.image_id = #{imageNumber}
|
|
</if>
|
|
<if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
|
|
and t.account_period = #{accountPeriod}
|
|
</if>
|
|
<if test="taxRate!=null and taxRate!='' and taxRate!='多税率' and taxRate != null and taxRate !='99'">
|
|
and t.tax_rate = #{taxRate}
|
|
</if>
|
|
<if test="taxRate=='多税率'">
|
|
and t.tax_rate like '%,%'
|
|
</if>
|
|
order by t.rzh_date desc,t.invoice_date desc
|
|
</select>
|
|
<select id="selectByPramsMap" parameterType="java.util.Map"
|
|
resultMap="BaseResultMap" databaseId="oracle">
|
|
select
|
|
t.invoice_code,t.invoice_no,t.invoice_type,to_char(t.invoice_date,'yyyy-mm-dd') kprq,
|
|
t.gf_tax_no gfsh,t.gf_name gfmc,t.dept_id deptId,t.dept_name deptName,
|
|
t.xf_tax_no,t.xf_name,t.tax_amount,t.dk_tax_amount,t.invoice_status,t.invoice_amount,
|
|
to_char(t.rzh_date,'yyyy-mm-dd') rzh_date,to_char(t.qs_date,'yyyy-mm-dd')
|
|
qs_date,t.rzh_type,t.id
|
|
id,t.ele_invoice_no,
|
|
t.gx_user_name,t.rzh_belong_date
|
|
dqskssq,t.auth_status,t.qs_type,t.qs_status,t.confirm_user,t.qs_name,t.rzh_yesorno,t.cxrz_status,t.bdk_status,
|
|
t.export_mark,t.in_account_status,t.payment_status,to_date(t.payment_date,'yyyy-mm-dd')payment_date
|
|
from t_dx_record_invoice t
|
|
where t.invoice_date between to_date(#{kpksrq},'yyyy-mm-dd hh24:mi:ss') and
|
|
to_date(#{kpjsrq},'yyyy-mm-dd
|
|
hh24:mi:ss')
|
|
and t.auth_status != '0'
|
|
and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
|
|
and t.bdk_status in ('1','2')
|
|
and t.export_mark = '0'
|
|
and t.gf_tax_no in
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if
|
|
test="invoiceStatus != null and invoiceStatus != '' and invoiceStatus != 'null' and invoiceStatus != '99' ">
|
|
and t.invoice_status = #{invoiceStatus}
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99' ">
|
|
and t.qs_status = #{qszt}
|
|
</if>
|
|
<if test="rzzt != null and rzzt != '' and rzzt != 'null' and rzzt != '99' ">
|
|
and t.rzh_yesorno = #{rzzt}
|
|
</if>
|
|
<if
|
|
test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
|
|
and t.qs_date between to_date(#{qsksrq},'yyyy-mm-dd hh24:mi:ss') and
|
|
to_date(#{qsjsrq},'yyyy-mm-dd
|
|
hh24:mi:ss')
|
|
</if>
|
|
<if
|
|
test="rzksrq != null and rzksrq != '' and rzksrq != 'null' and rzjsrq != null and rzjsrq != '' and rzjsrq != 'null'">
|
|
and t.rzh_date between to_date(#{rzksrq},'yyyy-mm-dd hh24:mi:ss') and
|
|
to_date(#{rzjsrq},'yyyy-mm-dd
|
|
hh24:mi:ss')
|
|
</if>
|
|
<if test="rzclzt != null and rzclzt != '' and rzclzt != 'null' and rzclzt != '99' ">
|
|
and t.auth_status = #{rzclzt}
|
|
</if>
|
|
<if test="rzlx !=null and rzlx != ''">
|
|
and t.bdk_status = #{rzlx}
|
|
</if>
|
|
<if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
|
|
<![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
|
|
</if>
|
|
<if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
|
|
<![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') <= #{paymentDateEnd} ]]>
|
|
</if>
|
|
<if test="paymentStatus != null and paymentStatus != '' and map.paymentStatus != '99'">
|
|
and t.payment_status = #{paymentStatus}
|
|
</if>
|
|
<if
|
|
test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
<if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
|
|
and t.ele_invoice_no = #{eleInvoiceNo}
|
|
</if>
|
|
<if
|
|
test="qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'">
|
|
and t.qs_type = #{qsfs}
|
|
</if>
|
|
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
|
|
and t.xf_name like CONCAT(#{xfmc},'%')
|
|
</if>
|
|
<if test="rzhr != null and rzhr != '' and rzhr != 'null' ">
|
|
and t.confirm_user in
|
|
<foreach collection="rzhr" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if
|
|
test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
|
|
and t.invoice_no = #{invoiceNo}
|
|
</if>
|
|
<if
|
|
test="skssq != null and skssq != '' and skssq != 'null' ">
|
|
and t.rzh_belong_date = #{skssq}
|
|
</if>
|
|
<if
|
|
test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
|
|
and t.dept_id = #{businessCode}
|
|
</if>
|
|
<if test="businessCode==''">
|
|
and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
|
|
</if>
|
|
<if test='businessCode == "99" and business!=null and business.size()>0'>
|
|
and (t.dept_id in
|
|
<foreach collection="business" index="index" item="item" open="(" separator="," close="">
|
|
#{item.businessCode}
|
|
</foreach>
|
|
) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
|
|
</if>
|
|
<if test='inAccountStatus != null and inAccountStatus !="" and inAccountStatus!="99"'>
|
|
and t.in_account_status = #{inAccountStatus}
|
|
</if>
|
|
<if test="company !=null and company !=''">
|
|
and t.company = #{company}
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and t.qs_name = #{qsr}
|
|
</if>
|
|
order by t.rzh_date desc,t.invoice_date desc
|
|
</select>
|
|
|
|
|
|
<select id="selectTaxRebateByPramsMap"
|
|
parameterType="java.util.Map"
|
|
resultMap="authenticationListMap" databaseId="mysql">
|
|
select
|
|
<include refid="Authentication_Check_Column_List"/>
|
|
from t_dx_record_invoice t
|
|
WHERE date_format(t.invoice_date,'%Y-%m-%d') between #{invoiceStartTime} and #{invoiceEndTime}
|
|
and (t.rzlx = '2' or t.rzlx = '3')
|
|
and t.export_mark = '0'
|
|
and t.gf_tax_no in
|
|
<foreach collection="taxNoList" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="companyCode != null and companyCode != ''">
|
|
and t.comp_code = #{companyCode}
|
|
</if>
|
|
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
|
|
and t.invoice_no = #{invoiceNo}
|
|
</if>
|
|
<if test="invoiceType != '99'">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="invoiceSource != null and invoiceSource != '' and invoiceSource != 'null' and invoiceSource != '99' ">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
<if test="invoiceStatus != '99'">
|
|
and t.invoice_status = #{invoiceStatus}
|
|
</if>
|
|
<if test="authenticationStatus != '99'">
|
|
and t.rzh_yesorno = #{authenticationStatus}
|
|
</if>
|
|
<if test='authenticationStatus == "1"'>
|
|
and date_format(t.rzh_date,'%Y-%m-%d') between #{authenticationStartTime} and
|
|
#{authenticationEndTime}
|
|
</if>
|
|
<if test="authenticationDetailStatus != '99'">
|
|
and t.auth_status = #{authenticationDetailStatus}
|
|
</if>
|
|
<if
|
|
test="authenticationPeople != null and authenticationPeople != '' and authenticationPeople != 'null'">
|
|
and t.gx_user_name like concat(#{authenticationPeople},'%')
|
|
</if>
|
|
<if test="currentPeriod != null and currentPeriod != '' and currentPeriod != 'null'">
|
|
and t.rzh_belong_date = #{currentPeriod}
|
|
</if>
|
|
<if test="sellerName != null and sellerName != '' and sellerName != 'null' ">
|
|
and t.xf_name like concat(#{sellerName},'%')
|
|
</if>
|
|
<if test="signInStatus != '99'">
|
|
and t.qs_status = #{signInStatus}
|
|
</if>
|
|
<if test='signInStatus == "1"'>
|
|
and date_format(t.qs_date,'%Y-%m-%d') between #{signInStartTime} and #{signInEndTime}
|
|
</if>
|
|
<if test="signInType != '99'">
|
|
and t.qs_type = #{signInType}
|
|
</if>
|
|
<if test="signInPerson != '' and signInPerson != null and signInPerson != 'null'">
|
|
and t.qs_name =#{signInPerson}
|
|
</if>
|
|
<if test="company !=null and company!=''">
|
|
and t.company = #{company}
|
|
</if>
|
|
order by t.qs_date desc,t.invoice_date desc
|
|
</select>
|
|
<select id="selectTaxRebateByPramsMap"
|
|
parameterType="java.util.Map"
|
|
resultMap="authenticationListMap" databaseId="oracle">
|
|
select
|
|
t.id,invoice_code,invoice_no,invoice_type,invoice_status,to_char(invoice_date,'yyyy-mm-dd')
|
|
invoice_date,
|
|
gf_tax_no,gf_name,xf_tax_no,xf_name,invoice_amount,tax_amount,qs_status,to_char(qs_date,'yyyy-mm-dd')
|
|
qs_date,
|
|
qs_type,qs_name,to_char(rzh_date,'yyyy-mm-dd')
|
|
rzh_date,rzh_yesorno,auth_status,rzlx,gx_user_name,
|
|
rzh_belong_date,b.business_name dept_id
|
|
from t_dx_record_invoice t
|
|
WHERE to_char(t.invoice_date,'yyyy-mm-dd') between #{invoiceStartTime} and #{invoiceEndTime}
|
|
and (t.rzlx = '2' or t.rzlx = '3')
|
|
and t.export_mark = '0'
|
|
and t.gf_tax_no in
|
|
<foreach collection="taxNoList" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
|
|
and t.invoice_no = #{invoiceNo}
|
|
</if>
|
|
<if test="invoiceType != '99' and invoiceType!='' and invoiceType!='null' and invoiceType!=null">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="invoiceSource != null and invoiceSource != '' and invoiceSource != 'null' and invoiceSource != '99' ">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
<if test="invoiceStatus != '99'">
|
|
and t.invoice_status = #{invoiceStatus}
|
|
</if>
|
|
<if test="authenticationStatus != '99'">
|
|
and t.rzh_yesorno = #{authenticationStatus}
|
|
</if>
|
|
<if test='authenticationStatus == "1"'>
|
|
and to_char(t.rzh_date,'yyyy-mm-dd') between #{rzksrq} and #{rzjsrq}
|
|
</if>
|
|
<if test="authenticationDetailStatus != '99'">
|
|
and t.auth_status = #{authenticationDetailStatus}
|
|
</if>
|
|
<if
|
|
test="authenticationPeople != null and authenticationPeople != '' and authenticationPeople != 'null'">
|
|
and t.gx_user_name like concat(#{authenticationPeople},'%')
|
|
</if>
|
|
<if test="deptId != null and deptId != '' and deptId != 'null' and deptId != '99' ">
|
|
and t.dept_id = #{deptId}
|
|
</if>
|
|
<if test="deptId == ''">
|
|
and t.dept_id is null
|
|
</if>
|
|
<if test="currentPeriod != null and currentPeriod != '' and currentPeriod != 'null'">
|
|
and t.rzh_belong_date = #{currentPeriod}
|
|
</if>
|
|
<if test="sellerName != null and sellerName != '' and sellerName != 'null' ">
|
|
and t.xf_name like concat(#{sellerName},'%')
|
|
</if>
|
|
<if test="signInStatus != '99'">
|
|
and t.qs_status = #{signInStatus}
|
|
</if>
|
|
<if test='signInStatus == "1"'>
|
|
and to_char(t.qs_date,'yyyy-mm-dd') between #{signInStartTime} and #{signInEndTime}
|
|
</if>
|
|
<if test="signInType != '99'">
|
|
and t.qs_type = #{signInType}
|
|
</if>
|
|
<if test="signInPerson != '' and signInPerson != null and signInPerson != 'null'">
|
|
and t.qs_name =#{signInPerson}
|
|
</if>
|
|
<if test="company !=null and company!=''">
|
|
and t.company = #{company}
|
|
</if>
|
|
order by t.qs_date desc,t.invoice_date desc
|
|
</select>
|
|
|
|
<resultMap id="SggxcxResultMap" type="com.dxhy.core.model.FpRzRespVO">
|
|
<result column="id" property="id"/>
|
|
<result column="dept_name" property="deptName"/>
|
|
<result column="invoice_code" property="invoiceCode"/>
|
|
<result column="invoice_no" property="invoiceNo"/>
|
|
<result column="gf_name" property="gfName"/>
|
|
<result column="gf_tax_no" property="gfTaxNo"/>
|
|
<result column="xf_name" property="xfName"/>
|
|
<result column="invoice_date" property="invoiceDate"/>
|
|
<result column="invoice_amount" property="invoiceAmount"/>
|
|
<result column="dk_tax_amount" property="dkTaxAmount"/>
|
|
<result column="tax_amount" property="taxAmount"/>
|
|
<result column="qs_date" property="qsDate"/>
|
|
<result column="qs_type" property="qsType"/>
|
|
<result column="qs_status" property="qsStatus"/>
|
|
<result column="dept_id" property="deptId"/>
|
|
<result column="invoice_type" property="invoiceType"/>
|
|
<result column="qs_name" property="qsName"/>
|
|
<result column="invoice_status" property="invoiceStatus"/>
|
|
<result column="authStatus" property="authStatus"/>
|
|
<result column="inaccount_status" property="inAccountStatus"/>
|
|
<result column="payment_date" property="paymentDate"/>
|
|
<result column="payment_status" property="paymentStatus"/>
|
|
<result column="voucher_number" property="voucherNumber"/>
|
|
<result column="sn_voucher_number" property="snVoucherNumber"/>
|
|
<result column="image_id" property="imageNumber"/>
|
|
<result column="tax_amount" property="taxAmount"/>
|
|
<result column="posting_time" property="postingTime"/>
|
|
<result column="account_period" property="accountPeriod"/>
|
|
<result column="ele_invoice_no" property="eleInvoiceNo"/>
|
|
<result column="bzdh" property="bzdh"/>
|
|
<result column="bzr" property="bzr"/>
|
|
<result column="suspend_status" property="suspendStatus"/>
|
|
<result column="suspend_date" property="suspendDate"/>
|
|
<result column="comp_code" property="compCode"/>
|
|
<result column="tax_rate" property="taxRate"/>
|
|
<result column="auth_status" property="authStatus"/>
|
|
</resultMap>
|
|
<select id="selectByparams" parameterType="java.util.Map"
|
|
resultMap="SggxcxResultMap" databaseId="mysql">
|
|
select t.invoice_type,t.dept_id,t.dept_name,t.comp_code
|
|
,t.id,t.invoice_code,t.invoice_no,t.gf_name,t.gf_tax_no,t.xf_name,
|
|
DATE_FORMAT(t.invoice_date,'%Y-%m-%d')invoice_date,t.invoice_amount,t.tax_amount,t.invoice_status,DATE_FORMAT(t.qs_date,'%Y-%m-%d')qs_date
|
|
,t.qs_type,t.qs_status,t.dk_tax_amount,t.qs_name,t.sn_voucher_number,t.posting_time,t.image_id,t.account_period,
|
|
case date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date when
|
|
true then 1
|
|
else 2 end authStatus,t.bzdh,t.bzr,t.suspend_status,t.suspend_date,t.tax_rate,t.auth_status,
|
|
t.inaccount_status,t.payment_status,DATE_FORMAT(t.payment_date,'%Y-%m-%d')payment_date,t.settlement_no,t.ele_invoice_no
|
|
from t_dx_record_invoice t left join t_dx_tax_current c on t.gf_tax_no = c.taxno
|
|
left join t_dx_dk_count d on c.taxno = d.taxno and c.current_tax_period = d.skssq
|
|
WHERE t.invoice_date between #{kpksrq} and #{kpjsrq}
|
|
and (t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
|
|
and t.rzh_yesorno = '0'
|
|
and t.auth_status in('0', '2', '3', '5', '6')
|
|
and t.export_mark = '0'
|
|
and t.inaccount_status = '1'
|
|
and t.company = #{company}
|
|
<if test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '1'.toString()">
|
|
and t.invoice_status in ('0','7')
|
|
and t.invoice_amount>0
|
|
and t.tax_amount>=0
|
|
and date_format(t.invoice_date,'%Y%m%d') between c.select_start_date and c.select_end_date
|
|
and d.tj_status in('0','3')
|
|
</if>
|
|
|
|
<if test="sfkrz != '99' and sfkrz != null and sfkrz != '' and sfkrz != 'null' and sfkrz == '0'.toString()">
|
|
and (t.invoice_status in ('1','2','3','4','8','80') or t.invoice_amount <0 or t.tax_amount <0 or
|
|
date_format(t.invoice_date,'%Y%m%d') <= c.select_start_date or
|
|
date_format(t.invoice_date,'%Y%m%d') >=
|
|
c.select_end_date or d.tj_status in ('1','2'))
|
|
|
|
</if>
|
|
<if test="sign !='88'">
|
|
and t.gf_tax_no in
|
|
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
|
|
<!-- and t.comp_code in-->
|
|
<!-- <foreach collection="companyCodes" index="index" item="companyCode" open="(" close=")" separator=",">-->
|
|
<!-- #{companyCode}-->
|
|
<!-- </foreach>-->
|
|
<if test="companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'">
|
|
and t.comp_code in
|
|
<foreach collection="companyCodes" index="index" item="companyCode" separator="," open="(" close=")">
|
|
#{companyCode}
|
|
</foreach>
|
|
</if>
|
|
|
|
<if test="companyCode != null and companyCode != '99' and companyCode != '88' and companyCode != '' and companyCode != 'null'" >
|
|
and t.comp_code = #{companyCode}
|
|
</if>
|
|
<if test="companyCode != null and companyCode != '' and companyCode == '88'">
|
|
and (t.comp_code = '' or t.comp_code is null)
|
|
</if>
|
|
<if test="qszt != null and qszt != '' and qszt != 'null' and qszt != '99'">
|
|
and t.qs_status = #{qszt}
|
|
</if>
|
|
<if test="bzdh != null and bzdh != '' and bzdh != 'null' and bzdh != '99'">
|
|
and t.bzdh = #{bzdh}
|
|
</if>
|
|
<if test=" bzdh == ''">
|
|
and t.bzdh is not null
|
|
</if>
|
|
<if test="bzr != null and bzr != '' and bzr != 'null'">
|
|
and t.bzr like concat('%',#{bzr},'%')
|
|
</if>
|
|
<if test="rzzt == '0'.toString()">
|
|
and t.auth_status in ('0','6')
|
|
</if>
|
|
<if test="rzzt == '1'.toString()">
|
|
and (t.auth_status = '2' or t.auth_status = '3')
|
|
</if>
|
|
<if test="rzzt == '2'.toString()">
|
|
and t.auth_status = '5'
|
|
</if>
|
|
<if test="suspendStatus != null and suspendStatus != '' and suspendStatus != 'null' and suspendStatus != '99' and suspendStatus == '1'.toString()">
|
|
and t.suspend_status = '1'
|
|
</if>
|
|
<if test="suspendStatus != null and suspendStatus != '' and suspendStatus != 'null' and suspendStatus != '99' and suspendStatus == '0'.toString()">
|
|
and (t.suspend_status = '' or t.suspend_status is null or t.suspend_status = '0')
|
|
</if>
|
|
<if test="suspendDate != null and suspendDate != '' and suspendDate != 'null' ">
|
|
and t.suspend_date = #{suspendDate}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()">
|
|
and t.inaccount_status = #{inAccountStatus}
|
|
</if>
|
|
<if test="inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()">
|
|
and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null)
|
|
</if>
|
|
<if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
|
|
and date_format(t.qs_date,'%Y-%m-%d') between #{qsksrq} and #{qsjsrq}
|
|
</if>
|
|
<if test="voucherNumber != null and voucherNumber != ''">
|
|
and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
|
|
</if>
|
|
<if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
|
|
<![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
|
|
</if>
|
|
<if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
|
|
<![CDATA[ AND date_format(t.payment_date,'%Y-%m-%d') <= #{paymentDateEnd} ]]>
|
|
</if>
|
|
<if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
|
|
and t.payment_status = #{paymentStatus}
|
|
</if>
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType == '14' ">
|
|
and t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08')
|
|
</if>
|
|
<if test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '14' and invoiceType != '99'">
|
|
and t.invoice_type = #{invoiceType}
|
|
</if>
|
|
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='null' and invoiceSource!='99'">
|
|
and t.invoice_source = #{invoiceSource}
|
|
</if>
|
|
<if test="fpzt != null and fpzt != '' and fpzt != 'null'">
|
|
and t.invoice_status = #{fpzt}
|
|
</if>
|
|
<if test="qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'">
|
|
and t.qs_type = #{qsfs}
|
|
</if>
|
|
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
|
|
and t.xf_name like concat(#{xfmc},'%')
|
|
</if>
|
|
<if test="qsr != null and qsr != '' and qsr != 'null' ">
|
|
and t.qs_name = #{qsr}
|
|
</if>
|
|
<if test="settlementNo != null and settlementNo != ''">
|
|
and t.settlement_no like concat(#{settlementNo},'%')
|
|
</if>
|
|
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
|
|
and t.invoice_no = #{invoiceNo}
|
|
</if>
|
|
<!-- 按签收人查询 -->
|
|
<if test="position != null and position != '' and position != 'null' and position == '1'.toString()">
|
|
and t.qs_name = #{username}
|
|
</if>
|
|
|
|
<if test="businessCode != '99' and businessCode != null and businessCode != '' and businessCode != 'null' ">
|
|
and t.dept_id = #{businessCode}
|
|
</if>
|
|
<if test="businessCode==''">
|
|
and (t.dept_id is null or t.dept_id='' or t.dept_id='99')
|
|
</if>
|
|
<if test='businessCode == "99" and business != null and business.size()>0'>
|
|
and (t.dept_id in
|
|
<foreach collection="business" index="index" item="item" open="(" separator="," close="">
|
|
#{item.businessCode}
|
|
</foreach>
|
|
) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
|
|
</if>
|
|
<if test="eleInvoiceNo!=null and eleInvoiceNo!='' and eleInvoiceNo!='null'">
|
|
and t.ele_invoice_no = #{eleInvoiceNo}
|
|
</if>
|
|
<if test="snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'">
|
|
and t.sn_voucher_number = #{snVoucherNumber}
|
|
</if>
|
|
<if test="postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99' and postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99'">
|
|
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
|
|
</if>
|
|
<if test="imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'">
|
|
and t.image_id = #{imageNumber}
|
|
</if>
|
|
<if test="accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'">
|
|
and t.account_period = #{accountPeriod}
|
|
</if>
|
|
<if test="taxRate!=null and taxRate!='' and taxRate!='多税率' and taxRate != null and taxRate !='99'">
|
|
and t.tax_rate = #{taxRate}
|
|
</if>
|
|
<if test="taxRate=='多税率'">
|
|
and t.tax_rate like '%,%'
|
|
</if>
|
|
<if test="qsksrq != null and qsksrq != '' and qsksrq != 'null' and qsjsrq != null and qsjsrq != '' and qsjsrq != 'null'">
|
|
order by t.qs_date desc,t.invoice_date desc
|
|
</if>
|
|
<if test="qsksrq==null or qsksrq=='' or qsjsrq==null or qsjsrq==''">
|
|
order by t.invoice_date desc
|
|
</if>
|
|
</select>
|
|
</mapper>
|
|
|