<?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.chinacreator.video.restful.dao.HuaweiWalletDao" >

    <select id="queryrecharge" resultType="java.util.Map">
        select id ,userid,spid ,orderno,hwspid,status,productype,facevalue,notifyParam1,notifyParam2,notifyParam3,notifyurl,SIGNTYPE,to_char(ordertime,'yyyy-MM-dd hh24:mi:ss') ORDERTIME,to_char(rechargetime,'yyyy-MM-dd hh24:mi:ss') RECHARGETIME from TD_HUAWEI_ORDER_REC
        where userid=#{userid}  and orderno=#{orderid}
    </select>

    <select id="isBlackUser" resultType="Integer">
        select count(userid) from TB_BLACKWHITE_LIST where userid=#{userid} and (cpid='0' or cpid=#{cpid}) and type=1 AND (STATUS is null or STATUS = 0)
    </select>

    <insert id="addHuaweiSmsorderLog" parameterType="Map">
        INSERT INTO tl_huawei_order_log (ID,USERID,SPID,CPID,CHANNEL,VCODE,TIMES,INVOKE,REQUESTID,SIGN,SIGNTYPE,SIGNVERSION,REQDATA,RETURNCODE,RETURNDESC)
        VALUES (TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')||SEQ_PRO_COMMON.NEXTVAL,
                #{userid,jdbcType=VARCHAR},#{spid,jdbcType=VARCHAR},#{cpid,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{vcode,jdbcType=VARCHAR},#{times,jdbcType=VARCHAR},#{invoke,jdbcType=VARCHAR},#{requestId,jdbcType=VARCHAR},#{sign,jdbcType=VARCHAR},#{signType,jdbcType=VARCHAR},#{signVersion,jdbcType=VARCHAR},#{reqData,jdbcType=VARCHAR},#{returnCode,jdbcType=VARCHAR},#{returnDesc,jdbcType=VARCHAR})
    </insert>

    <insert id="addHuaweiOrderRec" parameterType="Map">
        insert into td_huawei_order_rec (id,userid,spid,cpid,channel,vcode,token,orderno,hwspid,productype,facevalue,notifyParam1,notifyParam2,notifyParam3,timestamp,signtype,notifyurl)
        values (TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')||SEQ_PRO_COMMON.NEXTVAL, #{userid,jdbcType=VARCHAR},#{spid,jdbcType=VARCHAR},#{cpid,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{vcode,jdbcType=VARCHAR},
                #{token,jdbcType=VARCHAR},#{orderno,jdbcType=VARCHAR},#{hwspid,jdbcType=VARCHAR},#{productType,jdbcType=VARCHAR},#{faceValue,jdbcType=VARCHAR},#{notifyParam1,jdbcType=VARCHAR},#{notifyParam2,jdbcType=VARCHAR},
                #{notifyParam3,jdbcType=VARCHAR},#{timestamp,jdbcType=VARCHAR},#{signType,jdbcType=VARCHAR},#{notifyUrl,jdbcType=VARCHAR})
    </insert>

    <select id="getSpOrderNo" resultType="String">
        select ID from td_huawei_order_rec where ORDERNO = #{orderNo}
    </select>

</mapper>