<?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.citygis.web.mapper.KafkaJKMapper">

    <select id="getTopicmsg" resultType="com.citygis.web.domain.TopicMsg" parameterType="string">
        SELECT TOPIC,PROJECT_NAME FROM RT_TOPIC rt
    </select>

    <select id="getTopicmsgCount" resultType="int" parameterType="string">
        SELECT COUNT(1) FROM RT_TOPIC rt
    </select>

    <select id="queryConsumerMsg" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT NUM,CREATE_TIME,TOPIC FROM LIU_TONG_YI.RT_CONSUMERMESSAGE WHERE TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

    <select id="queryConsumerSpeed" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT CONSUMET_SPEED,CREATE_TIME,TOPIC FROM LIU_TONG_YI.RT_CONSUMERMESSAGE WHERE TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

    <select id="queryPerSecMsgOut" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT PERSEC ,CREATE_TIME,TOPIC FROM LIU_TONG_YI.RT_PERSEC WHERE PERSEC_TYPE = '流出'
        AND TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

    <select id="queryPerSecMsgIn" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT PERSEC ,CREATE_TIME,TOPIC FROM LIU_TONG_YI.RT_PERSEC WHERE PERSEC_TYPE = '流入'
        AND TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

    <select id="queryTopicSize" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT
        num ,
        CREATE_TIME,
        TOPIC
        FROM
        LIU_TONG_YI.RT_TOPICSIZE WHERE TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

    <select id="queryInXL" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT
        num ,
        CREATE_TIME,
        TOPIC
        FROM
        LIU_TONG_YI.RT_THROTTLEDRATE
        WHERE
        NUM_TYPE = '生产'
        AND TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

    <select id="queryOutXL" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT
        num ,
        CREATE_TIME,
        TOPIC
        FROM
        LIU_TONG_YI.RT_THROTTLEDRATE
        WHERE
        NUM_TYPE = '消费'
        AND TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

    <select id="queryLagMsg" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT
        num ,
        CREATE_TIME,
        TOPIC
        FROM
        LIU_TONG_YI.RT_LAGMESSAGE
        WHERE TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

    <select id="queryEndOffsetMsg" parameterType="com.citygis.web.domain.JKVo"
            resultType="com.citygis.web.domain.JKindex">
        SELECT
        ENDOFFSET,
        CREATE_TIME,
        TOPIC
        FROM
        LIU_TONG_YI.RT_LAGMESSAGE
        WHERE TOPIC = #{topic}
        <if test="startTime != null and startTime != ''">
            AND
            TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') >= #{startTime} AND TO_CHAR(CREATE_TIME,'YYYY-MM-DD
            HH24:MI:SS') &lt;= #{endTime}
        </if>
        ORDER BY CREATE_TIME
    </select>

</mapper>
