Authored by simba

update

1 package com.monitor.mysql.mapper; 1 package com.monitor.mysql.mapper;
2 2
3 -import java.util.List;  
4 -  
5 import com.model.RedisInfo; 3 import com.model.RedisInfo;
6 4
  5 +import java.util.List;
  6 +
7 public interface RedisMonitorMapper { 7 public interface RedisMonitorMapper {
8 8
9 - List<RedisInfo> selectRedisMonitor(); 9 + List<RedisInfo> selectAllRedisMonitor();
10 10
11 List<RedisInfo> selectRedisMonitorByLevel(int level); 11 List<RedisInfo> selectRedisMonitorByLevel(int level);
12 12
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.monitor.mysql.mapper.RedisMonitorMapper" >
  4 + <resultMap id="BaseResultMap" type="com.model.RedisInfo" >
  5 + <id column="id" property="id" jdbcType="BIGINT" />
  6 + <result column="alias" property="alias" jdbcType="VARCHAR" />
  7 + <result column="host_ip" property="hostIp" jdbcType="VARCHAR" />
  8 + <result column="port" property="port" jdbcType="VARCHAR" />
  9 + <result column="level" property="level" jdbcType="TINYINT" />
  10 + <result column="node_from" property="nodeFrom" jdbcType="VARCHAR" />
  11 + <result column="node_to" property="nodeTo" jdbcType="VARCHAR" />
  12 + <result column="param_monitor" property="paramMonitor" jdbcType="VARCHAR" />
  13 + <result column="state" property="state" jdbcType="TINYINT" />
  14 + <result column="cloud_type" property="cloudType" jdbcType="TINYINT" />
  15 + <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
  16 + <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  17 + </resultMap>
  18 + <sql id="Base_Column_List" >
  19 + id, alias, host_ip, port, level, node_from, node_to, param_monitor, state, cloud_type,
  20 + create_time, update_time
  21 + </sql>
  22 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
  23 + select
  24 + <include refid="Base_Column_List" />
  25 + from redis_monitor
  26 + where id = #{id,jdbcType=BIGINT}
  27 + </select>
  28 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
  29 + delete from redis_monitor
  30 + where id = #{id,jdbcType=BIGINT}
  31 + </delete>
  32 + <insert id="insert" parameterType="com.model.RedisInfo" >
  33 + insert into redis_monitor (id, alias, host_ip,
  34 + port, level, node_from,
  35 + node_to, param_monitor, state,
  36 + cloud_type, create_time, update_time
  37 + )
  38 + values (#{id,jdbcType=BIGINT}, #{alias,jdbcType=VARCHAR}, #{hostIp,jdbcType=VARCHAR},
  39 + #{port,jdbcType=VARCHAR}, #{level,jdbcType=TINYINT}, #{nodeFrom,jdbcType=VARCHAR},
  40 + #{nodeTo,jdbcType=VARCHAR}, #{paramMonitor,jdbcType=VARCHAR}, #{state,jdbcType=TINYINT},
  41 + #{cloudType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
  42 + )
  43 + </insert>
  44 + <insert id="insertSelective" parameterType="com.model.RedisInfo" >
  45 + insert into redis_monitor
  46 + <trim prefix="(" suffix=")" suffixOverrides="," >
  47 + <if test="id != null" >
  48 + id,
  49 + </if>
  50 + <if test="alias != null" >
  51 + alias,
  52 + </if>
  53 + <if test="hostIp != null" >
  54 + host_ip,
  55 + </if>
  56 + <if test="port != null" >
  57 + port,
  58 + </if>
  59 + <if test="level != null" >
  60 + level,
  61 + </if>
  62 + <if test="nodeFrom != null" >
  63 + node_from,
  64 + </if>
  65 + <if test="nodeTo != null" >
  66 + node_to,
  67 + </if>
  68 + <if test="paramMonitor != null" >
  69 + param_monitor,
  70 + </if>
  71 + <if test="state != null" >
  72 + state,
  73 + </if>
  74 + <if test="cloudType != null" >
  75 + cloud_type,
  76 + </if>
  77 + <if test="createTime != null" >
  78 + create_time,
  79 + </if>
  80 + <if test="updateTime != null" >
  81 + update_time,
  82 + </if>
  83 + </trim>
  84 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  85 + <if test="id != null" >
  86 + #{id,jdbcType=BIGINT},
  87 + </if>
  88 + <if test="alias != null" >
  89 + #{alias,jdbcType=VARCHAR},
  90 + </if>
  91 + <if test="hostIp != null" >
  92 + #{hostIp,jdbcType=VARCHAR},
  93 + </if>
  94 + <if test="port != null" >
  95 + #{port,jdbcType=VARCHAR},
  96 + </if>
  97 + <if test="level != null" >
  98 + #{level,jdbcType=TINYINT},
  99 + </if>
  100 + <if test="nodeFrom != null" >
  101 + #{nodeFrom,jdbcType=VARCHAR},
  102 + </if>
  103 + <if test="nodeTo != null" >
  104 + #{nodeTo,jdbcType=VARCHAR},
  105 + </if>
  106 + <if test="paramMonitor != null" >
  107 + #{paramMonitor,jdbcType=VARCHAR},
  108 + </if>
  109 + <if test="state != null" >
  110 + #{state,jdbcType=TINYINT},
  111 + </if>
  112 + <if test="cloudType != null" >
  113 + #{cloudType,jdbcType=TINYINT},
  114 + </if>
  115 + <if test="createTime != null" >
  116 + #{createTime,jdbcType=TIMESTAMP},
  117 + </if>
  118 + <if test="updateTime != null" >
  119 + #{updateTime,jdbcType=TIMESTAMP},
  120 + </if>
  121 + </trim>
  122 + </insert>
  123 + <update id="updateByPrimaryKeySelective" parameterType="com.model.RedisInfo" >
  124 + update redis_monitor
  125 + <set >
  126 + <if test="alias != null" >
  127 + alias = #{alias,jdbcType=VARCHAR},
  128 + </if>
  129 + <if test="hostIp != null" >
  130 + host_ip = #{hostIp,jdbcType=VARCHAR},
  131 + </if>
  132 + <if test="port != null" >
  133 + port = #{port,jdbcType=VARCHAR},
  134 + </if>
  135 + <if test="level != null" >
  136 + level = #{level,jdbcType=TINYINT},
  137 + </if>
  138 + <if test="nodeFrom != null" >
  139 + node_from = #{nodeFrom,jdbcType=VARCHAR},
  140 + </if>
  141 + <if test="nodeTo != null" >
  142 + node_to = #{nodeTo,jdbcType=VARCHAR},
  143 + </if>
  144 + <if test="paramMonitor != null" >
  145 + param_monitor = #{paramMonitor,jdbcType=VARCHAR},
  146 + </if>
  147 + <if test="state != null" >
  148 + state = #{state,jdbcType=TINYINT},
  149 + </if>
  150 + <if test="cloudType != null" >
  151 + cloud_type = #{cloudType,jdbcType=TINYINT},
  152 + </if>
  153 + <if test="createTime != null" >
  154 + create_time = #{createTime,jdbcType=TIMESTAMP},
  155 + </if>
  156 + <if test="updateTime != null" >
  157 + update_time = #{updateTime,jdbcType=TIMESTAMP},
  158 + </if>
  159 + </set>
  160 + where id = #{id,jdbcType=BIGINT}
  161 + </update>
  162 + <update id="updateByPrimaryKey" parameterType="com.model.RedisInfo" >
  163 + update redis_monitor
  164 + set
  165 + param_monitor = #{paramMonitor},
  166 + update_time = now()
  167 + where id = #{id}
  168 + </update>
  169 + <select id="selectAllRedisMonitor" resultMap="BaseResultMap">
  170 + select
  171 + <include refid="Base_Column_List" />
  172 + from redis_monitor
  173 + where state = 1
  174 + </select>
  175 +
  176 + <select id="selectRedisMonitorByLevel" resultMap="BaseResultMap">
  177 + select
  178 + <include refid="Base_Column_List" />
  179 + from redis_monitor
  180 + where level = #{level},
  181 + </select>
  182 +
  183 +</mapper>