<?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.extend.dao.CustomsDao" >
<resultMap id= "BaseResultMap"
type="com.dxhy.extend.entity.JkszhcxRespVO">
<result column= "customs_code" property= "customsCode" />
<result column= "comp_code" property= "compCode" />
<result column= "fill_in_date" property= "fillInDate" />
<result column= "gf_tax_no" property= "gfTaxNo" />
<result column= "gf_name" property= "gfName" />
<result column= "tax_amount" property= "taxAmount" />
<result column= "yx_tax_amount" property= "yxTaxAmount" />
<result column= "audit_status" property= "auditStatus" />
<result column= "apply_check" property= "applyCheck" />
<result column= "check_status" property= "checkStatus" />
<result column= "qs_status" property= "qsStatus" />
<result column= "qs_date" property= "qsDate" />
<result column= "qs_type" property= "qsType" />
<result column= "qs_user" property= "qsUser" />
<result column= "rzh_date" property= "rzhDate" />
<result column= "rzh_yesorno" property= "rzhYesorno" />
<result column= "auth_status" property= "authStatus" />
<result column= "bdk_status" property= "bdkStatus" />
<result column= "confirm_user" property= "confirmUser" />
<result column= "rzh_belong_date" property= "rzhBelongDate" />
<result column= "glzt" property= "glzt" />
<result column= "customs_scan_id" property= "customsScanId" />
<result column= "businessName" property= "businessName" />
<result column= "in_account_status" property= "inAccountStatus" />
<result column= "voucher_number" property= "voucherNumber" />
<result column= "document_number" property= "documentNumber" />
<result column= "sn_voucher_number" property= "snVoucherNumber" />
<result column= "posting_time" property= "postingTime" />
<result column= "image_id" property= "imageId" />
<result column= "account_period" property= "accountPeriod" />
</resultMap>
<resultMap id= "HjResultMap" type= "java.util.Map" >
<result column= "hjsl" property= "hjsl" javaType= "Long" />
<result column= "hjse" property= "hjse" />
</resultMap>
<select databaseId= "mysql" id= "selectByPramsMap"
parameterType="java.util.Map" resultMap="BaseResultMap">
select
t.id,t.customs_code,DATE_FORMAT(t.fill_in_date,'%Y-%m-%d')
fill_in_date,t.gf_tax_no,t.gf_name,t.tax_amount,t.yx_tax_amount,t.audit_status,t.apply_check,t.check_status,t.qs_status,
DATE_FORMAT(t.qs_date,'%Y-%m-%d') qs_date,t.qs_type,t.qs_user,DATE_FORMAT(t.rzh_date,'%Y-%m-%d')
rzh_date, t.rzh_yesorno,t.auth_status,t.bdk_status,t.confirm_user,t.rzh_belong_date,t.glzt,
t.customs_scan_id,t.dept_name businessName,t.in_account_status,t.voucher_number,t.document_number,t.in_account_date,rzh_type,rzlx,t.create_date,
data_sources,t.image_id,t.posting_time,t.account_period,t.comp_code
from t_dx_customs_record t
where export_mark = '0'
<!-- and t.gf_tax_no in -->
<!-- <foreach close=")" collection="gfsh" index="index" item="item" open="(" separator=","> -->
<!-- #{item} -->
<!-- </foreach> -->
<if test= "keyWord != null and keyWord != '' and keyWord != 'null'" >
and t.customs_code like CONCAT('%',#{keyWord},'%')
</if>
<if test= "fillInStartDate != null and fillInEndDate != null and fillInStartDate != '' and fillInEndDate != ''" >
and t.fill_in_date between #{fillInStartDate} and #{fillInEndDate}
</if>
<if test= "taxAmount != null and taxAmount != '' and taxAmount != 'null'" >
and t.tax_amount = #{taxAmount}+0
</if>
<if test= "qsStatus != null and qsStatus != '' and qsStatus != 'null' and qsStatus != '99'" >
and t.qs_status = #{qsStatus}
</if>
<if test= "rzhYesorno != null and rzhYesorno != '' and rzhYesorno != 'null' and rzhYesorno != '99'" >
and t.rzh_yesorno = #{rzhYesorno}
</if>
<if test= "bdkStatus != null and bdkStatus != '' and bdkStatus != 'null' and bdkStatus != '99'" >
and t.bdk_status = #{bdkStatus}
</if>
<if test= "confirmUser != null and confirmUser != '' and confirmUser != 'null' " >
and t.confirm_user like CONCAT('%',#{confirmUser},'%')
</if>
<if test= "glzt != null and glzt != '' and glzt != 'null' and glzt != '99'" >
and t.glzt = #{glzt}
</if>
<if test= "auditStatus != null and auditStatus != '' and auditStatus != 'null' and auditStatus != '99'" >
and t.audit_status = #{auditStatus}
</if>
<if test= "applyCheck != null and applyCheck != '' and applyCheck != 'null' and applyCheck != '99'" >
and t.apply_check = #{applyCheck}
</if>
<if test= "checkStatus != null and checkStatus != '' and checkStatus != 'null' and checkStatus != '99'" >
and t.check_status = #{checkStatus}
</if>
<if test= "qsDateStartDate != null and qsDateEndDate != null and qsDateStartDate != '' and qsDateEndDate != ''" >
and t.qs_date between #{qsDateStartDate} and #{qsDateEndDate}
</if>
<if test= "rzhStartDate != null and rzhEndDate != null and rzhStartDate != '' and rzhEndDate != ''" >
and t.rzh_date between #{rzhStartDate} and #{rzhEndDate}
</if>
<if test= "rzhBelongDate != null and rzhBelongDate != '' and rzhBelongDate != 'null' " >
and t.rzh_belong_date = #{rzhBelongDate}
</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 close= "" collection= "business" index= "index" item= "item" open= "(" separator= "," >
#{item.businessCode}
</foreach>
) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
</if>
<if test= "cjksyf != null and cjksyf!= '' and cjjsyf != null and cjjsyf != ''" >
AND DATE_FORMAT(t.create_date, '%Y-%m-%d') BETWEEN #{cjksyf} and #{cjjsyf}
</if>
<if test= "qsyf != null and qsyf != '' and qsyf != 'null' " >
and DATE_FORMAT(t.qs_date, '%Y-%m') like CONCAT(#{qsyf},'%')
</if>
<if test= "qsUser != null and qsUser != '' and qsUser != 'null' " >
and t.qs_user like CONCAT('%',#{qsUser},'%')
</if>
<if test= "rzhType != null and rzhType != '' and rzhType != 'null' " >
and t.rzh_type = #{rzhType}
</if>
<if test= "inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()" >
and t.in_account_status = #{inAccountStatus}
</if>
<if test= "inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()" >
and (t.in_account_status = '0' or t.in_account_status = '' or t.in_account_status is null)
</if>
<if test= "qsfs != null and qsfs != '' and qsfs != 'null' " >
and t.qs_type = #{qsfs}
</if>
<if test= " skssq != null and skssq != '' and skssq != 'null' " >
and DATE_FORMAT(t.qs_date, '%Y-%m') like CONCAT(#{skssq},'%')
</if>
<if test= "snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'" >
and t.sn_voucher_number = #{snVoucherNumber}
</if>
<if test= "imageId != null and imageId != '' and imageId != 'null' and imageId != '99'" >
and t.image_id = #{imageId}
</if>
<if test= "postingTimeStart != null and postingTimeEnd != null and postingTimeStart != '' and postingTimeEnd != ''" >
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
</if>
<if test= "accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'" >
and t.account_period = #{accountPeriod}
</if>
<if test= "companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'" >
and (t.comp_code in
<foreach collection= "companyCodes" index= "index" item= "companyCode" separator= "," open= "(" close= ")" >
#{companyCode}
</foreach>
or t.comp_code is null or t.comp_code = ''
)
</if>
<if test= "companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode != '88'" >
and t.comp_code = #{companyCode}
</if>
<if test= "companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode == '88'" >
and (t.comp_code = '' or t.comp_code is null)
</if>
order by t.fill_in_date desc
</select>
<select databaseId= "mysql" id= "selectHjxx"
parameterType="java.util.Map" resultMap="HjResultMap">
select
count(1) hjsl,
sum(t.tax_amount) hjse
from t_dx_customs_record t
where export_mark = '0'
<!-- and t.gf_tax_no in -->
<!-- <foreach close=")" collection="gfsh" index="index" item="item" open="(" separator=","> -->
<!-- #{item} -->
<!-- </foreach> -->
<if test= "keyWord != null and keyWord != '' and keyWord != 'null'" >
and t.customs_code like CONCAT('%',#{keyWord},'%')
</if>
<if test= "fillInStartDate != null and fillInEndDate != null and fillInStartDate != '' and fillInEndDate != ''" >
and t.fill_in_date between #{fillInStartDate} and #{fillInEndDate}
</if>
<if test= "taxAmount != null and taxAmount != '' and taxAmount != 'null'" >
and t.tax_amount = #{taxAmount}+0
</if>
<if test= "qsStatus != null and qsStatus != '' and qsStatus != 'null' and qsStatus != '99'" >
and t.qs_status = #{qsStatus}
</if>
<if test= "rzhYesorno != null and rzhYesorno != '' and rzhYesorno != 'null' and rzhYesorno != '99'" >
and t.rzh_yesorno = #{rzhYesorno}
</if>
<if test= "bdkStatus != null and bdkStatus != '' and bdkStatus != 'null' and bdkStatus != '99'" >
and t.bdk_status = #{bdkStatus}
</if>
<if test= "confirmUser != null and confirmUser != '' and confirmUser != 'null' " >
and t.confirm_user like CONCAT('%',#{confirmUser},'%')
</if>
<if test= "glzt != null and glzt != '' and glzt != 'null' and glzt != '99'" >
and t.glzt = #{glzt}
</if>
<if test= "auditStatus != null and auditStatus != '' and auditStatus != 'null' and auditStatus != '99'" >
and t.audit_status = #{auditStatus}
</if>
<if test= "applyCheck != null and applyCheck != '' and applyCheck != 'null' and applyCheck != '99'" >
and t.apply_check = #{applyCheck}
</if>
<if test= "checkStatus != null and checkStatus != '' and checkStatus != 'null' and checkStatus != '99'" >
and t.check_status = #{checkStatus}
</if>
<if test= "qsDateStartDate != null and qsDateEndDate != null and qsDateStartDate != '' and qsDateEndDate != ''" >
and t.qs_date between #{qsDateStartDate} and #{qsDateEndDate}
</if>
<if test= "rzhStartDate != null and rzhEndDate != null and rzhStartDate != '' and rzhEndDate != ''" >
and t.rzh_date between #{rzhStartDate} and #{rzhEndDate}
</if>
<if test= "rzhBelongDate != null and rzhBelongDate != '' and rzhBelongDate != 'null' " >
and t.rzh_belong_date = #{rzhBelongDate}
</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 close= "" collection= "business" index= "index" item= "item" open= "(" separator= "," >
#{item.businessCode}
</foreach>
) or (t.dept_id is null or t.dept_id='' or t.dept_id='99'))
</if>
<if test= "cjksyf != null and cjksyf!= '' and cjjsyf != null and cjjsyf != ''" >
AND DATE_FORMAT(t.create_date, '%Y-%m-%d') BETWEEN #{cjksyf} and #{cjjsyf}
</if>
<if test= "qsyf != null and qsyf != '' and qsyf != 'null' " >
and DATE_FORMAT(t.qs_date, '%Y-%m') like CONCAT(#{qsyf},'%')
</if>
<if test= "qsUser != null and qsUser != '' and qsUser != 'null' " >
and t.qs_user like CONCAT('%',#{qsUser},'%')
</if>
<if test= "rzhType != null and rzhType != '' and rzhType != 'null' " >
and t.rzh_type = #{rzhType}
</if>
<if test= "inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' " >
and t.in_account_status = #{inAccountStatus}
</if>
<if test= "qsfs != null and qsfs != '' and qsfs != 'null' " >
and t.qs_type = #{qsfs}
</if>
<if test= " skssq != null and skssq != '' and skssq != 'null' " >
and DATE_FORMAT(t.qs_date, '%Y-%m') like CONCAT(#{skssq},'%')
</if>
<if test= "snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'" >
and t.sn_voucher_number = #{snVoucherNumber}
</if>
<if test= "postingTime != null and postingTime != '' and postingTime != 'null' and postingTime != '99'" >
and t.posting_time = #{postingTime}
</if>
<if test= "imageId != null and imageId != '' and imageId != 'null' and imageId != '99'" >
and t.image_id = #{imageId}
</if>
<if test= "accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'" >
and t.account_period = #{accountPeriod}
</if>
<if test= "companyCode != null and companyCode != '' and companyCode != 'null' and companyCode == '99'" >
and (t.comp_code in
<foreach collection= "companyCodes" index= "index" item= "companyCode" separator= "," open= "(" close= ")" >
#{companyCode}
</foreach>
or t.comp_code is null or t.comp_code = ''
)
</if>
<if test= "companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode != '88'" >
and t.comp_code = #{companyCode}
</if>
<if test= "companyCode != null and companyCode != '' and companyCode != 'null' and companyCode != '99' and companyCode == '88'" >
and (t.comp_code = '' or t.comp_code is null)
</if>
</select>
</mapper>