<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap
        PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN"
        "http://ibatis.apache.org/dtd/sql-map-2.dtd">
<sqlMap namespace="com.hst.tmService.dao.BusTaxCommonAppMapper">

    <select id="queryGt3LogList" parameterClass="java.util.Map" resultClass="com.hst.business.domain.XtGt3LogDomain">
		SELECT A.LOG_XH logXh,A.TRAN_ID tranId,TO_CHAR(A.REQ_TIME,'YYYY-MM-DD HH24:MI:SS') reqTime,A.REQ_DATA reqData,A.RES_DATA resData,A.RES_CODE resCode,A.RES_MESS resMess 
		FROM XT_GT3_LOG A 
		WHERE A.TRAN_ID = #tranId#
		AND TO_CHAR(A.REQ_TIME,'YYYY-MM-DD') = #rq#  
		ORDER BY A.LOG_XH DESC
	</select>

    <insert id="insertGt3LogData" parameterClass="com.hst.taxService.domain.gt3.Gt3LogDataDomain">
		insert into XT_GT3_LOG_DATA(LOG_XH,TRAN_ID,REQ_TIME,DJXH,PZXH,DZSPHM,SE,RES_CODE,RES_MESS,BZ)
		values(#logXh:NUMERIC#,#tranId:VARCHAR#,to_date(#reqTime:DATE#,'YYYY-MM-DD HH24:MI:SS'),#djxh:VARCHAR#,#pzxh:VARCHAR#,#dzsphm:VARCHAR#,#se:VARCHAR#,#resCode:VARCHAR#,#resMess:VARCHAR#,#bz:VARCHAR#)
	</insert>

    <select id="queryFpyjsqList" parameterClass="java.util.Map" resultClass="com.hst.taxService.domain.ctais2.FpyjDomain">
		select A.FP_YJJG_DM fpYjjgDm,
		       A.FPZL_DM fpzlDm,
		       A.FP_DM fpDm,
		       A.FPQH fpqh,
		       A.FPZH fpzh,
		       TO_CHAR(SYSDATE,'YYYY-MM-DD') yjrq,
		       (A.FPZH - FPQH + 1) fs,
		        TO_CHAR(A.KPRQ_Q ,'YYYY-MM-DD')rqQ,
		        TO_CHAR(A.KPRQ_Z,'YYYY-MM-DD') rqZ,
		       A.KPJE je,
		       A.SE se
		  FROM nsfw_wsgp_fpyjsq2 A
		 where YJBZ = 'Y'
		   AND YJZT = 'Y'
		    AND CZRQ >= TO_DATE('2016-04-22','YYYY-MM-DD')
		AND A.WS_DJHZ_XH=#wsDjhzXh#
		 ORDER BY CZRQ
	</select>

    <select id="selectFpyjNsrsbhList" parameterClass="java.util.Map" resultClass="com.hst.taxService.domain.TaxFpyjDomain">
		SELECT DISTINCT ZB.WS_DJHZ_XH wsDjhzXh,ZB.NSRSBH  nsrsbh
		  FROM NSFW_WSGP_SQZB ZB
		 WHERE EXISTS (SELECT 1
		          FROM nsfw_wsgp_fpyjsq2 A
		         where YJBZ = 'Y'
		           AND YJZT = 'Y'
		            AND CZRQ >= TO_DATE('2016-04-22','YYYY-MM-DD')
		           AND A.WS_DJHZ_XH = ZB.WS_DJHZ_XH)
	</select>
    <update id="updateNsfwWsgpFpyjsqByWsdjhzxh" parameterClass="java.util.Map">
		update NSFW_WSGP_FPYJSQ A  SET  A.ERR_MESS=#mess# where A.ws_djhz_xh=#wsDjhzXh#
	</update>

    <parameterMap class="java.util.Map" id="queryJhxtTaxUrlByBsdtDjxhMap">
        <parameter property="bsdt_djxh" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="url" javaType="java.lang.String" jdbcType="VARCHAR" mode="OUT"/>
    </parameterMap>

    <procedure id="queryJhxtTaxUrlByBsdtDjxh" parameterMap="queryJhxtTaxUrlByBsdtDjxhMap">
        {call P_NSFW_JHXT_GETURL(?,?)}
    </procedure>


    <delete id="deleteNsfwJhBsdtTbsjByKey" parameterClass="com.hst.task.domain.JhxtBsdtTbsjDomain">
		DELETE FROM NSFW_JH_BSDT_TBSJ A WHERE A.BSDT_DJXH = #bsdtDxjh# and rq = trunc(sysdate)
	</delete>
    <insert id="insertNsfwJhBsdtTbsjByKey" parameterClass="com.hst.task.domain.JhxtBsdtTbsjDomain">
		INSERT INTO NSFW_JH_BSDT_TBSJ (BSDT_DJXH ,RQ,JHXT_SJ,GT3_SJ,CJRQ,SJC)
		VALUES( #bsdtDxjh#,TRUNC(SYSDATE),TO_DATE( #jhxtSj#,'YYYY-MM-DD HH24:MI:SS'),TO_DATE( #gt3Sj#,'YYYY-MM-DD HH24:MI:SS'),sysdate,#sjc#)
	</insert>
    <select id="queryBsdtDsDygx"   resultClass="com.hst.task.domain.DsBsdtDybDto">

		SELECT A.MU_ID muId, A.AREA_ID areaId ,B.BSDT_DJXH bsdtDjxh  FROM  nsfw_bsdt_ds_dyb  A ,NSFW_WH_BSDT_JBXX  B WHERE A.MU_ID  = B.MU_ID AND B.YXBZ='Y'
    </select>
</sqlMap>