<?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.TopicMapper">
  <resultMap id="BaseResultMap" type="com.didi.carrera.console.dao.model.Topic">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="topic_name" jdbcType="VARCHAR" property="topicName" />
    <result column="service" jdbcType="VARCHAR" property="service" />
    <result column="department" jdbcType="VARCHAR" property="department" />
    <result column="contacters" jdbcType="VARCHAR" property="contacters" />
    <result column="alarm_group" jdbcType="VARCHAR" property="alarmGroup" />
    <result column="alarm_is_enable" jdbcType="TINYINT" property="alarmIsEnable" />
    <result column="delay_topic" jdbcType="TINYINT" property="delayTopic" />
    <result column="need_audit_subinfo" jdbcType="TINYINT" property="needAuditSubinfo" />
    <result column="enable_schema_verify" jdbcType="TINYINT" property="enableSchemaVerify" />
    <result column="produce_mode" jdbcType="TINYINT" property="produceMode" />
    <result column="produce_mode_mapper" jdbcType="VARCHAR" property="produceModeMapper" />
    <result column="state" jdbcType="TINYINT" property="state" />
    <result column="config" jdbcType="VARCHAR" property="config" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="extra_params" jdbcType="VARCHAR" property="extraParams" />
    <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>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.didi.carrera.console.dao.model.Topic">
    <result column="topic_schema" jdbcType="LONGVARCHAR" property="topicSchema" />
  </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_name, service, department, contacters, alarm_group, alarm_is_enable, delay_topic, 
    need_audit_subinfo, enable_schema_verify, produce_mode, produce_mode_mapper, state, 
    config, description, extra_params, is_delete, create_time, modify_time
  </sql>
  <sql id="Blob_Column_List">
    topic_schema
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.didi.carrera.console.dao.model.TopicCriteria" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from topic
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.didi.carrera.console.dao.model.TopicCriteria" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from topic
    <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="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from topic
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from topic
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="com.didi.carrera.console.dao.model.TopicCriteria">
    delete from topic
    <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.Topic" useGeneratedKeys="true">
    insert into topic (topic_name, service, department, 
      contacters, alarm_group, alarm_is_enable, 
      delay_topic, need_audit_subinfo, enable_schema_verify, 
      produce_mode, produce_mode_mapper, state, 
      config, description, extra_params, 
      is_delete, create_time, modify_time, 
      topic_schema)
    values (#{topicName,jdbcType=VARCHAR}, #{service,jdbcType=VARCHAR}, #{department,jdbcType=VARCHAR}, 
      #{contacters,jdbcType=VARCHAR}, #{alarmGroup,jdbcType=VARCHAR}, #{alarmIsEnable,jdbcType=TINYINT}, 
      #{delayTopic,jdbcType=TINYINT}, #{needAuditSubinfo,jdbcType=TINYINT}, #{enableSchemaVerify,jdbcType=TINYINT}, 
      #{produceMode,jdbcType=TINYINT}, #{produceModeMapper,jdbcType=VARCHAR}, #{state,jdbcType=TINYINT}, 
      #{config,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{extraParams,jdbcType=VARCHAR}, 
      #{isDelete,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP}, 
      #{topicSchema,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.didi.carrera.console.dao.model.Topic" useGeneratedKeys="true">
    insert into topic
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="topicName != null">
        topic_name,
      </if>
      <if test="service != null">
        service,
      </if>
      <if test="department != null">
        department,
      </if>
      <if test="contacters != null">
        contacters,
      </if>
      <if test="alarmGroup != null">
        alarm_group,
      </if>
      <if test="alarmIsEnable != null">
        alarm_is_enable,
      </if>
      <if test="delayTopic != null">
        delay_topic,
      </if>
      <if test="needAuditSubinfo != null">
        need_audit_subinfo,
      </if>
      <if test="enableSchemaVerify != null">
        enable_schema_verify,
      </if>
      <if test="produceMode != null">
        produce_mode,
      </if>
      <if test="produceModeMapper != null">
        produce_mode_mapper,
      </if>
      <if test="state != null">
        state,
      </if>
      <if test="config != null">
        config,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="extraParams != null">
        extra_params,
      </if>
      <if test="isDelete != null">
        is_delete,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="modifyTime != null">
        modify_time,
      </if>
      <if test="topicSchema != null">
        topic_schema,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="topicName != null">
        #{topicName,jdbcType=VARCHAR},
      </if>
      <if test="service != null">
        #{service,jdbcType=VARCHAR},
      </if>
      <if test="department != null">
        #{department,jdbcType=VARCHAR},
      </if>
      <if test="contacters != null">
        #{contacters,jdbcType=VARCHAR},
      </if>
      <if test="alarmGroup != null">
        #{alarmGroup,jdbcType=VARCHAR},
      </if>
      <if test="alarmIsEnable != null">
        #{alarmIsEnable,jdbcType=TINYINT},
      </if>
      <if test="delayTopic != null">
        #{delayTopic,jdbcType=TINYINT},
      </if>
      <if test="needAuditSubinfo != null">
        #{needAuditSubinfo,jdbcType=TINYINT},
      </if>
      <if test="enableSchemaVerify != null">
        #{enableSchemaVerify,jdbcType=TINYINT},
      </if>
      <if test="produceMode != null">
        #{produceMode,jdbcType=TINYINT},
      </if>
      <if test="produceModeMapper != null">
        #{produceModeMapper,jdbcType=VARCHAR},
      </if>
      <if test="state != null">
        #{state,jdbcType=TINYINT},
      </if>
      <if test="config != null">
        #{config,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="extraParams != null">
        #{extraParams,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>
      <if test="topicSchema != null">
        #{topicSchema,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.didi.carrera.console.dao.model.TopicCriteria" resultType="java.lang.Long">
    select count(*) from topic
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update topic
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.topicName != null">
        topic_name = #{record.topicName,jdbcType=VARCHAR},
      </if>
      <if test="record.service != null">
        service = #{record.service,jdbcType=VARCHAR},
      </if>
      <if test="record.department != null">
        department = #{record.department,jdbcType=VARCHAR},
      </if>
      <if test="record.contacters != null">
        contacters = #{record.contacters,jdbcType=VARCHAR},
      </if>
      <if test="record.alarmGroup != null">
        alarm_group = #{record.alarmGroup,jdbcType=VARCHAR},
      </if>
      <if test="record.alarmIsEnable != null">
        alarm_is_enable = #{record.alarmIsEnable,jdbcType=TINYINT},
      </if>
      <if test="record.delayTopic != null">
        delay_topic = #{record.delayTopic,jdbcType=TINYINT},
      </if>
      <if test="record.needAuditSubinfo != null">
        need_audit_subinfo = #{record.needAuditSubinfo,jdbcType=TINYINT},
      </if>
      <if test="record.enableSchemaVerify != null">
        enable_schema_verify = #{record.enableSchemaVerify,jdbcType=TINYINT},
      </if>
      <if test="record.produceMode != null">
        produce_mode = #{record.produceMode,jdbcType=TINYINT},
      </if>
      <if test="record.produceModeMapper != null">
        produce_mode_mapper = #{record.produceModeMapper,jdbcType=VARCHAR},
      </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.description != null">
        description = #{record.description,jdbcType=VARCHAR},
      </if>
      <if test="record.extraParams != null">
        extra_params = #{record.extraParams,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>
      <if test="record.topicSchema != null">
        topic_schema = #{record.topicSchema,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update topic
    set id = #{record.id,jdbcType=BIGINT},
      topic_name = #{record.topicName,jdbcType=VARCHAR},
      service = #{record.service,jdbcType=VARCHAR},
      department = #{record.department,jdbcType=VARCHAR},
      contacters = #{record.contacters,jdbcType=VARCHAR},
      alarm_group = #{record.alarmGroup,jdbcType=VARCHAR},
      alarm_is_enable = #{record.alarmIsEnable,jdbcType=TINYINT},
      delay_topic = #{record.delayTopic,jdbcType=TINYINT},
      need_audit_subinfo = #{record.needAuditSubinfo,jdbcType=TINYINT},
      enable_schema_verify = #{record.enableSchemaVerify,jdbcType=TINYINT},
      produce_mode = #{record.produceMode,jdbcType=TINYINT},
      produce_mode_mapper = #{record.produceModeMapper,jdbcType=VARCHAR},
      state = #{record.state,jdbcType=TINYINT},
      config = #{record.config,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      extra_params = #{record.extraParams,jdbcType=VARCHAR},
      is_delete = #{record.isDelete,jdbcType=TINYINT},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      topic_schema = #{record.topicSchema,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update topic
    set id = #{record.id,jdbcType=BIGINT},
      topic_name = #{record.topicName,jdbcType=VARCHAR},
      service = #{record.service,jdbcType=VARCHAR},
      department = #{record.department,jdbcType=VARCHAR},
      contacters = #{record.contacters,jdbcType=VARCHAR},
      alarm_group = #{record.alarmGroup,jdbcType=VARCHAR},
      alarm_is_enable = #{record.alarmIsEnable,jdbcType=TINYINT},
      delay_topic = #{record.delayTopic,jdbcType=TINYINT},
      need_audit_subinfo = #{record.needAuditSubinfo,jdbcType=TINYINT},
      enable_schema_verify = #{record.enableSchemaVerify,jdbcType=TINYINT},
      produce_mode = #{record.produceMode,jdbcType=TINYINT},
      produce_mode_mapper = #{record.produceModeMapper,jdbcType=VARCHAR},
      state = #{record.state,jdbcType=TINYINT},
      config = #{record.config,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      extra_params = #{record.extraParams,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.Topic">
    update topic
    <set>
      <if test="topicName != null">
        topic_name = #{topicName,jdbcType=VARCHAR},
      </if>
      <if test="service != null">
        service = #{service,jdbcType=VARCHAR},
      </if>
      <if test="department != null">
        department = #{department,jdbcType=VARCHAR},
      </if>
      <if test="contacters != null">
        contacters = #{contacters,jdbcType=VARCHAR},
      </if>
      <if test="alarmGroup != null">
        alarm_group = #{alarmGroup,jdbcType=VARCHAR},
      </if>
      <if test="alarmIsEnable != null">
        alarm_is_enable = #{alarmIsEnable,jdbcType=TINYINT},
      </if>
      <if test="delayTopic != null">
        delay_topic = #{delayTopic,jdbcType=TINYINT},
      </if>
      <if test="needAuditSubinfo != null">
        need_audit_subinfo = #{needAuditSubinfo,jdbcType=TINYINT},
      </if>
      <if test="enableSchemaVerify != null">
        enable_schema_verify = #{enableSchemaVerify,jdbcType=TINYINT},
      </if>
      <if test="produceMode != null">
        produce_mode = #{produceMode,jdbcType=TINYINT},
      </if>
      <if test="produceModeMapper != null">
        produce_mode_mapper = #{produceModeMapper,jdbcType=VARCHAR},
      </if>
      <if test="state != null">
        state = #{state,jdbcType=TINYINT},
      </if>
      <if test="config != null">
        config = #{config,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="extraParams != null">
        extra_params = #{extraParams,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>
      <if test="topicSchema != null">
        topic_schema = #{topicSchema,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.didi.carrera.console.dao.model.Topic">
    update topic
    set topic_name = #{topicName,jdbcType=VARCHAR},
      service = #{service,jdbcType=VARCHAR},
      department = #{department,jdbcType=VARCHAR},
      contacters = #{contacters,jdbcType=VARCHAR},
      alarm_group = #{alarmGroup,jdbcType=VARCHAR},
      alarm_is_enable = #{alarmIsEnable,jdbcType=TINYINT},
      delay_topic = #{delayTopic,jdbcType=TINYINT},
      need_audit_subinfo = #{needAuditSubinfo,jdbcType=TINYINT},
      enable_schema_verify = #{enableSchemaVerify,jdbcType=TINYINT},
      produce_mode = #{produceMode,jdbcType=TINYINT},
      produce_mode_mapper = #{produceModeMapper,jdbcType=VARCHAR},
      state = #{state,jdbcType=TINYINT},
      config = #{config,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      extra_params = #{extraParams,jdbcType=VARCHAR},
      is_delete = #{isDelete,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      topic_schema = #{topicSchema,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.didi.carrera.console.dao.model.Topic">
    update topic
    set topic_name = #{topicName,jdbcType=VARCHAR},
      service = #{service,jdbcType=VARCHAR},
      department = #{department,jdbcType=VARCHAR},
      contacters = #{contacters,jdbcType=VARCHAR},
      alarm_group = #{alarmGroup,jdbcType=VARCHAR},
      alarm_is_enable = #{alarmIsEnable,jdbcType=TINYINT},
      delay_topic = #{delayTopic,jdbcType=TINYINT},
      need_audit_subinfo = #{needAuditSubinfo,jdbcType=TINYINT},
      enable_schema_verify = #{enableSchemaVerify,jdbcType=TINYINT},
      produce_mode = #{produceMode,jdbcType=TINYINT},
      produce_mode_mapper = #{produceModeMapper,jdbcType=VARCHAR},
      state = #{state,jdbcType=TINYINT},
      config = #{config,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      extra_params = #{extraParams,jdbcType=VARCHAR},
      is_delete = #{isDelete,jdbcType=TINYINT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      modify_time = #{modifyTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>