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-sign/src/main/resources/mapper/SignRecordInvoiceMapper.xml

216 lines
8.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.sign.dao.SignRecordInvoiceDao">
<resultMap id="BaseResultMap" type="com.dxhy.sign.entity.TDxRecordInvoice">
<id column="id" property="id"/>
<result column="invoice_type" property="invoiceType"/>
<result column="invoice_code" property="invoiceCode"/>
<result column="invoice_no" property="invoiceNo"/>
<result column="invoice_date" property="invoiceDate"/>
<result column="gf_name" property="gfName"/>
<result column="xf_name" property="xfName"/>
<result column="invoice_amount" property="invoiceAmount"/>
<result column="tax_amount" property="taxAmount"/>
<result column="total_amount" property="totalAmount"/>
<result column="qs_status" property="qsStatus"/>
<result column="dept_id" property="deptId"/>
</resultMap>
<resultMap id="WqshjResultMap" type="com.dxhy.sign.entity.TDxRecordInvoice">
<result column="hjsl" property="id"/>
<result column="hjje" property="invoiceAmount"/>
<result column="hjse" property="taxAmount"/>
</resultMap>
<select id="selectWqsfp" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="mysql">
select
t.id,t.invoice_type,t.invoice_code,t.invoice_no,t.invoice_date,t.gf_name,t.xf_name,t.invoice_amount,t.tax_amount,t.dept_id,t.qs_status
from t_dx_record_invoice t
where 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 t.invoice_type = #{invoiceType}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
and t.invoice_source = #{invoiceSource}
</if>
<if test="ids != null and ids.size()>0">
and t.id in
<foreach collection="ids" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
and t.qs_status = '0'
and t.source_system='0'
and t.invoice_date between #{kprqq} and #{kprqz}
order by t.invoice_date desc
</select>
<select id="selectWqsfp" parameterType="java.util.Map"
resultMap="BaseResultMap" databaseId="oracle">
select
t.id,t.invoice_type,t.invoice_code,t.invoice_no,t.invoice_date,t.gf_name,t.xf_name,t.invoice_amount,t.tax_amount,t.dept_id,t.qs_status
from t_dx_record_invoice t
where 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 t.invoice_type = #{invoiceType}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
and t.qs_status = '0'
and t.source_system='0'
AND TO_CHAR(t.invoice_date, 'yyyy-MM-dd HH24:mm:dd') between #{kprqq} and #{kprqz}
order by t.invoice_date desc
</select>
<select id="selectWqsfpHj" parameterType="java.util.Map"
resultMap="WqshjResultMap" databaseId="mysql">
select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse
from t_dx_record_invoice t
where 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 t.invoice_type = #{invoiceType}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
<if test="invoiceSource!=null and invoiceSource!='' and invoiceSource!='99'">
and t.invoice_source = #{invoiceSource}
</if>
and t.qs_status = '0'
and t.source_system='0'
and t.invoice_date between #{kprqq} and #{kprqz}
</select>
<select id="selectWqsfpHj" parameterType="java.util.Map"
resultMap="WqshjResultMap" databaseId="oracle">
select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse
from t_dx_record_invoice t
where 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 t.invoice_type = #{invoiceType}
</if>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
and t.qs_status = '0'
and t.source_system='0'
AND TO_CHAR(t.invoice_date, 'yyyy-MM-dd HH24:mm:dd') between #{kprqq} and #{kprqz}
</select>
<delete id="deleteBatchInvoice">
delete
from t_dx_invoice
where scan_id = #{scanId}
</delete>
<delete id="deleteBatchImg">
delete
from t_dx_invoice_img
where scan_id = #{scanId}
</delete>
<select id="getRules" resultType="com.dxhy.sign.entity.SignRulesEntity">
select *
from sys_sign_rules
where rule_id in (select rule_id from sys_rules_dept where company = #{company})
order by rule_code
</select>
<update id="updateQsxx" databaseId="mysql">
UPDATE t_dx_record_invoice
SET qs_status='0',
qs_date=null,
qs_name=null,
qs_type=null,
settle_source=null,
settlement_no=null,
settlement_status='0',
last_update_date = now()
WHERE uuid = #{uuid}
</update>
<update id="updateQsxx" databaseId="oracle">
UPDATE t_dx_record_invoice
SET qs_status='0',
qs_date=null,
qs_name=null,
qs_type=null,
settle_source=null,
settlement_no=null,
settlement_status='0',
last_update_date = sysdate
WHERE uuid = #{uuid}
</update>
<select id="getUser" resultType="map">
SELECT user_id userId,
username userName
FROM sys_user
WHERE company = #{company}
</select>
<select id="selectYlqsfp" parameterType="java.util.Map"
resultType="com.dxhy.sign.model.SgqsWqsfpVO" databaseId="mysql">
select
t.id,t.invoice_type,DATE_FORMAT(t.invoice_date,'%Y-%m-%d') as
invoiceDate,t.invoice_code,t.invoice_no,t.gf_name,t.xf_name,truncate(t.invoice_amount,2) as
invoiceAmount,truncate(t.tax_amount,2) as taxAmount,DATE_FORMAT(t.qs_date,'%Y-%m-%d %T') as qsDate,t.uuid
from t_dx_record_invoice t left join t_dx_invoice d on d.uuid = t.uuid
LEFT JOIN ${dxhyAdmin}.sys_user u on d.user_account = u.user_id
where u.push_yesorno=1
and t.company = 'YL' and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
and t.qs_status = '1'
and t.qs_date between #{qsrqq} and #{qsrqz}
order by t.qs_date desc
</select>
<select id="selectYlqsfpHj" parameterType="java.util.Map"
resultMap="WqshjResultMap" databaseId="mysql">
select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse
from t_dx_record_invoice t left join t_dx_invoice d on d.uuid = t.uuid
LEFT JOIN ${dxhyAdmin}.sys_user u on d.user_account = u.user_id
where u.push_yesorno=1
and t.company = 'YL' and t.gf_tax_no in
<foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
<if test="invoiceNo != null and invoiceNo != '' and invoiceNo != 'null' ">
and t.invoice_no = #{invoiceNo}
</if>
and t.qs_status = '1'
and t.qs_date between #{qsrqq} and #{qsrqz}
</select>
<delete id="deleteInvoiceByid">
delete
from t_dx_invoice
where id = #{Id}
</delete>
<select id="selectInvoice" resultType="com.dxhy.sign.entity.TDxInvoice">
select scan_id as scanId from t_dx_invoice where id = #{Id}
</select>
</mapper>