<?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.ExtTicketDao" >
<resultMap id= "InvoicePoolHjResultMap"
type="com.dxhy.extend.entity.ExtTicketInvoiceModel">
<result column= "hjsl" property= "id" />
<result column= "hjje" property= "invoiceAmount" />
<result column= "hjse" property= "taxAmount" />
</resultMap>
<select id= "queryTotal" parameterType= "java.util.Map"
resultMap="InvoicePoolHjResultMap" databaseId="mysql">
select count(1) hjsl,sum(t.invoice_amount)hjje,sum(t.tax_amount)hjse
from t_dx_invoice_reimburse t
where 1=1
<if
test="kpksrq != null and kpksrq != '' and kpksrq != 'null' and kpjsrq != null and kpjsrq != '' and kpjsrq != 'null'">
and t.invoice_date between #{kpksrq} and #{kpjsrq}
</if>
<if
test="cjksyf != null and cjksyf != '' and cjksyf != 'null' and cjjsyf != null and cjjsyf != '' and cjjsyf != 'null'">
and t.create_date between #{cjksyf} and #{cjjsyf}
</if>
<if test= "keyWord != null and keyWord != '' and keyWord != 'null' " >
and CONCAT(IFNULL(t.passenger,''),IFNULL(t.passenger_s_f_z_h,'')) like
CONCAT('%',#{keyWord},'%')
</if>
<!-- and t.gf_tax_no in -->
<!-- <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")"> -->
<!-- #{item} -->
<!-- </foreach> -->
<if test= "list != null and list != '' and list != 'null' " >
and t.invoice_type in
<foreach collection= "list" index= "index" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= "qszt != null and qszt != '' and qszt != 'null' and qszt != '99'" >
and t.qs_status = #{qszt}
</if>
<if test= "qsyf != null and qsyf != null and qsyf != '' and qsyf != ''" >
and DATE_FORMAT(t.qs_date,'%Y-%m') = #{qsyf}
</if>
<if test= "qsr != null and qsr != '' and qsr != 'null' " >
and t.qs_name like CONCAT(#{qsr},'%')
</if>
<if test= "qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'" >
and t.qs_type = #{qsfs}
</if>
<if test= "isDeduction != null and isDeduction != ''" >
and t.is_deduction = #{isDeduction}
</if>
<if test= "company !=null and company !=''" >
and t.company = #{company}
</if>
<if test= "postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99' and postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99'" >
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
</if>
<if test= "imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'" >
and t.image_id = #{imageNumber}
</if>
<if test= "accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'" >
and t.account_period = #{accountPeriod}
</if>
<if test= "inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()" >
and t.inaccount_status = #{inAccountStatus}
</if>
<if test= "inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()" >
and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null)
</if>
<if test= "bzdh != null and bzdh != '' and bzdh != 'null' and badh != '99'" >
and t.bzdh = #{bzdh}
</if>
<if test= "snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'" >
and t.sn_voucher_number = #{snVoucherNumber}
</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 is null or t.comp_code = '')
</if>
</select>
<select id= "queryTickets" parameterType= "java.util.Map"
resultType="com.dxhy.extend.entity.ExtTicketInvoiceModel" databaseId="mysql">
select *
from t_dx_invoice_reimburse t
where 1=1
<if test= "kpksrq != null and kpksrq != '' and kpksrq != 'null' and kpjsrq != null and kpjsrq != '' and kpjsrq != 'null'" >
and t.invoice_date between #{kpksrq} and #{kpjsrq}
</if>
<if test= "cjksyf != null and cjksyf != '' and cjksyf != 'null' and cjjsyf != null and cjjsyf != '' and cjjsyf != 'null'" >
and t.create_date between #{cjksyf} and #{cjjsyf}
</if>
<if test= "keyWord != null and keyWord != '' and keyWord != 'null' " >
and CONCAT(IFNULL(t.passenger,''),IFNULL(t.passenger_s_f_z_h,'')) like
CONCAT('%',#{keyWord},'%')
</if>
<!-- and t.gf_tax_no in -->
<!-- <foreach collection="gfsh" index="index" item="item" open="(" separator="," close=")"> -->
<!-- #{item} -->
<!-- </foreach> -->
<if test= "list != null and list != '' and list != 'null' " >
and t.invoice_type in
<foreach collection= "list" index= "index" item= "item" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= "qszt != null and qszt != '' and qszt != 'null' and qszt != '99'" >
and t.qs_status = #{qszt}
</if>
<if test= "qsyf != null and qsyf != null and qsyf != '' and qsyf != ''" >
and DATE_FORMAT(t.qs_date,'%Y-%m') = #{qsyf}
</if>
<if test= "qsr != null and qsr != '' and qsr != 'null' " >
and t.qs_name like CONCAT(#{qsr},'%')
</if>
<if test= "qsfs != null and qsfs != '' and qsfs != 'null' and qsfs != '99'" >
and t.qs_type = #{qsfs}
</if>
<if test= "isDeduction != null and isDeduction != ''" >
and t.is_deduction = #{isDeduction}
</if>
<if test= "company !=null and company !=''" >
and t.company = #{company}
</if>
<if test= "postingTimeEnd != null and postingTimeEnd != '' and postingTimeEnd != 'null' and postingTimeEnd != '99' and postingTimeStart != null and postingTimeStart != '' and postingTimeStart != 'null' and postingTimeStart != '99'" >
and t.posting_time between #{postingTimeStart} and #{postingTimeEnd}
</if>
<if test= "imageNumber != null and imageNumber != '' and imageNumber != 'null' and imageNumber != '99'" >
and t.image_id = #{imageNumber}
</if>
<if test= "accountPeriod != null and accountPeriod != '' and accountPeriod != 'null' and accountPeriod != '99'" >
and t.account_period = #{accountPeriod}
</if>
<if test= "inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '1'.toString()" >
and t.inaccount_status = #{inAccountStatus}
</if>
<if test= "inAccountStatus != null and inAccountStatus != '' and inAccountStatus != 'null' and inAccountStatus != '99' and inAccountStatus == '0'.toString()" >
and (t.inaccount_status = '0' or t.inaccount_status = '' or t.inaccount_status is null)
</if>
<if test= "bzdh != null and bzdh != '' and bzdh != 'null' and badh != '99'" >
and t.bzdh = #{bzdh}
</if>
<if test= "snVoucherNumber != null and snVoucherNumber != '' and snVoucherNumber != 'null' and snVoucherNumber != '99'" >
and t.sn_voucher_number = #{snVoucherNumber}
</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 is null or t.comp_code = '')
</if>
</select>
</mapper>