ZabbixHostMapper.xml 916 Bytes
<?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.ZabbixHostMapper">
  <resultMap id="hostInfoMapper" type="com.monitor.zabbix.model.ZabbixHostInfo" >
    <id column="interfaceid" property="interfaceId" jdbcType="INTEGER" />
    <result column="hostid" property="hostId" jdbcType="INTEGER" />
    <result column="ip" property="ip" jdbcType="VARCHAR" />
  </resultMap>

  <select id="queryHostInfo" resultMap="hostInfoMapper">
    select
    interfaceid,hostid,ip
    from interface
    where ip IN
    <foreach collection="list" index="index" item="item" close=")" open="(" separator=",">
      #{item}
            </foreach>
  </select>

  <select id="queryAllHostInfo" resultMap="hostInfoMapper">
    SELECT interfaceid,hostid,ip FROM `interface` ;
  </select>
</mapper>