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

    <insert id="addDiskUsage">
        INSERT INTO LIU_TONG_YI.RT_DISK_USAGE
        (ID, CREATE_TIME, DISK_USAGE)
        VALUES(#{id}, #{createTime}, #{diskUsage});
    </insert>

    <insert id="addCpuUsage">
        INSERT INTO LIU_TONG_YI.RT_CPU_USAGE
        (ID, CREATE_TIME, CPU_USAGE)
        VALUES(#{id}, #{createTime}, #{cpuUsage});
    </insert>

    <insert id="addUnderreplicated">
        INSERT INTO LIU_TONG_YI.RT_UNDERREPLICATED
        (ID, CREATE_TIME, NUM,TOPIC,"PARTITION")
        VALUES(#{id}, #{createTime}, #{num},#{topic},#{partition});
    </insert>

    <insert id="addPersec">
        INSERT INTO LIU_TONG_YI.RT_PERSEC
        (ID, CREATE_TIME, PERSEC, PERSEC_TYPE,TOPIC)
        VALUES(#{id}, #{createTime}, #{persec},#{persecType},#{topic});
    </insert>

    <insert id="addConsumerMessage">
        INSERT INTO LIU_TONG_YI.RT_CONSUMERMESSAGE
        (ID, CREATE_TIME, NUM, TOPIC,CONSUMET_SPEED)
        VALUES(#{id}, #{createTime}, #{num},#{topic},#{consumerSpeed});
    </insert>

    <select id="queryMaxNum" parameterType="string" resultType="int">
        SELECT NUM
        FROM LIU_TONG_YI.RT_CONSUMERMESSAGE
        WHERE TOPIC = #{topic}
        AND CREATE_TIME = (
        SELECT MAX(CREATE_TIME)
        FROM LIU_TONG_YI.RT_CONSUMERMESSAGE
        WHERE TOPIC = #{topic}
        )
    </select>

    <select id="addConnectionNum" parameterType="string" resultType="int">
        INSERT INTO LIU_TONG_YI.RT_CONNECTION
        (ID, CREATE_TIME, CONNECTION_NUM)
        VALUES(#{id}, #{createTime}, #{connectionNum});
    </select>

    <insert id="addTopicSize">
        INSERT INTO LIU_TONG_YI.RT_TOPICSIZE
        (ID, CREATE_TIME, NUM, TOPIC)
        VALUES(#{id}, #{createTime}, #{num},#{topic});
    </insert>

    <insert id="addThrottledrate">
        INSERT INTO LIU_TONG_YI.RT_THROTTLEDRATE
        (ID, CREATE_TIME, NUM, NUM_TYPE, TOPIC)
        VALUES(#{id}, #{createTime}, #{num},#{numType},#{topic});
    </insert>

    <insert id="addLagMsg">
        INSERT INTO LIU_TONG_YI.RT_LAGMESSAGE
        (ID, CREATE_TIME, NUM, TOPIC,ENDOFFSET)
        VALUES(#{id}, #{createTime}, #{num},#{topic},#{endOffset});
    </insert>

</mapper>
