<?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.community.huiju.dao.MqMessageMapper" >
  <resultMap id="BaseResultMap" type="com.community.huiju.model.MqMessage" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="event_state" property="eventState" jdbcType="INTEGER" />
    <result column="event_level" property="eventLevel" jdbcType="INTEGER" />
    <result column="unit_idx" property="unitIdx" jdbcType="VARCHAR" />
    <result column="event_type" property="eventType" jdbcType="INTEGER" />
    <result column="event_type_name" property="eventTypeName" jdbcType="VARCHAR" />
    <result column="sub_sys_type" property="subSysType" jdbcType="INTEGER" />
    <result column="event_name" property="eventName" jdbcType="VARCHAR" />
    <result column="start_time" property="startTime" jdbcType="TIMESTAMP" />
    <result column="stop_time" property="stopTime" jdbcType="TIMESTAMP" />
    <result column="source_idx" property="sourceIdx" jdbcType="CHAR" />
    <result column="source_type" property="sourceType" jdbcType="INTEGER" />
    <result column="source_name" property="sourceName" jdbcType="VARCHAR" />
    <result column="region_idx" property="regionIdx" jdbcType="VARCHAR" />
    <result column="event_code" property="eventCode" jdbcType="INTEGER" />
    <result column="device_id" property="deviceId" jdbcType="INTEGER" />
    <result column="device_type" property="deviceType" jdbcType="INTEGER" />
    <result column="device_name" property="deviceName" jdbcType="VARCHAR" />
    <result column="event_card" property="eventCard" jdbcType="VARCHAR" />
    <result column="person_id" property="personId" jdbcType="INTEGER" />
    <result column="person_name" property="personName" jdbcType="VARCHAR" />
    <result column="dept_id" property="deptId" jdbcType="INTEGER" />
    <result column="dept_name" property="deptName" jdbcType="VARCHAR" />
    <result column="dept_code" property="deptCode" jdbcType="VARCHAR" />
    <result column="in_out" property="inOut" jdbcType="INTEGER" />
    <result column="card_status" property="cardStatus" jdbcType="INTEGER" />
    <result column="pic_url" property="picUrl" jdbcType="VARCHAR" />
  </resultMap>
  <resultMap id="ResultMapWithBLOBs" type="com.community.huiju.model.MqMessage" extends="BaseResultMap" >
    <result column="ext_txt" property="extTxt" jdbcType="LONGVARCHAR" />
  </resultMap>
  <sql id="Base_Column_List" >
    id, event_state, event_level, unit_idx, event_type, event_type_name, sub_sys_type, 
    event_name, start_time, stop_time, source_idx, source_type, source_name, region_idx, 
    event_code, device_id, device_type, device_name, event_card, person_id, person_name, 
    dept_id, dept_name, dept_code, in_out, card_status, pic_url
  </sql>
  <sql id="Blob_Column_List" >
    ext_txt
  </sql>
  <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from mq_message
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from mq_message
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.community.huiju.model.MqMessage" >
    insert into mq_message (id, event_state, event_level, 
      unit_idx, event_type, event_type_name, 
      sub_sys_type, event_name, start_time, 
      stop_time, source_idx, source_type, 
      source_name, region_idx, event_code, 
      device_id, device_type, device_name, 
      event_card, person_id, person_name, 
      dept_id, dept_name, dept_code, 
      in_out, card_status, pic_url, 
      ext_txt)
    values (#{id,jdbcType=INTEGER}, #{eventState,jdbcType=INTEGER}, #{eventLevel,jdbcType=INTEGER}, 
      #{unitIdx,jdbcType=VARCHAR}, #{eventType,jdbcType=INTEGER}, #{eventTypeName,jdbcType=VARCHAR}, 
      #{subSysType,jdbcType=INTEGER}, #{eventName,jdbcType=VARCHAR}, #{startTime,jdbcType=TIMESTAMP}, 
      #{stopTime,jdbcType=TIMESTAMP}, #{sourceIdx,jdbcType=CHAR}, #{sourceType,jdbcType=INTEGER},
      #{sourceName,jdbcType=VARCHAR}, #{regionIdx,jdbcType=VARCHAR}, #{eventCode,jdbcType=INTEGER}, 
      #{deviceId,jdbcType=INTEGER}, #{deviceType,jdbcType=INTEGER}, #{deviceName,jdbcType=VARCHAR}, 
      #{eventCard,jdbcType=VARCHAR}, #{personId,jdbcType=INTEGER}, #{personName,jdbcType=VARCHAR}, 
      #{deptId,jdbcType=INTEGER}, #{deptName,jdbcType=VARCHAR}, #{deptCode,jdbcType=VARCHAR}, 
      #{inOut,jdbcType=INTEGER}, #{cardStatus,jdbcType=INTEGER}, #{picUrl,jdbcType=VARCHAR}, 
      #{extTxt,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.community.huiju.model.MqMessage" >
    insert into mq_message
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="eventState != null" >
        event_state,
      </if>
      <if test="eventLevel != null" >
        event_level,
      </if>
      <if test="unitIdx != null" >
        unit_idx,
      </if>
      <if test="eventType != null" >
        event_type,
      </if>
      <if test="eventTypeName != null" >
        event_type_name,
      </if>
      <if test="subSysType != null" >
        sub_sys_type,
      </if>
      <if test="eventName != null" >
        event_name,
      </if>
      <if test="startTime != null" >
        start_time,
      </if>
      <if test="stopTime != null" >
        stop_time,
      </if>
      <if test="sourceIdx != null" >
        source_idx,
      </if>
      <if test="sourceType != null" >
        source_type,
      </if>
      <if test="sourceName != null" >
        source_name,
      </if>
      <if test="regionIdx != null" >
        region_idx,
      </if>
      <if test="eventCode != null" >
        event_code,
      </if>
      <if test="deviceId != null" >
        device_id,
      </if>
      <if test="deviceType != null" >
        device_type,
      </if>
      <if test="deviceName != null" >
        device_name,
      </if>
      <if test="eventCard != null" >
        event_card,
      </if>
      <if test="personId != null" >
        person_id,
      </if>
      <if test="personName != null" >
        person_name,
      </if>
      <if test="deptId != null" >
        dept_id,
      </if>
      <if test="deptName != null" >
        dept_name,
      </if>
      <if test="deptCode != null" >
        dept_code,
      </if>
      <if test="inOut != null" >
        in_out,
      </if>
      <if test="cardStatus != null" >
        card_status,
      </if>
      <if test="picUrl != null" >
        pic_url,
      </if>
      <if test="extTxt != null" >
        ext_txt,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="eventState != null" >
        #{eventState,jdbcType=INTEGER},
      </if>
      <if test="eventLevel != null" >
        #{eventLevel,jdbcType=INTEGER},
      </if>
      <if test="unitIdx != null" >
        #{unitIdx,jdbcType=VARCHAR},
      </if>
      <if test="eventType != null" >
        #{eventType,jdbcType=INTEGER},
      </if>
      <if test="eventTypeName != null" >
        #{eventTypeName,jdbcType=VARCHAR},
      </if>
      <if test="subSysType != null" >
        #{subSysType,jdbcType=INTEGER},
      </if>
      <if test="eventName != null" >
        #{eventName,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null" >
        #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="stopTime != null" >
        #{stopTime,jdbcType=TIMESTAMP},
      </if>
      <if test="sourceIdx != null" >
        #{sourceIdx,jdbcType=CHAR},
      </if>
      <if test="sourceType != null" >
        #{sourceType,jdbcType=INTEGER},
      </if>
      <if test="sourceName != null" >
        #{sourceName,jdbcType=VARCHAR},
      </if>
      <if test="regionIdx != null" >
        #{regionIdx,jdbcType=VARCHAR},
      </if>
      <if test="eventCode != null" >
        #{eventCode,jdbcType=INTEGER},
      </if>
      <if test="deviceId != null" >
        #{deviceId,jdbcType=INTEGER},
      </if>
      <if test="deviceType != null" >
        #{deviceType,jdbcType=INTEGER},
      </if>
      <if test="deviceName != null" >
        #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="eventCard != null" >
        #{eventCard,jdbcType=VARCHAR},
      </if>
      <if test="personId != null" >
        #{personId,jdbcType=INTEGER},
      </if>
      <if test="personName != null" >
        #{personName,jdbcType=VARCHAR},
      </if>
      <if test="deptId != null" >
        #{deptId,jdbcType=INTEGER},
      </if>
      <if test="deptName != null" >
        #{deptName,jdbcType=VARCHAR},
      </if>
      <if test="deptCode != null" >
        #{deptCode,jdbcType=VARCHAR},
      </if>
      <if test="inOut != null" >
        #{inOut,jdbcType=INTEGER},
      </if>
      <if test="cardStatus != null" >
        #{cardStatus,jdbcType=INTEGER},
      </if>
      <if test="picUrl != null" >
        #{picUrl,jdbcType=VARCHAR},
      </if>
      <if test="extTxt != null" >
        #{extTxt,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.MqMessage" >
    update mq_message
    <set >
      <if test="eventState != null" >
        event_state = #{eventState,jdbcType=INTEGER},
      </if>
      <if test="eventLevel != null" >
        event_level = #{eventLevel,jdbcType=INTEGER},
      </if>
      <if test="unitIdx != null" >
        unit_idx = #{unitIdx,jdbcType=VARCHAR},
      </if>
      <if test="eventType != null" >
        event_type = #{eventType,jdbcType=INTEGER},
      </if>
      <if test="eventTypeName != null" >
        event_type_name = #{eventTypeName,jdbcType=VARCHAR},
      </if>
      <if test="subSysType != null" >
        sub_sys_type = #{subSysType,jdbcType=INTEGER},
      </if>
      <if test="eventName != null" >
        event_name = #{eventName,jdbcType=VARCHAR},
      </if>
      <if test="startTime != null" >
        start_time = #{startTime,jdbcType=TIMESTAMP},
      </if>
      <if test="stopTime != null" >
        stop_time = #{stopTime,jdbcType=TIMESTAMP},
      </if>
      <if test="sourceIdx != null" >
        source_idx = #{sourceIdx,jdbcType=CHAR},
      </if>
      <if test="sourceType != null" >
        source_type = #{sourceType,jdbcType=INTEGER},
      </if>
      <if test="sourceName != null" >
        source_name = #{sourceName,jdbcType=VARCHAR},
      </if>
      <if test="regionIdx != null" >
        region_idx = #{regionIdx,jdbcType=VARCHAR},
      </if>
      <if test="eventCode != null" >
        event_code = #{eventCode,jdbcType=INTEGER},
      </if>
      <if test="deviceId != null" >
        device_id = #{deviceId,jdbcType=INTEGER},
      </if>
      <if test="deviceType != null" >
        device_type = #{deviceType,jdbcType=INTEGER},
      </if>
      <if test="deviceName != null" >
        device_name = #{deviceName,jdbcType=VARCHAR},
      </if>
      <if test="eventCard != null" >
        event_card = #{eventCard,jdbcType=VARCHAR},
      </if>
      <if test="personId != null" >
        person_id = #{personId,jdbcType=INTEGER},
      </if>
      <if test="personName != null" >
        person_name = #{personName,jdbcType=VARCHAR},
      </if>
      <if test="deptId != null" >
        dept_id = #{deptId,jdbcType=INTEGER},
      </if>
      <if test="deptName != null" >
        dept_name = #{deptName,jdbcType=VARCHAR},
      </if>
      <if test="deptCode != null" >
        dept_code = #{deptCode,jdbcType=VARCHAR},
      </if>
      <if test="inOut != null" >
        in_out = #{inOut,jdbcType=INTEGER},
      </if>
      <if test="cardStatus != null" >
        card_status = #{cardStatus,jdbcType=INTEGER},
      </if>
      <if test="picUrl != null" >
        pic_url = #{picUrl,jdbcType=VARCHAR},
      </if>
      <if test="extTxt != null" >
        ext_txt = #{extTxt,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.community.huiju.model.MqMessage" >
    update mq_message
    set event_state = #{eventState,jdbcType=INTEGER},
      event_level = #{eventLevel,jdbcType=INTEGER},
      unit_idx = #{unitIdx,jdbcType=VARCHAR},
      event_type = #{eventType,jdbcType=INTEGER},
      event_type_name = #{eventTypeName,jdbcType=VARCHAR},
      sub_sys_type = #{subSysType,jdbcType=INTEGER},
      event_name = #{eventName,jdbcType=VARCHAR},
      start_time = #{startTime,jdbcType=TIMESTAMP},
      stop_time = #{stopTime,jdbcType=TIMESTAMP},
      source_idx = #{sourceIdx,jdbcType=CHAR},
      source_type = #{sourceType,jdbcType=INTEGER},
      source_name = #{sourceName,jdbcType=VARCHAR},
      region_idx = #{regionIdx,jdbcType=VARCHAR},
      event_code = #{eventCode,jdbcType=INTEGER},
      device_id = #{deviceId,jdbcType=INTEGER},
      device_type = #{deviceType,jdbcType=INTEGER},
      device_name = #{deviceName,jdbcType=VARCHAR},
      event_card = #{eventCard,jdbcType=VARCHAR},
      person_id = #{personId,jdbcType=INTEGER},
      person_name = #{personName,jdbcType=VARCHAR},
      dept_id = #{deptId,jdbcType=INTEGER},
      dept_name = #{deptName,jdbcType=VARCHAR},
      dept_code = #{deptCode,jdbcType=VARCHAR},
      in_out = #{inOut,jdbcType=INTEGER},
      card_status = #{cardStatus,jdbcType=INTEGER},
      pic_url = #{picUrl,jdbcType=VARCHAR},
      ext_txt = #{extTxt,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.MqMessage" >
    update mq_message
    set event_state = #{eventState,jdbcType=INTEGER},
      event_level = #{eventLevel,jdbcType=INTEGER},
      unit_idx = #{unitIdx,jdbcType=VARCHAR},
      event_type = #{eventType,jdbcType=INTEGER},
      event_type_name = #{eventTypeName,jdbcType=VARCHAR},
      sub_sys_type = #{subSysType,jdbcType=INTEGER},
      event_name = #{eventName,jdbcType=VARCHAR},
      start_time = #{startTime,jdbcType=TIMESTAMP},
      stop_time = #{stopTime,jdbcType=TIMESTAMP},
      source_idx = #{sourceIdx,jdbcType=CHAR},
      source_type = #{sourceType,jdbcType=INTEGER},
      source_name = #{sourceName,jdbcType=VARCHAR},
      region_idx = #{regionIdx,jdbcType=VARCHAR},
      event_code = #{eventCode,jdbcType=INTEGER},
      device_id = #{deviceId,jdbcType=INTEGER},
      device_type = #{deviceType,jdbcType=INTEGER},
      device_name = #{deviceName,jdbcType=VARCHAR},
      event_card = #{eventCard,jdbcType=VARCHAR},
      person_id = #{personId,jdbcType=INTEGER},
      person_name = #{personName,jdbcType=VARCHAR},
      dept_id = #{deptId,jdbcType=INTEGER},
      dept_name = #{deptName,jdbcType=VARCHAR},
      dept_code = #{deptCode,jdbcType=VARCHAR},
      in_out = #{inOut,jdbcType=INTEGER},
      card_status = #{cardStatus,jdbcType=INTEGER},
      pic_url = #{picUrl,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateConnectionByName">
    update long_connection_status set `status` = '1' WHERE `connection_name` = "mq"
  </update>
</mapper>