HystrixInfoConfigMapper.xml 3.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.HystrixInfoConfigMapper" >
  <resultMap id="BaseResultMap" type="com.monitor.model.domain.HystrixInfoConfig" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="config_name" property="configName" jdbcType="VARCHAR" />
    <result column="config_value" property="configValue" jdbcType="VARCHAR" />
    <result column="config_desc" property="configDesc" jdbcType="VARCHAR" />
    <result column="config_cat" property="configCat" jdbcType="VARCHAR" />
    <result column="server_type" property="serverType" jdbcType="VARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, config_name, config_value, config_desc, config_cat, server_type
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from hystrix_info
    where id = #{id,jdbcType=INTEGER}
  </select>
  
  <select id="selectDistinctCategories" resultType="java.lang.String" >
    select 
    distinct config_cat
    from hystrix_info
  </select>
  <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.monitor.model.request.HystrixInfoReq">
      select
      <include refid="Base_Column_List" />
      from hystrix_info
      where 1=1
      <if test="id != null and id !=0" >
          and id = #{id}
      </if>
      <if test="configName != null and configName != '' " >
          and config_name = #{configName}
      </if>
      <if test="configCat != null and configCat != 0 " >
          and config_cat = #{configCat}
      </if>
      <if test="serverType != null and serverType != 'all' " >
          and server_type = #{serverType}
      </if>
  </select>

  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from hystrix_info
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.monitor.model.domain.DegradeConfig" >
    insert into hystrix_info (id, config_name, config_value, config_desc, config_cat, server_type)
    values (#{id,jdbcType=INTEGER}, #{configName,jdbcType=VARCHAR}, #{configValue,jdbcType=VARCHAR},#{configDesc,jdbcType=VARCHAR},
      #{configCat,jdbcType=INTEGER},#{serverType,jdbcType=VARCHAR})
  </insert>
    
  <update id="updateByPrimaryKey" parameterType="com.monitor.model.domain.HystrixInfoConfig" >
    update hystrix_info
    <set >
      <if test="configName != null" >
        config_name = #{configName,jdbcType=VARCHAR},
      </if>
      <if test="configValue != null" >
        config_value = #{configValue,jdbcType=VARCHAR},
      </if>
      <if test="configDesc != null" >
        config_desc = #{configDesc,jdbcType=VARCHAR},
      </if>
      <if test="configCat != null" >
        config_cat = #{configCat,jdbcType=INTEGER},
      </if>
      <if test="serverType != null" >
        server_type = #{serverType,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>