<?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.BackBusiConfDao">

    <insert id="insertSpInfo">
 	   INSERT INTO TB_SP_INFO(SPID,CPID,SPNAME,SHORTNAME,SPTYPE,SPEXPLAIN,PRICE,REGTIME,STARTDATE,FLOW,SPCODE,CANCANCELORDER,ISSYNC,PAYTYPE,HASLOCAL,PRODUCTYPE,FLOWTYPE,FLOWONLINE,MAXFLOW,CPTYPE,ISORDER,ISDIANBO,ISPRM,INMEAL,INCOMESTYLE)
    VALUES(#{SPID},#{CPID},#{SPNAME},#{SPNAME},'1',#{SPNAME},#{PRICE},SYSDATE,SYSDATE,#{MAXFLOW,jdbcType=VARCHAR},'','1','1',#{PAYTYPE,jdbcType=VARCHAR},'0',#{PRODUCTYPE},#{FLOWTYPE,jdbcType=VARCHAR},TRUNC(SYSDATE),#{MAXFLOW,jdbcType=VARCHAR},#{CPTYPE},#{ISORDER},#{IS_DIANBO},#{IS_PRM},#{IN_MEAL},#{INCOME_STYLE})
	    </insert>


    <insert id="insertBackBusi">
    INSERT INTO TB_BACKBUSI_CONF(ID,CPID,SPID,BUSITYPE,NETDAYS,PWD,STATUS,GOODSCODE,BUSINAME,VIPID,VIPCHANNEL,VIPPWD,HASSHARE,PRICE,ENDTYPE)
    VALUES(TO_CHAR(SYSDATE,'yyyyMMddhh24miss')||SEQ_COMMON6.nextval,#{CPID},#{SPID},#{BUSITYPE},#{NETDAYS,jdbcType=VARCHAR},'adcb1234',#{STATUS},#{SPID},#{BUSINAME},#{VIPID,jdbcType=VARCHAR},#{CPID}||'_'||#{SPID},#{VIPPWD,jdbcType=VARCHAR},#{HASSHARE,jdbcType=VARCHAR},#{PRICE},#{ENDTYPE,jdbcType=VARCHAR})
    </insert>

    <insert id="insertSyncSp">
    INSERT INTO TB_SYNC_SP_CONFIG (ID,SPID,CPID,TOSPID,TOCPID,SPTYPE,STATUS,SPNAME)
    VALUES(TO_CHAR(SYSDATE,'yyyyMMddhh24miss')||SEQ_COMMON6.nextval,#{SPID},#{CPID},#{TOSPID},#{TOCPID},'1',#{STATUS},#{SPNAME})
    </insert>

    <insert id="insertSyncConf">
        INSERT INTO TB_SYNC_CONFIG(CPID,SPID,STATUS,INSERTTIME,SYNCSTATUS)
        VALUES(#{CPID},#{SPID},#{STATUS},SYSDATE,#{SYNCSTATUS})
    </insert>

    <insert id="insertAop">
    INSERT INTO TB_SP_AOP_CONFIG(PRODUCT_ID,PRODUCT_NAME,PRODUCT_MODE,PACKAGE_FORCE_TAG,PACKAGE_DEFAULT_TAG,PACKAGE_ID,PACKAGE_NAME,ELEMENT_ID,ELEMENT_NAME,ELEMENT_TYPE_CODE,ELEMENT_FORCE_TAG,ELEMENT_DEFAULT_TAG,SP_ID,ENABLE_TAG)
    VALUES(#{PRODUCT_ID},#{SPNAME},#{PRODUCT_MODE},'必选','默认',#{PACKAGE_ID},#{SPNAME},#{ELEMENT_ID},#{SPNAME},#{ELEMENT_TYPE_CODE},'必选','默认',#{SPID},'1')
        </insert>

    <insert id="insertHsParams">
        INSERT INTO  TD_HS_BACKBUSI_CONF(ID,CPID,SPID,INPUT,SPNAME,PRODUCTYPE)
        values (TO_CHAR(SYSDATE,'yyyyMMddhh24miss')||SEQ_COMMON6.nextval,#{cpid},#{spid},#{input},#{spname},#{productype})
    </insert>
    <insert id="insertConf">
        INSERT INTO TB_UNIFIEDLIMIT_CONFIG ("ID", "CHANNEL", "CPID", "SPID", "IP", "INSERTTIME", "STATUS", "BUSITYPE", "NOTE", "INVOKEFACE")
        VALUES (TO_CHAR(SYSDATE,'yyyyMMddhh24miss')||SEQ_COMMON6.nextval, 'TX20_twback_old', #{cpid},#{spid}, '218.76.52.117|222.240.205.10|111.8.57.60|10.199.99.136|111.206.133.34|172.16.119.143|172.16.118.143|172.16.118.195|172.16.119.195|172.16.118.198|172.16.119.198|218.76.52.117|111.8.57.58|111.206.133.53|222.240.205.13|114.255.201.224', sysdate, '0', '0', '', 'backorder')
    </insert>


    <select id="findBySpid" resultType="java.lang.Integer">
        SELECT  COUNT(1) FROM TB_SP_INFO WHERE SPID=#{spid}
    </select>
</mapper>