ConfigCenterInfoMapper.xml 3.03 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.ConfigCenterInfoMapper" >
  <resultMap id="BaseResultMap" type="com.monitor.model.domain.ConfigCenterInfo" >
    <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 configcenter_info
    where id = #{id,jdbcType=INTEGER}
  </select>
  
  <select id="selectDistinctCategories" resultType="java.lang.String" >
    select 
    distinct config_cat
    from configcenter_info
  </select>
  <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.monitor.model.domain.ConfigCenterInfo">
      select
      <include refid="Base_Column_List" />
      from configcenter_info
      where 1=1
      <if test="configName != null and configName != '' " >
          and config_name = #{configName}
      </if>
      <if test="configCat != null and configCat != '' " >
          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 configcenter_info
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.monitor.model.domain.ConfigCenterInfo" >
    insert into configcenter_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.ConfigCenterInfo" >
    update configcenter_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>