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.

335 lines
16 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.TDxInvoiceDao">
<resultMap id="BaseResultMap" type="com.dxhy.core.entity.TDxInvoice">
<id column="id" property="id"/>
<result column="invoice_code" property="invoiceCode"/>
<result column="invoice_no" property="invoiceNo"/>
<result column="ele_invoice_no" property="eleInvoiceNo"/>
<result column="invoice_type" property="invoiceType"/>
<result column="invoice_date" property="invoiceDate"/>
<result column="invoice_amount" property="invoiceAmount"/>
<result column="tax_amount" property="taxAmount"/>
<result column="user_name" property="userName"/>
<result column="qs_type" property="qsType"/>
<result column="qs_status" property="qsStatus"/>
<result column="uuid" property="uuid"/>
<result column="qs_date" property="qsDate"/>
<result column="notes" property="notes"/>
<result column="dept_id" property="deptId"/>
<result column="scan_id" property="scanId"/>
<result column="gf_name" property="gfName"/>
<result column="xf_name" property="xfName"/>
<result column="remark" property="remark"/>
<result column="voucher_number" property="voucherNumber"/>
</resultMap>
<select id="selectQsfpList" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="mysql">
SELECT
t.id,t.notes,t.qs_type,t.gf_name,t.xf_name,t.qs_status,t.qs_date,t.user_name,t.invoice_code,t.invoice_no
,t.ele_invoice_no,t.invoice_type,t.uuid,t.invoice_date,t.invoice_amount,t.tax_amount,t.dept_id,t.dept_name
,t.scan_id,t.remark,t.gf_tax_no,t.xf_tax_no,t.create_date,t.total_amount,t.voucher_number,r.sn_voucher_number,r.posting_time,r.image_id,r.account_period,r.bzdh,bzr,r.inaccount_status,r.comp_code
from t_dx_invoice t inner join t_dx_record_invoice r on t.uuid = r.uuid
WHERE t.valid = '1'
<if test="qsNameFlag == null">
and t.user_account = #{userid}
</if>
<if test="gfsh != null and gfsh != '' and gfsh != 'null' and gfshFlag != '99' ">
and t.gf_tax_no = #{gfsh}
</if>
<if test="voucherNumber != null and voucherNumber != ''">
and t.voucher_number like concat('%',concat(#{voucherNumber},'%'))
</if>
<if
test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
and t.invoice_type = #{invoiceType}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if
test="businessCode != null and businessCode != '' and businessCode != 'null' and businessCode != '99' ">
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="qsStatus != null and qsStatus != '' and qsStatus != 'null' and qsStatus != '99' ">
and t.qs_status = #{qsStatus}
</if>
<if test="qsType != null and qsType != '' and qsType != 'null' ">
and t.qs_type = #{qsType}
</if>
<if test="notes != null and notes != '' and notes != 'null' ">
and t.notes like concat(#{notes},'%')
</if>
<if test="xfsh != null and xfsh != '' and xfsh != 'null' ">
and t.xf_tax_no like concat(#{xfsh},'%')
</if>
<if test="createDateBegin != null and createDateBegin != '' and createDateBegin != 'null' ">
<![CDATA[ AND t.create_date >= #{createDateBegin} ]]>
</if>
<if test="createDateEnd != null and createDateEnd != '' and createDateEnd != 'null' ">
<![CDATA[ AND t.create_date <= #{createDateEnd} ]]>
</if>
AND t.qs_date BETWEEN #{qsrqq} AND #{qsrqz}
<if test="company !=null and company!=''">
and t.company = #{company}
</if>
<if test="xfmc!=null and xfmc!=''">
and t.xf_name like concat(#{xfmc},'%')
</if>
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
and t.invoice_source = #{invoiceSource}
</if>
ORDER BY t.invoice_serial_no DESC, t.qs_date desc
</select>
<select id="selectQsfpList" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="oracle">
SELECT
t.id,t.notes,t.qs_type,t.gf_name,t.xf_name,t.qs_status,t.qs_date,t.user_name,t.invoice_code,t.invoice_no,t.ele_invoice_no,
t.invoice_type,t.uuid,t.invoice_date,t.invoice_amount,t.tax_amount,t.dept_id,t.dept_name,t.scan_id,t.remark,t.gf_tax_no,t.xf_tax_no,t.create_date,t.total_amount
FROM t_dx_invoice t
WHERE t.user_account = #{userid} and t.valid = '1'
<if
test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
and t.invoice_type = #{invoiceType}
</if>
<if test="gfsh != null and gfsh != '' and gfsh != 'null' and gfshFlag != '99' ">
and t.gf_tax_no = #{gfsh}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if
test="businessCode != null and businessCode != '' and businessCode != 'null' and businessCode != '99' ">
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="qsStatus != null and qsStatus != '' and qsStatus != 'null' and qsStatus != '99' ">
and t.qs_status = #{qsStatus}
</if>
<if test="qsType != null and qsType != '' and qsType != 'null' ">
and t.qs_type = #{qsType}
</if>
<if test="notes != null and notes != '' and notes != 'null' ">
and t.notes like concat(#{notes},'%')
</if>
<if test="xfsh != null and xfsh != '' and xfsh != 'null' ">
and t.xf_tax_no like concat(#{xfsh},'%')
</if>
<if test="createDateBegin != null and createDateBegin != '' and createDateBegin != 'null' ">
<![CDATA[ AND to_char(t.create_date,'yyyy-mm-dd hh24:mi:ss') >= #{createDateBegin} ]]>
</if>
<if test="createDateEnd != null and createDateEnd != '' and createDateEnd != 'null' ">
<![CDATA[ AND to_char(t.create_date,'yyyy-mm-dd hh24:mi:ss') <= #{createDateEnd} ]]>
</if>
AND t.qs_date between to_date(#{qsrqq},'yyyy-mm-dd hh24:mi:ss') and to_date(#{qsrqz},'yyyy-mm-dd
hh24:mi:ss')
<if test="company !=null and company!=''">
and t.company = #{company}
</if>
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
and t.invoice_source = #{invoiceSource}
</if>
ORDER BY t.invoice_serial_no DESC, t.qs_date desc
</select>
<select id="selectElecInvoice" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="oracle">
SELECT
t.id,t.notes,t.qs_type,t.qs_status,t.qs_date,t.user_name,t.invoice_code,t.invoice_no,t.uuid,t.invoice_date,t.invoice_type,t.invoice_amount,t.tax_amount,t.dept_id,t.dept_name
,t.scan_id,t.gf_name,t.xf_name,t.gf_tax_no,t.xf_tax_no,t.check_code
FROM t_dx_invoice t
WHERE t.user_name = #{userName} and t.valid = '1' and qs_type = '5' and invoice_type in
('08','10','14')
<if test="gfsh != null and gfsh != '' and gfsh != 'null' and gfsh != '99' ">
and t.gf_tax_no in
<foreach close=")" collection="gfsh" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</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="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="company !=null and company !=''">
and t.company = #{company}
</if>
AND TO_CHAR(t.QS_DATE, 'yyyy-MM-dd HH24:mm:dd') BETWEEN #{qsrqq} AND #{qsrqz}
ORDER BY t.invoice_serial_no desc
</select>
<select id="selectElecInvoice" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="mysql">
SELECT
t.id,t.notes,t.qs_type,t.qs_status,t.qs_date,t.user_name,t.invoice_code,t.invoice_no,t.uuid,t.invoice_date,t.invoice_type,t.invoice_amount,t.tax_amount
,t.dept_id,t.dept_name,t.scan_id,t.gf_name,t.xf_name,t.gf_tax_no,t.xf_tax_no,t.check_code
FROM t_dx_invoice t
WHERE t.user_name = #{userName} and t.valid = '1' and qs_type = '5' and invoice_type in
('08','10','14')
<if test="gfsh != null and gfsh != '' and gfsh != 'null' and gfsh != '99' ">
and t.gf_tax_no in
<foreach close=")" collection="gfsh" index="index" item="item" open="(" separator=",">
#{item}
</foreach>
</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="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="company !=null and company !=''">
and t.company = #{company}
</if>
AND t.qs_date BETWEEN #{qsrqq} AND #{qsrqz}
ORDER BY t.invoice_serial_no desc
</select>
<select id="selectQsfpListMryx" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="mysql">
SELECT
t.id,t.notes,t.qs_type,t.gf_name,t.xf_name,t.qs_status,t.qs_date,t.user_name,t.invoice_code,t.invoice_no
,t.invoice_type,t.uuid,t.invoice_date,t.invoice_amount,t.tax_amount,t.dept_id,t.dept_name,t.scan_id,t.remark,t.gf_tax_no,t.xf_tax_no,t.create_date,t.total_amount
FROM t_dx_invoice t
WHERE t.valid = '1'
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 t.invoice_type = #{invoiceType}
</if>
<if test="invoiceSource != null and invoiceSource != '' and invoiceSource != 'null' ">
and t.invoice_source = #{invoiceSource}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="invoiceCode != null and invoiceCode != '' and invoiceCode != 'null' ">
and t.invoice_code = #{invoiceCode}
</if>
<if test="userName!= null and userName!= '' and userName!='null'">
and t.user_name like concat('%',concat(#{userName},'%'))
</if>
<if test="qsStatus != null and qsStatus != '' and qsStatus != 'null' ">
and t.qs_status = #{qsStatus}
</if>
<if test="createDateBegin != null and createDateBegin != '' and createDateBegin != 'null' ">
<![CDATA[ AND t.create_date >= #{createDateBegin} ]]>
</if>
<if test="createDateEnd != null and createDateEnd != '' and createDateEnd != 'null' ">
<![CDATA[ AND t.create_date <= #{createDateEnd} ]]>
</if>
<if test="invoiceDateBegin != null and invoiceDateBegin != '' and invoiceDateBegin != 'null' ">
<![CDATA[ AND t.invoice_date >= #{invoiceDateBegin} ]]>
</if>
<if test="invoiceDateEnd != null and invoiceDateEnd != '' and invoiceDateEnd != 'null' ">
<![CDATA[ AND t.invoice_date <= #{invoiceDateEnd} ]]>
</if>
<if test="qsrqq != null and qsrqq != '' and qsrqq != 'null' ">
<![CDATA[ AND t.qs_date >= #{qsrqq} ]]>
</if>
<if test="qsrqz != null and qsrqz != '' and qsrqz != 'null' ">
<![CDATA[ AND t.qs_date <= #{qsrqz} ]]>
</if>
<if test="company !=null and company!=''">
and t.company = #{company}
</if>
ORDER BY t.invoice_serial_no desc
</select>
<select id="selectQsfpListJrtt" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="mysql">
SELECT
t.id,t.notes,t.qs_type,t.qs_status,t.qs_date,t.user_name,t.invoice_code,t.invoice_no,t.ele_invoice_no,t.uuid,t.invoice_date,t.invoice_type,t.invoice_amount,t.tax_amount
,t.dept_id,t.dept_name,t.scan_id,t.gf_name,t.xf_name,t.gf_tax_no,t.xf_tax_no,t.check_code,t.remark,t.create_date,t.total_amount,t.settle_source,
t.settlement_no,
t.settlement_status,
r.auth_status, r.voucher_number
FROM t_dx_invoice t
left join t_dx_record_invoice r on t.uuid=r.uuid
WHERE t.valid = '1'
<if test="qsNameFlag == null">
and t.user_account = #{userid}
</if>
<if test="gfsh != null and gfsh != '' and gfsh != 'null' and gfshFlag != '99' ">
and t.gf_tax_no = #{gfsh}
</if>
<if test="voucherNumber != null and voucherNumber != ''">
and r.voucher_number like concat('%',concat(#{voucherNumber},'%'))
</if>
<if
test="invoiceType != null and invoiceType != '' and invoiceType != 'null' and invoiceType != '99' ">
and t.invoice_type = #{invoiceType}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if
test="businessCode != null and businessCode != '' and businessCode != 'null' and businessCode != '99' ">
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="qsStatus != null and qsStatus != '' and qsStatus != 'null' and qsStatus != '99' ">
and t.qs_status = #{qsStatus}
</if>
<if test="notes != null and notes != '' and notes != 'null' ">
and t.notes like concat(#{notes},'%')
</if>
<if test="xfsh != null and xfsh != '' and xfsh != 'null' ">
and t.xf_tax_no like concat(#{xfsh},'%')
</if>
<if test='gxStatus=="1"'>
and r.auth_status in (1,2,3,4)
</if>
<if test='gxStatus=="0"'>
and r.auth_status in (0,5,6)
</if>
<if test="settlementNo != null and settlementNo != ''">
and t.settlement_no like concat(#{settlementNo},'%')
</if>
<if test="settlementStatus!=null and settlementStatus!='' and settlementStatus!='99'">
and t.settlement_status= #{settlementStatus}
</if>
<if test="createDateBegin != null and createDateBegin != '' and createDateBegin != 'null' ">
<![CDATA[ AND t.create_date >= #{createDateBegin} ]]>
</if>
<if test="createDateEnd != null and createDateEnd != '' and createDateEnd != 'null' ">
<![CDATA[ AND t.create_date <= #{createDateEnd} ]]>
</if>
AND t.qs_date BETWEEN #{qsrqq} AND #{qsrqz}
<if test="company !=null and company!=''">
and t.company = #{company}
</if>
<if test="xfmc!=null and xfmc!=''">
and t.xf_name like concat(#{xfmc},'%')
</if>
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
and t.invoice_source = #{invoiceSource}
</if>
ORDER BY t.invoice_serial_no desc
</select>
</mapper>