Authored by simba

update

package com.monitor.mysql.mapper;
import java.util.List;
import com.model.RedisInfo;
import java.util.List;
public interface RedisMonitorMapper {
List<RedisInfo> selectRedisMonitor();
List<RedisInfo> selectAllRedisMonitor();
List<RedisInfo> selectRedisMonitorByLevel(int level);
... ...
<?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.RedisInfo" >
<id column="id" property="id" jdbcType="BIGINT" />
<result column="alias" property="alias" jdbcType="VARCHAR" />
<result column="host_ip" property="hostIp" jdbcType="VARCHAR" />
<result column="port" property="port" jdbcType="VARCHAR" />
<result column="level" property="level" jdbcType="TINYINT" />
<result column="node_from" property="nodeFrom" jdbcType="VARCHAR" />
<result column="node_to" property="nodeTo" jdbcType="VARCHAR" />
<result column="param_monitor" property="paramMonitor" jdbcType="VARCHAR" />
<result column="state" property="state" jdbcType="TINYINT" />
<result column="cloud_type" property="cloudType" 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, alias, host_ip, port, level, node_from, node_to, param_monitor, state, cloud_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.RedisInfo" >
insert into redis_monitor (id, alias, host_ip,
port, level, node_from,
node_to, param_monitor, state,
cloud_type, create_time, update_time
)
values (#{id,jdbcType=BIGINT}, #{alias,jdbcType=VARCHAR}, #{hostIp,jdbcType=VARCHAR},
#{port,jdbcType=VARCHAR}, #{level,jdbcType=TINYINT}, #{nodeFrom,jdbcType=VARCHAR},
#{nodeTo,jdbcType=VARCHAR}, #{paramMonitor,jdbcType=VARCHAR}, #{state,jdbcType=TINYINT},
#{cloudType,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
)
</insert>
<insert id="insertSelective" parameterType="com.model.RedisInfo" >
insert into redis_monitor
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="alias != null" >
alias,
</if>
<if test="hostIp != null" >
host_ip,
</if>
<if test="port != null" >
port,
</if>
<if test="level != null" >
level,
</if>
<if test="nodeFrom != null" >
node_from,
</if>
<if test="nodeTo != null" >
node_to,
</if>
<if test="paramMonitor != null" >
param_monitor,
</if>
<if test="state != null" >
state,
</if>
<if test="cloudType != null" >
cloud_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="alias != null" >
#{alias,jdbcType=VARCHAR},
</if>
<if test="hostIp != null" >
#{hostIp,jdbcType=VARCHAR},
</if>
<if test="port != null" >
#{port,jdbcType=VARCHAR},
</if>
<if test="level != null" >
#{level,jdbcType=TINYINT},
</if>
<if test="nodeFrom != null" >
#{nodeFrom,jdbcType=VARCHAR},
</if>
<if test="nodeTo != null" >
#{nodeTo,jdbcType=VARCHAR},
</if>
<if test="paramMonitor != null" >
#{paramMonitor,jdbcType=VARCHAR},
</if>
<if test="state != null" >
#{state,jdbcType=TINYINT},
</if>
<if test="cloudType != null" >
#{cloudType,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.RedisInfo" >
update redis_monitor
<set >
<if test="alias != null" >
alias = #{alias,jdbcType=VARCHAR},
</if>
<if test="hostIp != null" >
host_ip = #{hostIp,jdbcType=VARCHAR},
</if>
<if test="port != null" >
port = #{port,jdbcType=VARCHAR},
</if>
<if test="level != null" >
level = #{level,jdbcType=TINYINT},
</if>
<if test="nodeFrom != null" >
node_from = #{nodeFrom,jdbcType=VARCHAR},
</if>
<if test="nodeTo != null" >
node_to = #{nodeTo,jdbcType=VARCHAR},
</if>
<if test="paramMonitor != null" >
param_monitor = #{paramMonitor,jdbcType=VARCHAR},
</if>
<if test="state != null" >
state = #{state,jdbcType=TINYINT},
</if>
<if test="cloudType != null" >
cloud_type = #{cloudType,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.RedisInfo" >
update redis_monitor
set
param_monitor = #{paramMonitor},
update_time = now()
where id = #{id}
</update>
<select id="selectAllRedisMonitor" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from redis_monitor
where state = 1
</select>
<select id="selectRedisMonitorByLevel" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from redis_monitor
where level = #{level},
</select>
</mapper>
\ No newline at end of file
... ...