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/BaseYgxfpqrMapper.xml

348 lines
17 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.BaseYgxfpqrlbDao">
<resultMap id="BaseResultMap"
type="com.dxhy.base.model.BaseYgxfpqrRespVO">
<result column="qsrq" property="qsrq"/>
<result column="id" property="id"/>
<result column="uuid" property="uuid"/>
<result column="qszt" property="qszt"/>
<result column="qsr" property="qsr"/>
<result column="qsfs" property="qsfs"/>
<result column="gxrq" property="gxrq"/>
<result column="fpdm" property="fpdm"/>
<result column="fphm" property="fphm"/>
<result column="kprq" property="kprq"/>
<result column="gfmc" property="gfmc"/>
<result column="gfsh" property="gfsh"/>
<result column="xfmc" property="xfmc"/>
<result column="je" property="je"/>
<result column="se" property="se"/>
<result column="yxdkse" property="yxdkse"/>
<result column="deptId" property="deptId"/>
<result column="businessName" property="businessName"/>
<result column="invoiceType" property="invoiceType"/>
<result column="dqskssq" property="dqskssq"/>
<result column="payment_date" property="paymentDate"/>
<result column="payment_status" property="paymentStatus"/>
<result column="gx_user_name" property="gxUserName"/>
<result column="voucher_number" property="voucherNumber"/>
<result column="ele_invoice_no" property="eleInvoiceNo"/>
</resultMap>
<resultMap id="HjxxMap"
type="com.dxhy.base.model.BaseYgxfpqrRespVO">
<result column="hjsl" property="sl"/>
<result column="hjje" property="je"/>
<result column="hjse" property="se"/>
</resultMap>
<select id="selectByGfshAndKprq" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="mysql">
select t.id id,t.uuid uuid, t.invoice_amount je, t.tax_amount se,
DATE_FORMAT(t.invoice_date,'%Y-%m-%d') kprq,t.gf_name gfmc,t.gf_tax_no gfsh,
t.xf_name xfmc,date_format(t.qs_date,'%Y-%m-%d') qsrq,t.qs_status qszt,t.qs_name qsr,t.qs_type
qsfs,t.invoice_code
fpdm,t.invoice_no fphm,t.dept_id deptId,t.dept_name businessName,t.invoice_type
invoiceType,t.gx_user_name,
date_format(t.gx_date,'%Y-%m-%d') gxrq,t.dk_tax_amount yxdkse,c.current_tax_period
dqskssq,t.payment_status,date_format(t.payment_date,'%Y-%m-%d')payment_date,t.voucher_number,t.ele_invoice_no
from t_dx_record_invoice t,t_dx_tax_current c
WHERE t.gf_tax_no = c.taxno
and date_format(t.gx_date,'%Y-%m-%d') between #{gxksrq} and #{gxjsrq}
and t.auth_status = '1'
and t.rzh_yesorno = '0'
and t.sfygx = '1'
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.export_mark = '0'
and t.bdk_status = '1'
and t.company = #{company}
and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<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 != '99'">
and t.invoice_source = #{invoiceSource}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
and t.xf_name like concat(#{xfmc},'%')
</if>
<if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if test="qsr != null and qsr != '' and qsr != 'null' ">
and t.qs_name = #{qsr}
</if>
<if test="voucherNumber != null and voucherNumber != ''">
and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
</if>
<if test="gxUser != null and gxUser != '' and gxUser != 'null' and gxUser != '99'">
and t.gx_user_account = #{gxUser}
</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="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 ele_invoice_no = #{eleInvoiceNo}
</if>
order by t.gx_date desc,kprq desc
</select>
<select id="selectByGfshAndKprq" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="oracle">
select t.id id,t.uuid uuid, t.invoice_amount je, t.tax_amount se,
to_char(t.invoice_date,'yyyy-mm-dd')kprq,t.gf_name gfmc,t.gf_tax_no gfsh,
t.xf_name xfmc,to_char(t.qs_date,'yyyy-mm-dd') qsrq,t.qs_status qszt,t.qs_name qsr,t.qs_type
qsfs,t.invoice_code
fpdm,t.invoice_no fphm,t.dept_id deptId,t.dept_name businessName,t.invoice_type
invoiceType,t.gx_user_name,
to_char(t.gx_date,'yyyy-mm-dd') gxrq,t.dk_tax_amount yxdkse,c.current_tax_period
dqskssq,t.payment_status,to_char(t.payment_date,'yyyy-mm-dd')payment_date,t.ele_invoice_no
from t_dx_record_invoice t,t_dx_tax_current c
WHERE t.gf_tax_no = c.taxno
and to_char(t.invoice_date,'yyyy-mm-dd') between #{gxksrq} and #{gxjsrq}
and t.auth_status = '1'
and t.rzh_yesorno = '0'
and t.sfygx = '1'
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.export_mark = '0'
and t.bdk_status = '1'
and t.company = #{company}
and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<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 != '99'">
and t.invoice_source = #{invoiceSource}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
and t.xf_name like concat(#{xfmc},'%')
</if>
<if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if test="qsr != null and qsr != '' and qsr != 'null' ">
and t.qs_name = #{qsr}
</if>
<if test="voucherNumber != null and voucherNumber != ''">
and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
</if>
<if test="gxUser != null and gxUser != '' and gxUser != 'null' and gxUser != '99'">
and t.gx_user_account = #{gxUser}
</if>
<if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
<![CDATA[ AND to_char(t.payment_date,'%Y-%m-%d') >= #{paymentDateStart} ]]>
</if>
<if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
<![CDATA[ AND to_char(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="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 ele_invoice_no = #{eleInvoiceNo}
</if>
order by t.gx_date desc,kprq desc
</select>
<select id="selectHjxxByGfshAndKprq"
parameterType="java.util.Map" resultMap="HjxxMap" databaseId="mysql">
select COUNT(1)hjsl, SUM(t.invoice_amount)hjje, SUM(t.tax_amount)hjse
from t_dx_record_invoice t,t_dx_tax_current c
WHERE t.gf_tax_no = c.taxno
and date_format(t.gx_date,'%Y-%m-%d') between #{gxksrq} and #{gxjsrq}
and t.auth_status = '1'
and t.rzh_yesorno = '0'
and t.sfygx = '1'
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.export_mark = '0'
and t.bdk_status = '1'
and t.company = #{company}
<!-- and t.invoice_date between t.gxfwq and t.gxfwz -->
and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<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 != '99'">
and t.invoice_source = #{invoiceSource}
</if>
<if test="voucherNumber != null and voucherNumber != ''">
and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
and t.xf_name like concat(#{xfmc},'%')
</if>
<if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if test="qsr != null and qsr != '' and qsr != 'null' ">
and t.qs_name = #{qsr}
</if>
<if test="gxUser != null and gxUser != '' and gxUser != 'null' and gxUser != '99'">
and t.gx_user_account = #{gxUser}
</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="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>
</select>
<select id="selectHjxxByGfshAndKprq"
parameterType="java.util.Map" resultMap="HjxxMap" databaseId="oracle">
select COUNT(1)hjsl, SUM(t.invoice_amount)hjje, SUM(t.tax_amount)hjse
from t_dx_record_invoice t,t_dx_tax_current c
WHERE t.gf_tax_no = c.taxno
and to_char(t.gx_date,'yyyy-mm-dd') between #{gxksrq} and #{gxjsrq}
and t.auth_status = '1'
and t.rzh_yesorno = '0'
and t.sfygx = '1'
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.export_mark = '0'
and t.bdk_status = '1'
and t.company = #{company}
<!-- and t.invoice_date between t.gxfwq and t.gxfwz -->
and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<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 != '99'">
and t.invoice_source = #{invoiceSource}
</if>
<if test="voucherNumber != null and voucherNumber != ''">
and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="xfmc != null and xfmc != '' and xfmc != 'null' ">
and t.xf_name like concat(#{xfmc},'%')
</if>
<if test="qszt != null and qszt != '' and qszt != 'null' ">
and t.qs_status = #{qszt}
</if>
<if test="qsr != null and qsr != '' and qsr != 'null' ">
and t.qs_name = #{qsr}
</if>
<if test="gxUser != null and gxUser != '' and gxUser != 'null' and gxUser != '99'">
and t.gx_user_account = #{gxUser}
</if>
<if test="paymentDateStart != null and paymentDateStart != '' and paymentDateStart != 'null' ">
<![CDATA[ AND to_char(t.payment_date,'yyyy-MM-dd') >= #{paymentDateStart} ]]>
</if>
<if test="paymentDateEnd != null and paymentDateEnd != '' and paymentDateEnd != 'null' ">
<![CDATA[ AND to_char(t.payment_date,'yyyy-MM-dd') <= #{paymentDateEnd} ]]>
</if>
<if test="paymentStatus != null and paymentStatus != '' and paymentStatus != '99'">
and t.payment_status = #{paymentStatus}
</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>
</select>
</mapper>