<?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.CallSendDao" >    
	<select id="qrySpAopConfBySpid" parameterType="string" resultType="map">
		SELECT * FROM TB_SP_AOP_CONFIG WHERE SP_ID = #{spid}
	</select> 

    <insert id="addSmsorderLog" parameterType="Map">
    	INSERT INTO TL_SMSORDER_LOG (ID,USERID,CPID,SPID,CHANNEL,INVOKEFACE,TOKEN,RESULTCODE,ERRORINFO)
		VALUES (TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')||SEQ_PRO_COMMON.NEXTVAL,
		#{USERID},#{CPID},#{SPID},#{CHANNEL},#{INVOKEFACE,jdbcType=VARCHAR},#{TOKEN,jdbcType=VARCHAR},#{RESULTCODE},#{ERRORINFO,jdbcType=VARCHAR})
    </insert>
    
    <update id="updSmsorderLog" parameterType="Map" >
    	UPDATE TL_SMSORDER_LOG SET 
    	UPDTIME = SYSDATE, 
    	RESULTCODE = #{RESULTCODE},
    	ERRORINFO = #{ERRORINFO,jdbcType=VARCHAR}, 
    	TYPE = #{TYPE,jdbcType=VARCHAR},
    	INVOKEFACE = #{INVOKEFACE,jdbcType=VARCHAR},SMSTOKEN = #{SMSTOKEN,jdbcType=VARCHAR} WHERE TOKEN = #{TOKEN}
    </update>
    
    <select id="isTokenVali" parameterType="string" resultType="Integer">
    	select  count(1) cnt from tb_istoken_conf where cpid=#{cpid} and spid =#{spid} and channel in (#{channel},'*')  and status='0'
    </select>

</mapper>