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.
sdny-jxpt/dxhy-base/src/main/resources/mapper/BaseFpbrzMapper.xml

389 lines
19 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.base.dao.BaseFpbrzDao">
<resultMap id="FpbrzResultMap" type="com.dxhy.base.entity.BaseTDxRecordInvoice">
<result column="id" property="id"/>
<result column="uuid" property="uuid"/>
<result column="dkTaxAmount" property="dkTaxAmount"/>
<result column="invoiceCode" property="invoiceCode"/>
<result column="invoiceNo" property="invoiceNo"/>
<result column="invoiceType" property="invoiceType"/>
<result column="gfName" property="gfName"/>
<result column="gfTaxNo" property="gfTaxNo"/>
<result column="xfName" property="xfName"/>
<result column="xfTaxNo" property="xfTaxNo"/>
<result column="invoiceDate" property="invoiceDate"/>
<result column="invoiceAmount" property="invoiceAmount"/>
<result column="taxAmount" property="taxAmount"/>
<result column="rzlx" property="rzlx"/>
<result column="rzhYesorno" property="rzhYesorno"/>
<result column="authStatus" property="authStatus"/>
<result column="qsStatus" property="qsStatus"/>
<result column="qsDate" property="qsDate"/>
<result column="qsType" property="qsType"/>
<result column="bdkStatus" property="bdkStatus"/>
<result column="cxbdkStatus" property="cxbdkStatus"/>
<result column="qsName" property="qsName"/>
<result column="rzh_belong_date" property="rzhBelongDate"/>
<result column="ele_invoice_no" property="eleInvoiceNo"/>
<result column="bdk_yy" property="bdkYy"/>
<result column="bdk_message" property="bdkMessage"/>
<result column="sn_voucher_number" property="snVoucherNumber"/>
<result column="posting_time" property="postingTime"/>
<result column="image_id" property="imageNumber"/>
<result column="account_period" property="accountPeriod"/>
<result column="bzdh" property="bzdh"/>
<result column="bzr" property="bzr"/>
<result column="inaccount_status" property="inAccountStatus"/>
<result column="comp_code" property="compCode"/>
</resultMap>
<select id="selectByFpbrz" parameterType="java.util.Map"
resultMap="FpbrzResultMap" databaseId="mysql">
select t.id id,t.uuid uuid,t.dk_tax_amount dkTaxAmount,t.invoice_code invoiceCode,t.invoice_no
invoiceNo,t.gf_name gfName,t.gf_tax_no gfTaxNo,t.xf_tax_no xfTaxNo,t.rzlx rzlx,
t.xf_name xfName,t.invoice_date invoiceDate,t.invoice_amount invoiceAmount,t.tax_amount taxAmount,t.rzh_yesorno
rzhYesorno,t.auth_status authStatus,t.dept_name deptName,
t.qs_status qsStatus,t.qs_date qsDate,t.qs_type qsType,t.invoice_type invoiceType,t.bdk_status
bdkStatus,t.cxbdk_status cxbdkStatus,t.qs_name qsName,t.rzh_belong_date,t.ele_invoice_no,t.bdk_yy,t.bdk_message,
t.sn_voucher_number,t.posting_time,t.image_id,t.account_period,t.bzdh,t.bzr,t.inaccount_status,t.comp_code
from t_dx_record_invoice t,t_dx_tax_current b
where t.gf_tax_no = b.taxno and
t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and
t.invoice_amount-t.tax_amount &gt; 0 and
t.tax_amount &gt;= 0 and
t.invoice_status in ('0','7') 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.company = #{company} and
t.export_mark = '0' and
date_format(t.invoice_date,'%Y-%m-%d') between #{kprqq} and #{kprqz} and
date_format(t.invoice_date,'%Y%m%d') between b.select_start_date and b.select_end_date
<if test="qsrqq != null and qsrqq != '' and qsrqq != 'null' and qsrqz != null and qsrqz != '' and qsrqz != 'null'">
and date_format(t.qs_date,'%Y-%m-%d') between #{qsrqq} and #{qsrqz}
</if>
<if test="fplx != null and fplx != '' and fplx != 'null' and fplx == '14' ">
and (t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08') )
</if>
<if test="fplx != null and fplx != '' and fplx != 'null' and fplx != '14' ">
and t.invoice_type = #{fplx}
</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="sfszbrz != null and sfszbrz != '' and sfszbrz != 'null' and sfszbrz == '4'.toString() ">
and t.bdk_status = '2' and t.auth_status = '4'
</if>
<if test="sfszbrz != null and sfszbrz != '' and sfszbrz != 'null' and sfszbrz != '4'.toString() ">
and (t.auth_status in ('0','5','6') or (t.bdk_status ='2' and t.auth_status != '4'))
</if>
<if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if test="fphm != null and fphm != '' and fphm != 'null' ">
and t.invoice_no = #{fphm}
</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="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>
order by t.invoice_date desc
</select>
<select id="selectByFpbrz" parameterType="java.util.Map"
resultMap="FpbrzResultMap" databaseId="oracle">
select t.id id,t.uuid uuid,t.dk_tax_amount dkTaxAmount,t.invoice_code invoiceCode,t.invoice_no
invoiceNo,t.gf_name gfName,t.gf_tax_no gfTaxNo,t.xf_tax_no,t.rzlx rzlx,
t.xf_name xfName,t.invoice_date invoiceDate,t.invoice_amount invoiceAmount,t.tax_amount taxAmount,t.rzh_yesorno
rzhYesorno,t.auth_status authStatus,t.dept_name deptName,
t.qs_status qsStatus,t.qs_date qsDate,t.qs_type qsType,t.invoice_type invoiceType,t.bdk_status
bdkStatus,t.cxbdk_status cxbdkStatus,t.qs_name qsName,t.rzh_belong_date,t.ele_invoice_no,t.bdk_yy,t.bdk_message
from t_dx_record_invoice t,t_dx_tax_current b
where t.gf_tax_no = b.taxno and
t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and
t.invoice_amount-t.tax_amount &gt; 0 and
t.tax_amount &gt;= 0 and
t.invoice_status in ('0','7') and
(t.invoice_type in('01','03','08','14','31','283','161','183','185') or (t.invoice_type ='32' and t.lq_tdyslxDm='08'))
t.export_mark = '0' and
t.company = #{company} and
to_char(t.invoice_date,'yyyy-mm-dd') between #{kprqq} and #{kprqz} and
to_char(t.invoice_date,'yyyymmdd') between b.select_start_date and b.select_end_date
<if test="qsrqq != null and qsrqq != '' and qsrqq != 'null' and qsrqz != null and qsrqz != '' and qsrqz != 'null'">
and to_char(t.qs_date,'yyyy-mm-dd') between #{qsrqq} and #{qsrqz}
</if>
<if test="fplx != null and fplx != '' and fplx != 'null' and fplx == '14' ">
and (t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08') )
</if>
<if test="fplx != null and fplx != '' and fplx != 'null' and fplx != '14' ">
and t.invoice_type = #{fplx}
</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="sfszbrz != null and sfszbrz != '' and sfszbrz != 'null' and sfszbrz == '4'.toString() ">
and t.bdk_status = '2' and t.auth_status = '4'
</if>
<if test="sfszbrz != null and sfszbrz != '' and sfszbrz != 'null' and sfszbrz != '4'.toString() ">
and (t.auth_status in ('0','5','6') or (t.bdk_status ='2' and t.auth_status != '4'))
</if>
<if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if test="fphm != null and fphm != '' and fphm != 'null' ">
and t.invoice_no = #{fphm}
</if>
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
and t.xf_name = #{xfmc}
</if>
<if test="qsr != null and qsr != '' and qsr != 'null' ">
and t.qs_name = #{qsr}
</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>
order by t.invoice_date desc
</select>
<select id="selectHjByFpbrz" parameterType="java.util.Map"
resultType="com.dxhy.base.entity.BaseTDxRecordInvoice" databaseId="mysql">
select count(1) id,sum(t.invoice_amount) invoiceAmount ,sum(tax_amount) taxAmount
from t_dx_record_invoice t,t_dx_tax_current b
where t.gf_tax_no = b.taxno and
t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and
t.invoice_amount-t.tax_amount &gt; 0 and
t.tax_amount &gt;= 0 and
t.invoice_status in ('0','7') 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.company = #{company} and
t.export_mark = '0' and
date_format(t.invoice_date,'%Y-%m-%d') between #{kprqq} and #{kprqz} and
date_format(t.invoice_date,'%Y%m%d') between b.select_start_date and b.select_end_date
<if test="qsrqq != null and qsrqq != '' and qsrqq != 'null' and qsrqz != null and qsrqz != '' and qsrqz != 'null'">
and date_format(t.qs_date,'%Y-%m-%d') between #{qsrqq} and #{qsrqz}
</if>
<if test="fplx != null and fplx != '' and fplx != 'null' and fplx == '14' ">
and (t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08') )
</if>
<if test="fplx != null and fplx != '' and fplx != 'null' and fplx != '14' ">
and t.invoice_type = #{fplx}
</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="sfszbrz != null and sfszbrz != '' and sfszbrz != 'null' and sfszbrz == '4'.toString() ">
and t.bdk_status = '2' and t.auth_status = '4'
</if>
<if test="sfszbrz != null and sfszbrz != '' and sfszbrz != 'null' and sfszbrz != '4'.toString() ">
and (t.auth_status in ('0','5','6') or (t.bdk_status = '2' and t.auth_status != '4'))
</if>
<if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if test="fphm != null and fphm != '' and fphm != 'null' ">
and t.invoice_no = #{fphm}
</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="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>
order by t.invoice_code,t.invoice_no,t.create_date desc
</select>
<select id="selectHjByFpbrz" parameterType="java.util.Map"
resultType="com.dxhy.base.entity.BaseTDxRecordInvoice" databaseId="oracle">
select count(1) id,sum(t.invoice_amount) invoiceAmount ,sum(tax_amount) taxAmount
from t_dx_record_invoice t,t_dx_tax_current b
where t.gf_tax_no = b.taxno and
t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and
t.invoice_amount-t.tax_amount &gt; 0 and
t.tax_amount &gt;= 0 and
t.invoice_status in ('0','7') 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.company = #{company} and
t.export_mark = '0' and
to_char(t.invoice_date,'yyyy-mm-dd') between #{kprqq} and #{kprqz} and
to_char(t.invoice_date,'yyyymmdd') between b.select_start_date and b.select_end_date
<if test="qsrqq != null and qsrqq != '' and qsrqq != 'null' and qsrqz != null and qsrqz != '' and qsrqz != 'null'">
and to_char(t.qs_date,'yyyy-mm-dd') between #{qsrqq} and #{qsrqz}
</if>
<if test="fplx != null and fplx != '' and fplx != 'null' and fplx == '14' ">
and (t.invoice_type = '14' or (t.invoice_type = '32' and t.lq_tdyslxDm='08') )
</if>
<if test="fplx != null and fplx != '' and fplx != 'null' and fplx != '14' ">
and t.invoice_type = #{fplx}
</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="sfszbrz != null and sfszbrz != '' and sfszbrz != 'null' and sfszbrz == '4'.toString() ">
and t.bdk_status = '2' and t.auth_status = '4'
</if>
<if test="sfszbrz != null and sfszbrz != '' and sfszbrz != 'null' and sfszbrz != '4'.toString() ">
and (t.auth_status in ('0','5','6') or (t.bdk_status = '2' and t.auth_status != '4'))
</if>
<if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if test="fphm != null and fphm != '' and fphm != 'null' ">
and t.invoice_no = #{fphm}
</if>
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
and t.xf_name = #{xfmc}
</if>
<if test="qsr != null and qsr != '' and qsr != 'null' ">
and t.qs_name = #{qsr}
</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>
order by t.invoice_code,t.invoice_no,t.create_date desc
</select>
<update id="updateByUuid" parameterType="java.util.Map" databaseId="mysql">
update t_dx_record_invoice t
set t.rzlx = '4',
t.bdk_status='2',
t.auth_status='2',
t.confirm_user = #{userName},
t.confirm_date = now(),
t.rzh_belong_date = #{skssq},
t.cxbdk_status='0',
t.cxbdk_date = null
<if test="bdkMessage!=null and bdkMessage!='' and bdkMessage!='null'">
,t.bdk_message = #{bdkMessage}
</if>
<if test="bdkYy!=null and bdkYy!='' and bdkYy!='null'">
,t.bdk_yy =#{bdkYy}
</if>
where t.uuid = #{uuid}
</update>
<update id="updateByUuid" parameterType="java.util.Map" databaseId="oracle">
update t_dx_record_invoice t
set t.rzlx = '4',
t.bdk_status='2',
t.auth_status='2',
t.confirm_user = #{userName},
t.confirm_date = sysdate,
t.rzh_belong_date = #{skssq},
t.cxbdk_status='0',
t.cxbdk_date = null
<if test="bdkMessage!=null and bdkMessage!='' and bdkMessage!='null'">
,t.bdk_message = #{bdkMessage}
</if>
<if test="bdkYy!=null and bdkYy!='' and bdkYy!='null'">
,t.bdk_yy =#{bdkYy}
</if>
where t.uuid = #{uuid}
</update>
<update id="updateByUuidQxrz" parameterType="java.util.Map" databaseId="mysql">
update t_dx_record_invoice t
set t.rzlx = '6',
t.cxbdk_status='1',
t.cxbdk_date=now(),
t.bdk_current_period=#{skssq}
where t.uuid = #{uuid}
</update>
<update id="updateByUuidQxrz" parameterType="java.util.Map" databaseId="oracle">
update t_dx_record_invoice t
set t.rzlx = '6',
t.cxbdk_status='1',
t.cxbdk_date=sysdate,
t.bdk_current_period=#{skssq}
where t.uuid = #{uuid}
</update>
</mapper>