<?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.didi.carrera.console.dao.mapper.TopicConfMapper">
  <resultMap id="BaseResultMap" type="com.didi.carrera.console.dao.model.TopicConf">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="topic_id" jdbcType="BIGINT" property="topicId" />
    <result column="topic_name" jdbcType="VARCHAR" property="topicName" />
    <result column="cluster_id" jdbcType="BIGINT" property="clusterId" />
    <result column="cluster_name" jdbcType="VARCHAR" property="clusterName" />
    <result column="mq_server_id" jdbcType="BIGINT" property="mqServerId" />
    <result column="mq_server_name" jdbcType="VARCHAR" property="mqServerName" />
    <result column="server_idc_id" jdbcType="BIGINT" property="serverIdcId" />
    <result column="server_idc_name" jdbcType="VARCHAR" property="serverIdcName" />
    <result column="client_idc" jdbcType="VARCHAR" property="clientIdc" />
    <result column="produce_tps" jdbcType="INTEGER" property="produceTps" />
    <result column="msg_avg_size" jdbcType="INTEGER" property="msgAvgSize" />
    <result column="msg_max_size" jdbcType="INTEGER" property="msgMaxSize" />
    <result column="state" jdbcType="TINYINT" property="state" />
    <result column="config" jdbcType="VARCHAR" property="config" />
    <result column="is_delete" jdbcType="TINYINT" property="isDelete" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, topic_id, topic_name, cluster_id, cluster_name, mq_server_id, mq_server_name, 
    server_idc_id, server_idc_name, client_idc, produce_tps, msg_avg_size, msg_max_size, 
    state, config, is_delete, create_time, modify_time
  </sql>
  <select id="selectByExample" parameterType="com.didi.carrera.console.dao.model.TopicConfCriteria" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from topic_conf
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="start != null and start >= 0 ">
      limit #{start}
    </if>
    <if test="start != null and start >= 0 and end != null and end >= 0">
      , #{end}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from topic_conf
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from topic_conf
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.didi.carrera.console.dao.model.TopicConfCriteria">
    delete from topic_conf
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.didi.carrera.console.dao.model.TopicConf" useGeneratedKeys="true">
    insert into topic_conf (topic_id, topic_name, cluster_id, 
      cluster_name, mq_server_id, mq_server_name, 
      server_idc_id, server_idc_name, client_idc, 
      produce_tps, msg_avg_size, msg_max_size, 
      state, config, is_delete, 
      create_time, modify_time)
    values (#{topicId,jdbcType=BIGINT}, #{topicName,jdbcType=VARCHAR}, #{clusterId,jdbcType=BIGINT}, 
      #{clusterName,jdbcType=VARCHAR}, #{mqServerId,jdbcType=BIGINT}, #{mqServerName,jdbcType=VARCHAR}, 
      #{serverIdcId,jdbcType=BIGINT}, #{serverIdcName,jdbcType=VARCHAR}, #{clientIdc,jdbcType=VARCHAR}, 
      #{produceTps,jdbcType=INTEGER}, #{msgAvgSize,jdbcType=INTEGER}, #{msgMaxSize,jdbcType=INTEGER}, 
      #{state,jdbcType=TINYINT}, #{config,jdbcType=VARCHAR}, #{isDelete,jdbcType=TINYINT}, 
      #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.didi.carrera.console.dao.model.TopicConf" useGeneratedKeys="true">
    insert into topic_conf
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="topicId != null">
        topic_id,
      </if>
      <if test="topicName != null">
        topic_name,
      </if>
      <if test="clusterId != null">
        cluster_id,
      </if>
      <if test="clusterName != null">
        cluster_name,
      </if>
      <if test="mqServerId != null">
        mq_server_id,
      </if>
      <if test="mqServerName != null">
        mq_server_name,
      </if>
      <if test="serverIdcId != null">
        server_idc_id,
      </if>
      <if test="serverIdcName != null">
        server_idc_name,
      </if>
      <if test="clientIdc != null">
        client_idc,
      </if>
      <if test="produceTps != null">
        produce_tps,
      </if>
      <if test="msgAvgSize != null">
        msg_avg_size,
      </if>
      <if test="msgMaxSize != null">
        msg_max_size,
      </if>
      <if test="state != null">
        state,
      </if>
      <if test="config != null">
        config,
      </if>
      <if test="isDelete != null">
        is_delete,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="modifyTime != null">
        modify_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="topicId != null">
        #{topicId,jdbcType=BIGINT},
      </if>
      <if test="topicName != null">
        #{topicName,jdbcType=VARCHAR},
      </if>
      <if test="clusterId != null">
        #{clusterId,jdbcType=BIGINT},
      </if>
      <if test="clusterName != null">
        #{clusterName,jdbcType=VARCHAR},
      </if>
      <if test="mqServerId != null">
        #{mqServerId,jdbcType=BIGINT},
      </if>
      <if test="mqServerName != null">
        #{mqServerName,jdbcType=VARCHAR},
      </if>
      <if test="serverIdcId != null">
        #{serverIdcId,jdbcType=BIGINT},
      </if>
      <if test="serverIdcName != null">
        #{serverIdcName,jdbcType=VARCHAR},
      </if>
      <if test="clientIdc != null">
        #{clientIdc,jdbcType=VARCHAR},
      </if>
      <if test="produceTps != null">
        #{produceTps,jdbcType=INTEGER},
      </if>
      <if test="msgAvgSize != null">
        #{msgAvgSize,jdbcType=INTEGER},
      </if>
      <if test="msgMaxSize != null">
        #{msgMaxSize,jdbcType=INTEGER},
      </if>
      <if test="state != null">
        #{state,jdbcType=TINYINT},
      </if>
      <if test="config != null">
        #{config,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        #{isDelete,jdbcType=TINYINT},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null">
        #{modifyTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.didi.carrera.console.dao.model.TopicConfCriteria" resultType="java.lang.Long">
    select count(*) from topic_conf
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update topic_conf
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.topicId != null">
        topic_id = #{record.topicId,jdbcType=BIGINT},
      </if>
      <if test="record.topicName != null">
        topic_name = #{record.topicName,jdbcType=VARCHAR},
      </if>
      <if test="record.clusterId != null">
        cluster_id = #{record.clusterId,jdbcType=BIGINT},
      </if>
      <if test="record.clusterName != null">
        cluster_name = #{record.clusterName,jdbcType=VARCHAR},
      </if>
      <if test="record.mqServerId != null">
        mq_server_id = #{record.mqServerId,jdbcType=BIGINT},
      </if>
      <if test="record.mqServerName != null">
        mq_server_name = #{record.mqServerName,jdbcType=VARCHAR},
      </if>
      <if test="record.serverIdcId != null">
        server_idc_id = #{record.serverIdcId,jdbcType=BIGINT},
      </if>
      <if test="record.serverIdcName != null">
        server_idc_name = #{record.serverIdcName,jdbcType=VARCHAR},
      </if>
      <if test="record.clientIdc != null">
        client_idc = #{record.clientIdc,jdbcType=VARCHAR},
      </if>
      <if test="record.produceTps != null">
        produce_tps = #{record.produceTps,jdbcType=INTEGER},
      </if>
      <if test="record.msgAvgSize != null">
        msg_avg_size = #{record.msgAvgSize,jdbcType=INTEGER},
      </if>
      <if test="record.msgMaxSize != null">
        msg_max_size = #{record.msgMaxSize,jdbcType=INTEGER},
      </if>
      <if test="record.state != null">
        state = #{record.state,jdbcType=TINYINT},
      </if>
      <if test="record.config != null">
        config = #{record.config,jdbcType=VARCHAR},
      </if>
      <if test="record.isDelete != null">
        is_delete = #{record.isDelete,jdbcType=TINYINT},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.modifyTime != null">
        modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update topic_conf
    set id = #{record.id,jdbcType=BIGINT},
      topic_id = #{record.topicId,jdbcType=BIGINT},
      topic_name = #{record.topicName,jdbcType=VARCHAR},
      cluster_id = #{record.clusterId,jdbcType=BIGINT},
      cluster_name = #{record.clusterName,jdbcType=VARCHAR},
      mq_server_id = #{record.mqServerId,jdbcType=BIGINT},
      mq_server_name = #{record.mqServerName,jdbcType=VARCHAR},
      server_idc_id = #{record.serverIdcId,jdbcType=BIGINT},
      server_idc_name = #{record.serverIdcName,jdbcType=VARCHAR},
      client_idc = #{record.clientIdc,jdbcType=VARCHAR},
      produce_tps = #{record.produceTps,jdbcType=INTEGER},
      msg_avg_size = #{record.msgAvgSize,jdbcType=INTEGER},
      msg_max_size = #{record.msgMaxSize,jdbcType=INTEGER},
      state = #{record.state,jdbcType=TINYINT},
      config = #{record.config,jdbcType=VARCHAR},
      is_delete = #{record.isDelete,jdbcType=TINYINT},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      modify_time = #{record.modifyTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.didi.carrera.console.dao.model.TopicConf">
    update topic_conf
    <set>
      <if test="topicId != null">
        topic_id = #{topicId,jdbcType=BIGINT},
      </if>
      <if test="topicName != null">
        topic_name = #{topicName,jdbcType=VARCHAR},
      </if>
      <if test="clusterId != null">
        cluster_id = #{clusterId,jdbcType=BIGINT},
      </if>
      <if test="clusterName != null">
        cluster_name = #{clusterName,jdbcType=VARCHAR},
      </if>
      <if test="mqServerId != null">
        mq_server_id = #{mqServerId,jdbcType=BIGINT},
      </if>
      <if test="mqServerName != null">
        mq_server_name = #{mqServerName,jdbcType=VARCHAR},
      </if>
      <if test="serverIdcId != null">
        server_idc_id = #{serverIdcId,jdbcType=BIGINT},
      </if>
      <if test="serverIdcName != null">
        server_idc_name = #{serverIdcName,jdbcType=VARCHAR},
      </if>
      <if test="clientIdc != null">
        client_idc = #{clientIdc,jdbcType=VARCHAR},
      </if>
      <if test="produceTps != null">
        produce_tps = #{produceTps,jdbcType=INTEGER},
      </if>
      <if test="msgAvgSize != null">
        msg_avg_size = #{msgAvgSize,jdbcType=INTEGER},
      </if>
      <if test="msgMaxSize != null">
        msg_max_size = #{msgMaxSize,jdbcType=INTEGER},
      </if>
      <if test="state != null">
        state = #{state,jdbcType=TINYINT},
      </if>
      <if test="config != null">
        config = #{config,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        is_delete = #{isDelete,jdbcType=TINYINT},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null">
        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.didi.carrera.console.dao.model.TopicConf">
    update topic_conf
    set topic_id = #{topicId,jdbcType=BIGINT},
      topic_name = #{topicName,jdbcType=VARCHAR},
      cluster_id = #{clusterId,jdbcType=BIGINT},
      cluster_name = #{clusterName,jdbcType=VARCHAR},
      mq_server_id = #{mqServerId,jdbcType=BIGINT},
      mq_server_name = #{mqServerName,jdbcType=VARCHAR},
      server_idc_id = #{serverIdcId,jdbcType=BIGINT},
      server_idc_name = #{serverIdcName,jdbcType=VARCHAR},
      client_idc = #{clientIdc,jdbcType=VARCHAR},
      produce_tps = #{produceTps,jdbcType=INTEGER},
      msg_avg_size = #{msgAvgSize,jdbcType=INTEGER},
      msg_max_size = #{msgMaxSize,jdbcType=INTEGER},
      state = #{state,jdbcType=TINYINT},
      config = #{config,jdbcType=VARCHAR},
      is_delete = #{isDelete,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      modify_time = #{modifyTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>