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.
162 lines
6.9 KiB
162 lines
6.9 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.BaseInvoiceOutDao">
|
|
|
|
<resultMap id="RelateInvoiceResultMap" type="com.dxhy.base.model.BaseReceiptInvoiceView">
|
|
<result column="id" property="id"/>
|
|
<result column="invoice_code" property="invoiceCode"/>
|
|
<result column="invoice_no" property="invoiceNo"/>
|
|
<result column="uuid" property="uuid"/>
|
|
<result column="out_status" property="outStatus"/>
|
|
<result column="out_invoice_amout" property="outInvoiceAmout"/>
|
|
<result column="out_tax_amount" property="outTaxAmount"/>
|
|
<result column="out_reason" property="outReason"/>
|
|
<result column="out_remark" property="outRemark"/>
|
|
<result column="out_date" property="outDate"/>
|
|
<result column="out_by" property="outBy"/>
|
|
<result column="is_cancel" property="isCancel"/>
|
|
<!--以下直接copy 发票抵账表的字段,跟pojo同样对应-->
|
|
<result column="gf_name" property="gfName"/>
|
|
<result column="xf_name" property="xfName"/>
|
|
<result column="gf_tax_no" property="gfTaxNo"/>
|
|
<result column="invoice_date" property="invoiceDate"/>
|
|
<result column="invoice_status" property="invoiceStatus"/>
|
|
<result column="invoice_amount" property="invoiceAmount"/>
|
|
<result column="tax_amount" property="taxAmount"/>
|
|
<result column="rzh_date" property="certDate"/>
|
|
<result column="invoice_type" property="invoiceType"/>
|
|
<result column="out_resource" property="outResource"/>
|
|
<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>
|
|
|
|
|
|
<sql id="Base_Column_List">
|
|
a.id,
|
|
a.invoice_code,
|
|
a.invoice_no,
|
|
a.uuid,
|
|
a.out_status,
|
|
a.out_invoice_amout,
|
|
a.out_tax_amount,
|
|
a.out_reason,
|
|
a.out_remark,
|
|
a.out_date,
|
|
a.out_by,
|
|
a.is_cancel,
|
|
a.out_belong_date
|
|
</sql>
|
|
|
|
<sql id="common_query_condition">
|
|
and b.gf_tax_no = #{gfsh}
|
|
and (b.comp_code = #{companyCode} or b.comp_code = '' or b.comp_code is null)
|
|
<if test="sellerName != null">
|
|
and b.xf_name LIKE CONCAT( #{sellerName}, '%')
|
|
</if>
|
|
<if test="invoiceNo != null">
|
|
and a.invoice_no = #{invoiceNo}
|
|
</if>
|
|
<if test="certStatus != null">
|
|
and b.rzh_yesorno = #{certStatus}
|
|
</if>
|
|
<if test="invoiceOutStatus != null and invoiceOutStatus.size()>0">
|
|
and b.out_status in
|
|
<foreach collection="invoiceOutStatus" item="item" index="index" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</if>
|
|
<if test="reasonId != null">
|
|
and a.out_reason = #{reasonId}
|
|
</if>
|
|
|
|
<if test="invoiceStatus != null">
|
|
and b.invoice_status = #{invoiceStatus}
|
|
</if>
|
|
<if test="cancelStatus != null">
|
|
and a.is_cancel = #{cancelStatus}
|
|
</if>
|
|
<if test="businessCode != null">
|
|
and b.dept_id = #{businessCode}
|
|
</if>
|
|
</sql>
|
|
|
|
<select id="listPageByInvoice" resultMap="RelateInvoiceResultMap" parameterType="map" databaseId="mysql">
|
|
SELECT
|
|
<include refid="Base_Column_List"/>
|
|
, b.gf_tax_no,b.gf_name,b.xf_name,b.invoice_date,b.invoice_status,b.invoice_amount,b.tax_amount
|
|
, b.rzh_date,b.invoice_type,b.out_resource
|
|
,b.sn_voucher_number,b.posting_time,b.image_id,b.account_period,b.bzdh,b.bzr,b.inaccount_status,b.comp_code
|
|
FROM t_dx_record_invoice_out a
|
|
LEFT JOIN t_dx_record_invoice b ON a.uuid = b.uuid
|
|
<where>
|
|
b.company = #{company}
|
|
<include refid="common_query_condition"/>
|
|
<if test="outStartDate != null">
|
|
<![CDATA[ and DATE_FORMAT(a.out_date,'%Y-%m-%d') >= DATE_FORMAT(#{outStartDate},'%Y-%m-%d') ]]>
|
|
</if>
|
|
<if test="outEndDate != null">
|
|
<![CDATA[ and DATE_FORMAT(a.out_date,'%Y-%m-%d') <= DATE_FORMAT(#{outEndDate},'%Y-%m-%d') ]]>
|
|
</if>
|
|
</where>
|
|
<if test="orderByClause != null">
|
|
order by ${orderByClause}
|
|
</if>
|
|
</select>
|
|
<select id="listPageByInvoice" resultMap="RelateInvoiceResultMap" parameterType="map" databaseId="oracle">
|
|
SELECT
|
|
<include refid="Base_Column_List"/>
|
|
, b.gf_tax_no,b.gf_name,b.xf_name,b.invoice_date,b.invoice_status,b.invoice_amount,b.tax_amount
|
|
, b.rzh_date,b.invoice_type
|
|
FROM t_dx_record_invoice_out a
|
|
LEFT JOIN t_dx_record_invoice b ON a.uuid = b.uuid
|
|
<where>
|
|
b.company = #{company}
|
|
<include refid="common_query_condition"/>
|
|
<if test="outStartDate != null and outEndDate != null">
|
|
<![CDATA[ and a.out_date >= #{outStartDate} and a.out_date < #{outEndDate}+1 ]]>
|
|
</if>
|
|
</where>
|
|
<if test="orderByClause != null">
|
|
order by ${orderByClause}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="querySumForInvoice" resultMap="RelateInvoiceResultMap" parameterType="map" databaseId="mysql">
|
|
SELECT
|
|
sum(b.invoice_amount) as invoice_amount,
|
|
sum(b.tax_amount) as tax_amount
|
|
FROM t_dx_record_invoice_out a
|
|
LEFT JOIN t_dx_record_invoice b ON a.uuid = b.uuid
|
|
<where>
|
|
b.company = #{company}
|
|
<include refid="common_query_condition"/>
|
|
<if test="outStartDate != null">
|
|
<![CDATA[ and DATE_FORMAT(a.out_date,'%Y-%m-%d') >= DATE_FORMAT(#{outStartDate},'%Y-%m-%d') ]]>
|
|
</if>
|
|
<if test="outEndDate != null">
|
|
<![CDATA[ and DATE_FORMAT(a.out_date,'%Y-%m-%d') <= DATE_FORMAT(#{outEndDate},'%Y-%m-%d') ]]>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="querySumForInvoice" resultMap="RelateInvoiceResultMap" parameterType="map" databaseId="oracle">
|
|
SELECT
|
|
sum(b.invoice_amount) as invoice_amount,
|
|
sum(b.tax_amount) as tax_amount
|
|
FROM t_dx_record_invoice_out a
|
|
LEFT JOIN t_dx_record_invoice b ON a.uuid = b.uuid
|
|
<where>
|
|
b.company = #{company}
|
|
<include refid="common_query_condition"/>
|
|
<if test="outStartDate != null and outEndDate != null">
|
|
<![CDATA[ and a.out_date >= #{outStartDate} and a.out_date < #{outEndDate}+1 ]]>
|
|
</if>
|
|
</where>
|
|
</select>
|
|
</mapper>
|
|
|