<?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.mapper.ChannelBusiLimitDao" >

    <select id="qryChannelConfById" parameterType="string"  resultType="com.chinacreator.video.bean.ChannelBean" >
       SELECT 
       id, password, ispage, shape, parentid, ip, 
       TO_CHAR(onlinetime,'YYYYMMDDHH24MISS') onlinetime, TO_CHAR(offlinetime,'YYYYMMDDHH24MISS') offlinetime
	   FROM  TB_CHANNEL_ORG where status=0 and id=#{id,jdbcType=VARCHAR}
    </select>
    
    <select id="qrySpinfoConf" parameterType="string" resultType="java.lang.Integer">
    	SELECT COUNT(1) CNT FROM TB_SP_INFO WHERE SPID = #{spid,jdbcType=VARCHAR} AND DIRECTYPE = #{directype}
    </select>
    
    <select id="qryOneChannelConf" parameterType="string" resultType="java.lang.Integer">
    	SELECT COUNT(1) CNT FROM tb_one_channel_org WHERE ID = #{id,jdbcType=VARCHAR} AND STATUS = '0' AND SYSDATE BETWEEN ONLINETIME and OFFLINETIME
    </select>
    
    <select id="qryChannelBusiLimitConf" parameterType="string" resultType="map">
    	SELECT CHANNEL, CPID, SPID, LIMITTYPE FROM TB_CHANNEL_BUSILIMIT_CONF WHERE STATUS = '0' AND TYPE = #{type} AND CHANNEL = #{channel} ORDER BY LIMITTYPE
    </select>
    
    <select id="hasBackBusiConf" resultType="java.lang.Integer" parameterType="string">
			SELECT COUNT(1) CNT FROM TB_BACKBUSI_CONF WHERE CPID = #{cpid} AND SPID = #{spid}
    </select>

</mapper>
