<?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.TaxSmzAppMapper">
    <insert id="insertSmzBsySxsfzBdjl_sqlServer" parameterClass="com.hst.common.bo.SmzBsySxsfzBdjl">
        <selectKey resultClass="string" keyProperty="rxsfzBdxh" type="post">
            <![CDATA[

            INSERT INTO SMZ_BSY_RXSFZ_BDJL
            (XM,SFZHM,XB,MZ,CSRQ,ZZ,
            QFJG,YXQ_Q,YXQ_Z,SFZZM_PIC,SFZFM_PIC,HEAD_PIC,
            BDRQ,XSBL,BDJG,QHHM,SJLY_DM,CJRQ,CJR_DM,JKYZUUID ,RTNMSG,BSDT_DJXH,CJBZ)
            VALUES
            (#xm#,#sfzhm#,#xb#,#mz#,CONVERT(DATETIME,#csrq#,120),#zz#,
            #qfjg#,CONVERT(DATETIME,#yxq_q#,120),CONVERT(DATETIME,#yxq_z#,120),#sfzzmPic#,#sfzfmPic#,#headPic#,
            getdate(),#xsbl#,#bdjg#,#qhhm#,#sjlyDm#,getdate(),#cjrDm#,#jkyzuuid#,#rtnMsg#,#bsdt_djxh#,#cjbz#)
            SELECT SCOPE_IDENTITY() AS rxsfzBdxh
              ]]>

        </selectKey>
    </insert>
    <update id="updateSmzBsyRxsfzBdjl" parameterClass="java.util.Map">
        <![CDATA[



        UPDATE SMZ_BSY_RXSFZ_BDJL SET QHHM = #qhhm# WHERE
          ]]>
        <isNotEmpty property="rxsfzBdxh">
            rxsfz_bdxh= #rxsfzBdxh#
        </isNotEmpty>
        <isNotEmpty property="jkyzuuid">
            jkyzuuid= #jkyzuuid#
        </isNotEmpty>


    </update>
    <select id="selectSmzRxfszBdjl" parameterClass="java.util.Map" resultClass="com.hst.taxService.domain.gt3.Zjsmbs00009RequestDomain">
        <![CDATA[



        SELECT jkyzuuid ,sfzhm sfzjhm,bsdt_djxh wbsbbs ,qhhm wbsbkl from SMZ_BSY_RXSFZ_BDJL where
            ]]>
        <isNotEmpty property="rxsfzBdxh">
            rxsfz_bdxh= #rxsfzBdxh#
        </isNotEmpty>
        <isNotEmpty property="jkyzuuid">
            jkyzuuid= #jkyzuuid#
        </isNotEmpty>


    </select>
    <select id="queryNsrxxByQhhmSqlServer" resultClass="com.hst.taxService.domain.smz.JhxtGetBsyxxByqhhmReturnDomain" parameterClass="java.util.Map">
        <![CDATA[



        SELECT A.XM xm,
        A.SFZHM sfzhm,
        A.XB xb,
        A.MZ mz,
        CONVERT(varchar(10), CSRQ, 120) csrq,
        A.ZZ zz,
        A.QFJG qfjg,
        A.YXQ_Q yxqQ,
        A.YXQ_Z yxqZ,
        A.SFZZM_PIC sfzzmPic,
        A.SFZFM_PIC sfzfmPic,
        A.HEAD_PIC headPic,
        A.cjbz
        FROM SMZ_BSY_RXSFZ_BDJL A
        WHERE CONVERT(varchar(10), BDRQ, 120)= CONVERT(varchar(10), GETDATE(), 120)
  ]]>
        <isNotEmpty property="rxsfzBdxh" prepend="and">
            rxsfz_bdxh= #rxsfzBdxh#
        </isNotEmpty>
        <isNotEmpty property="qhhm" prepend="and">
            A.qhhm=#qhhm#
        </isNotEmpty>


    </select>
    <select id="queryNsrxxByJkuuidSqlServer" resultClass="com.hst.common.bo.SmzBsySxsfzBdjl" parameterClass="java.util.Map">
        <![CDATA[


        SELECT A.XM xm,
        A.SFZHM sfzhm,
        A.XB xb,
        A.MZ mz,
        CONVERT(varchar(10), CSRQ, 120) csrq,
        A.ZZ zz,
        A.QFJG qfjg,
        CONVERT(varchar(10), YXQ_Q, 120) yxq_q,
        CONVERT(varchar(10), YXQ_Z, 120) yxq_z,
        A.SFZZM_PIC sfzzmPic,
        A.SFZFM_PIC sfzfmPic,
        A.HEAD_PIC headPic,
        A.cjbz,
        a.qhhm qhhm,
        (SELECT CONVERT(varchar(10),TKT_DATE,120) + ' ' + CONVERT(varchar(8),TKT_TIME,24) FROM ticket B WHERE B.TKT_ID= A.qhhm) qhsj
        FROM SMZ_BSY_RXSFZ_BDJL A
        WHERE
            ]]>
        <isNotEmpty property="rxsfzBdxh">
            rxsfz_bdxh= #rxsfzBdxh#
        </isNotEmpty>
        <isNotEmpty property="jkyzuuid">
            jkyzuuid= #jkyzuuid#
        </isNotEmpty>


    </select>
    <select id="queryNsrxxBySfzhmSqlServer" resultClass="com.hst.common.bo.SmzBsySxsfzBdjl" parameterClass="java.util.Map">
        <![CDATA[








        SELECT A.XM xm,
        A.SFZHM sfzhm,
        A.XB xb,
        A.MZ mz,
        CONVERT(varchar(10), CSRQ, 120)  csrq,
        A.ZZ zz,
        A.QFJG qfjg,
        CONVERT(varchar(10), YXQ_Q, 120)  yxq_q,
        CONVERT(varchar(10), YXQ_Z, 120)  yxq_z,
        A.SFZZM_PIC sfzzmPic,
        A.SFZFM_PIC sfzfmPic,
        A.HEAD_PIC headPic,
        A.cjbz,
        a.qhhm qhhm
        FROM SMZ_BSY_RXSFZ_BHEAD_PIC_URLDJL A
        WHERE
        sfzhm= #sfzhm# and rownum =1








        ]]>

    </select>
    <select id="queryBsdtDjxhJhj" resultClass="java.lang.String">
        select VALUE from system where [key] ='BS_TAX_REGNUM'
    </select>

    <select id="queryMzDmByMc" parameterClass="java.util.Map" resultClass="java.lang.String">
        SELECT  MZSZ_DM_1 FROM DM_XG_MZ WHERE MZMC LIKE #mzmc#
    </select>

    <select id="queyrySmzRxbdCodeQhbz" resultClass="java.lang.String">
        select VALUE from system where [key] ='SMZ_RXBD_CODE_QHBZ'
    </select>
    <select id="selectParmValueByKey" parameterClass="java.util.Map" resultClass="java.lang.String">
        select VALUE from system where [key] =#key#
    </select>

    <resultMap class="com.hst.taxService.domain.smz.JhxtGetGgjChxxReturnDomain" id="jhxtGetGgjChxxProcResMap">
        <result property="swjgmc" column="SWJG_MC"/>
        <result property="head_pic_url" column="HEAD_PIC_URL"/>
        <result property="height" column="height"/>
        <result property="fontSize" column="font_size"/>
        <result property="password" column="password"/>
    </resultMap>
    <parameterMap class="java.util.Map" id="jhxtGetGgjChxxProcMap">
        <parameter property="bsdt_djxh" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="group" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="zdbh" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
    </parameterMap>
    <procedure id="jhxtGetGgjChxxProc" parameterMap="jhxtGetGgjChxxProcMap" resultMap="jhxtGetGgjChxxProcResMap">
        {call bskj_getggjchxx(?,?,?)}
    </procedure>
    <resultMap class="com.hst.taxService.domain.smz.JhxtGetGgjGetListDomain" id="jhxtGetGgjGetListProcRes">
        <result property="num" column="num"/>
        <result property="win" column="win"/>
        <result property="zt" column="zt"/>
        <result property="bolb" column="BLOD"/>
        <result property="color" column="color"/>
    </resultMap>
    <parameterMap class="java.util.Map" id="jhxtGetGgjGetListProcMap">
        <parameter property="bsdt_djxh" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="group" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="zdbh" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
    </parameterMap>
    <procedure id="jhxtGetGgjGetListProc" parameterMap="jhxtGetGgjGetListProcMap" resultMap="jhxtGetGgjGetListProcRes">
        {call BS_GETGGJDLLIST(?,?,?)}
    </procedure>


    <insert id="insertXtGt3SmbsRxbdLog_sqlServer" parameterClass="com.hst.common.bo.XtGt3SmbsRxbdLog">
        <selectKey resultClass="String" keyProperty="logXh" type="post">
            <![CDATA[
            INSERT INTO XT_GT3_SMBS_RXBD_LOG (cgbz,rq,returncode,returnmessage,sfzhm,swjg_dm,bsdt_djxh,jkyzuuid)
            VALUES (#cgbz#,getdate(),#returncode#,#returnmessage#,#sfzhm#,#swjgDm#,#bsdtDjxh#,#jkyzuuid#)
            SELECT SCOPE_IDENTITY() AS logXh
            ]]>
        </selectKey>
    </insert>
    <insert id="insertXtGt3SmbsSmcjLog_sqlServer" parameterClass="com.hst.common.bo.XtGt3SmbsSmcjLog">
        <selectKey resultClass="String" keyProperty="logXh" type="post">
            <![CDATA[

            INSERT INTO XT_GT3_SMBS_SMCJ_LOG (cgbz,rq,returncode,returnmessage,sfzhm,swjg_dm,bsdt_djxh,qhhm,qhsj)
            VALUES (#cgbz#,getdate(),#returncode#,#returnmessage#,#sfzhm#,#swjgDm#,#bsdtDjxh#,#qhhm#,CONVERT(DATETIME,#qhsj#,120))
            SELECT SCOPE_IDENTITY() AS logXh
            ]]>
        </selectKey>
    </insert>

    <insert id="insertXtGt3SmbsLog_sqlServer" parameterClass="com.hst.common.bo.XtGt3SmbsLog">
        <selectKey resultClass="String" keyProperty="logXh" type="post">
            <![CDATA[

            insert into XT_GT3_SMBS_LOG(TRAN_ID,REQ_TIME,REQ_DATA,CLBZ,
            RES_TIME,RES_DATA,ERR_MESS,RES_CODE,RES_MESS,
            YWID,SWJG_DM,BSDT_DJXH,TIME_USED)
            values(#tranId:VARCHAR#,CONVERT (DATETIME,#reqTime#,120),#reqData#,#clbz#,
            CONVERT (DATETIME,#resTime#,120),#resData#,#errMess#,#resCode#,#resMess#,
            #ywid#,#swjgDm#,#bsdtDjxh#,#timeUsed#)
            SELECT SCOPE_IDENTITY() AS logXh
            ]]>
        </selectKey>
    </insert>

    <!--根据主键更新该表中其它所有字段-->
    <update id="updateXtGt3SmbsLogByKey_sqlServer" parameterClass="com.hst.common.bo.XtGt3SmbsLog">
        update XT_GT3_SMBS_LOG set CLBZ=#clbz#,RES_TIME=CONVERT (DATETIME,#resTime#, 120),
        RES_DATA=#resData#,ERR_MESS=#errMess#,RES_CODE=#resCode#,RES_MESS=#resMess#, TIME_USED = #timeUsed# where LOG_XH=#logXh#
    </update>


    <resultMap class="com.hst.task.domain.JhxxData" id="jhxtGetJhxxListRes">
        <result property="num" column="num"/>
        <result property="win" column="win"/>
        <result property="zt" column="zt"/>
        <result property="sj" column="sj"/>
        <result property="ywflbm" column="ywflbm"/>
    </resultMap>
    <parameterMap class="java.util.Map" id="jhxtGetJhxxListMap">
        <parameter property="bsdt_djxh" javaType="java.lang.String" jdbcType="VARCHAR" mode="IN"/>
        <parameter property="rows" javaType="java.lang.String" jdbcType="INT" mode="IN"/>
        <parameter property="page" javaType="java.lang.String" jdbcType="INT" mode="IN"/>
    </parameterMap>
    <procedure id="jhxtGetJhxxList" parameterMap="jhxtGetJhxxListMap" resultMap="jhxtGetJhxxListRes">
        {call BS_GETJHXXLIST(?,?,?)}
    </procedure>

    <select id="queryJhxtXtcs" resultClass="com.hst.framework.domain.JhxtXtcsDomain">
        select XTCS_XH xtcsXh,XTCS_VALUE xtcsValue from NSFW_CS_XTCS
    </select>
    <update id="updateServiceVersion" parameterClass="java.util.Map">
        UPDATE system SET [VALUE]=#value# where [key]  ='BS_SERVICE_VERSION'
    </update>
    <select id="querySjhmBySfzhm" parameterClass="java.util.HashMap" resultClass="java.lang.String">
        SELECT TOP 1 A.phone  FROM nsfw_sfzhm_phone A WHERE A.sfzhm = #sfzhm# order by a.update_time desc
    </select>

</sqlMap>