RedisMonitorMapper.xml 6.07 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.mysql.mapper.RedisMonitorMapper" >
  <resultMap id="BaseResultMap" type="com.model.RedisMonitor" >
    <id column="id" property="id" jdbcType="BIGINT" />
    <result column="node_from" property="nodeFrom" jdbcType="VARCHAR" />
    <result column="node_to" property="nodeTo" jdbcType="VARCHAR" />
    <result column="level" property="level" jdbcType="TINYINT" />
    <result column="param_monitor" property="paramMonitor" jdbcType="VARCHAR" />
    <result column="is_failed" property="isFailed" jdbcType="TINYINT" />
    <result column="is_slave" property="isSlave" jdbcType="TINYINT" />
    <result column="redis_type" property="redisType" jdbcType="TINYINT" />
    <result column="create_time" property="createTime" jdbcType="TIMESTAMP" />
    <result column="update_time" property="updateTime" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, node_from, node_to, level, param_monitor, is_failed, is_slave, redis_type, create_time,
    update_time
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
    select
    <include refid="Base_Column_List" />
    from redis_monitor
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
    delete from redis_monitor
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <insert id="insert" parameterType="com.model.RedisMonitor" >
    insert into redis_monitor (id, node_from, node_to,
    level, param_monitor, is_failed,
    is_slave, redis_type, create_time,
    update_time)
    values (#{id,jdbcType=BIGINT}, #{nodeFrom,jdbcType=VARCHAR}, #{nodeTo,jdbcType=VARCHAR},
    #{level,jdbcType=TINYINT}, #{paramMonitor,jdbcType=VARCHAR}, #{isFailed,jdbcType=TINYINT},
    #{isSlave,jdbcType=TINYINT}, #{redisType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP},
    #{updateTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.model.RedisMonitor" >
    insert into redis_monitor
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="nodeFrom != null" >
        node_from,
      </if>
      <if test="nodeTo != null" >
        node_to,
      </if>
      <if test="level != null" >
        level,
      </if>
      <if test="paramMonitor != null" >
        param_monitor,
      </if>
      <if test="isFailed != null" >
        is_failed,
      </if>
      <if test="isSlave != null" >
        is_slave,
      </if>
      <if test="redisType != null" >
        redis_type,
      </if>
      <if test="createTime != null" >
        create_time,
      </if>
      <if test="updateTime != null" >
        update_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=BIGINT},
      </if>
      <if test="nodeFrom != null" >
        #{nodeFrom,jdbcType=VARCHAR},
      </if>
      <if test="nodeTo != null" >
        #{nodeTo,jdbcType=VARCHAR},
      </if>
      <if test="level != null" >
        #{level,jdbcType=TINYINT},
      </if>
      <if test="paramMonitor != null" >
        #{paramMonitor,jdbcType=VARCHAR},
      </if>
      <if test="isFailed != null" >
        #{isFailed,jdbcType=TINYINT},
      </if>
      <if test="isSlave != null" >
        #{isSlave,jdbcType=TINYINT},
      </if>
      <if test="redisType != null" >
        #{redisType,jdbcType=TINYINT},
      </if>
      <if test="createTime != null" >
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.model.RedisMonitor" >
    update redis_monitor
    <set >
      <if test="nodeFrom != null" >
        node_from = #{nodeFrom,jdbcType=VARCHAR},
      </if>
      <if test="nodeTo != null" >
        node_to = #{nodeTo,jdbcType=VARCHAR},
      </if>
      <if test="level != null" >
        level = #{level,jdbcType=TINYINT},
      </if>
      <if test="paramMonitor != null" >
        param_monitor = #{paramMonitor,jdbcType=VARCHAR},
      </if>
      <if test="isFailed != null" >
        is_failed = #{isFailed,jdbcType=TINYINT},
      </if>
      <if test="isSlave != null" >
        is_slave = #{isSlave,jdbcType=TINYINT},
      </if>
      <if test="redisType != null" >
        redis_type = #{redisType,jdbcType=TINYINT},
      </if>
      <if test="createTime != null" >
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null" >
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.model.RedisMonitor" >
    update redis_monitor
    set node_from = #{nodeFrom,jdbcType=VARCHAR},
      node_to = #{nodeTo,jdbcType=VARCHAR},
      level = #{level,jdbcType=TINYINT},
      param_monitor = #{paramMonitor,jdbcType=VARCHAR},
      is_failed = #{isFailed,jdbcType=TINYINT},
      is_slave = #{isSlave,jdbcType=TINYINT},
      redis_type = #{redisType,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>

  <delete id="deleteAllRedisMonitor">
    delete from redis_monitor
  </delete>

  <insert id="bachInsertRedisMonitor" parameterType="com.model.RedisMonitor">
    insert into redis_monitor
    (node_from, node_to,level,is_failed,is_slave,redis_type,param_monitor)
    values
    <foreach collection="list" item="item" index="index"
             separator=",">
      (#{item.nodeFrom},#{item.nodeTo},#{item.level},#{item.isFailed},#{item.isSlave},#{item.redisType},#{item.paramMonitor})
    </foreach>
  </insert>

  <select id="selectAllRedisMonitors" resultMap="BaseResultMap" >
    select
    <include refid="Base_Column_List" />
    from redis_monitor order by redis_type ,level
  </select>


</mapper>