ZabbixHistoryMapper.xml 1.29 KB
<?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.monitor.zabbix.mapper.ZabbixHistoryMapper">
    <resultMap id="dHistoryInfoMapper" type="com.monitor.zabbix.model.ZabbixDHistoryInfo">
        <result column="itemid" property="itemId" jdbcType="INTEGER"/>
        <result column="value" property="value" jdbcType="DOUBLE"/>
        <result column="clock" property="clock" jdbcType="INTEGER"/>
    </resultMap>

    <resultMap id="uHistoryInfoMapper" type="com.monitor.zabbix.model.ZabbixUHistoryInfo">
        <result column="itemid" property="itemId" jdbcType="INTEGER"/>
        <result column="value" property="value" jdbcType="BIGINT"/>
        <result column="clock" property="clock" jdbcType="INTEGER"/>
    </resultMap>

    <select id="queryDHistoryInfo" resultMap="dHistoryInfoMapper">
        select
        itemid,`value`,clock
        from history
        where itemid = #{itemId,jdbcType=INTEGER}
        order by clock desc limit 1;
    </select>

    <select id="queryUHistoryInfo" resultMap="uHistoryInfoMapper">
        select itemid,`value`,clock
        from history_uint
        where itemid = #{itemId,jdbcType=INTEGER}
        order by clock desc limit 1;
    </select>


</mapper>