<?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.steerinfo.ems.emswebsocketlog.mapper.EmsWebsocketLogMapper">
  <resultMap id="BaseResultMap" type="com.steerinfo.ems.emswebsocketlog.model.EmsWebsocketLog">
    <id column="MESSAGEID" jdbcType="VARCHAR" property="messageid" />
    <result column="RELATION" jdbcType="VARCHAR" property="relation" />
    <result column="ROLE" jdbcType="VARCHAR" property="role" />
    <result column="TITLE" jdbcType="VARCHAR" property="title" />
    <result column="MESSAGE" jdbcType="VARCHAR" property="message" />
    <result column="TIPS" jdbcType="VARCHAR" property="tips" />
    <result column="STATE" jdbcType="VARCHAR" property="state" />
    <result column="CREATETIME" jdbcType="VARCHAR" property="createtime" />
    <result column="CREATEMAN" jdbcType="VARCHAR" property="createman" />
    <result column="CLOSETIME" jdbcType="VARCHAR" property="closetime" />
    <result column="CLOSEMAN" jdbcType="VARCHAR" property="closeman" />
  </resultMap>
  <sql id="columns">
    MESSAGEID, RELATION, ROLE, TITLE, MESSAGE, TIPS, STATE, CREATETIME, CREATEMAN, CLOSETIME, 
    CLOSEMAN
  </sql>
  <sql id="columns_alias">
    t.MESSAGEID, t.RELATION, t.ROLE, t.TITLE, t.MESSAGE, t.TIPS, t.STATE, t.CREATETIME, 
    t.CREATEMAN, t.CLOSETIME, t.CLOSEMAN
  </sql>
  <sql id="select">
    SELECT <include refid="columns"/> FROM EMS_WEBSOCKET_LOG
  </sql>
  <sql id="select_alias">
    SELECT <include refid="columns_alias"/> FROM EMS_WEBSOCKET_LOG t
  </sql>
  <sql id="where">
    <where> 
      <if test="messageid != null and messageid != ''">
        and MESSAGEID = #{messageid}
      </if>
      <if test="relation != null and relation != ''">
        and RELATION = #{relation}
      </if>
      <if test="role != null and role != ''">
        and ROLE = #{role}
      </if>
      <if test="title != null and title != ''">
        and TITLE = #{title}
      </if>
      <if test="message != null and message != ''">
        and MESSAGE = #{message}
      </if>
      <if test="tips != null and tips != ''">
        and TIPS = #{tips}
      </if>
      <if test="state != null and state != ''">
        and STATE = #{state}
      </if>
      <if test="createtime != null and createtime != ''">
        and CREATETIME = #{createtime}
      </if>
      <if test="createman != null and createman != ''">
        and CREATEMAN = #{createman}
      </if>
      <if test="closetime != null and closetime != ''">
        and CLOSETIME = #{closetime}
      </if>
      <if test="closeman != null and closeman != ''">
        and CLOSEMAN = #{closeman}
      </if>
    </where>
  </sql>
  <sql id="whereLike">
    <where> 
      <if test="messageid != null and messageid != ''">
        and MESSAGEID LIKE '%${messageid}%'
      </if>
      <if test="relation != null and relation != ''">
        and RELATION LIKE '%${relation}%'
      </if>
      <if test="role != null and role != ''">
        and ROLE LIKE '%${role}%'
      </if>
      <if test="title != null and title != ''">
        and TITLE LIKE '%${title}%'
      </if>
      <if test="message != null and message != ''">
        and MESSAGE LIKE '%${message}%'
      </if>
      <if test="tips != null and tips != ''">
        and TIPS LIKE '%${tips}%'
      </if>
      <if test="state != null and state != ''">
        and STATE LIKE '%${state}%'
      </if>
      <if test="createtime != null and createtime != ''">
        and CREATETIME LIKE '%${createtime}%'
      </if>
      <if test="createman != null and createman != ''">
        and CREATEMAN LIKE '%${createman}%'
      </if>
      <if test="closetime != null and closetime != ''">
        and CLOSETIME LIKE '%${closetime}%'
      </if>
      <if test="closeman != null and closeman != ''">
        and CLOSEMAN LIKE '%${closeman}%'
      </if>
    </where>
  </sql>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from EMS_WEBSOCKET_LOG
    where MESSAGEID = #{messageid,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteBySelectiveElement" parameterType="java.util.HashMap">
    delete from EMS_WEBSOCKET_LOG
    where 1!=1 
      <if test="relation != null and relation != ''">
        or RELATION = #{relation}
      </if>
      <if test="role != null and role != ''">
        or ROLE = #{role}
      </if>
      <if test="title != null and title != ''">
        or TITLE = #{title}
      </if>
      <if test="message != null and message != ''">
        or MESSAGE = #{message}
      </if>
      <if test="tips != null and tips != ''">
        or TIPS = #{tips}
      </if>
      <if test="state != null and state != ''">
        or STATE = #{state}
      </if>
      <if test="createtime != null and createtime != ''">
        or CREATETIME = #{createtime}
      </if>
      <if test="createman != null and createman != ''">
        or CREATEMAN = #{createman}
      </if>
      <if test="closetime != null and closetime != ''">
        or CLOSETIME = #{closetime}
      </if>
      <if test="closeman != null and closeman != ''">
        or CLOSEMAN = #{closeman}
      </if>
  </delete>
  <insert id="insert" parameterType="com.steerinfo.ems.emswebsocketlog.model.EmsWebsocketLog">
    insert into EMS_WEBSOCKET_LOG (MESSAGEID, RELATION, ROLE, 
      TITLE, MESSAGE, TIPS, 
      STATE, CREATETIME, CREATEMAN, 
      CLOSETIME, CLOSEMAN)
    values (#{messageid,jdbcType=VARCHAR}, #{relation,jdbcType=VARCHAR}, #{role,jdbcType=VARCHAR}, 
      #{title,jdbcType=VARCHAR}, #{message,jdbcType=VARCHAR}, #{tips,jdbcType=VARCHAR}, 
      #{state,jdbcType=VARCHAR}, #{createtime,jdbcType=VARCHAR}, #{createman,jdbcType=VARCHAR}, 
      #{closetime,jdbcType=VARCHAR}, #{closeman,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.steerinfo.ems.emswebsocketlog.model.EmsWebsocketLog">
    insert into EMS_WEBSOCKET_LOG
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="messageid != null">
        MESSAGEID,
      </if>
      <if test="relation != null">
        RELATION,
      </if>
      <if test="role != null">
        ROLE,
      </if>
      <if test="title != null">
        TITLE,
      </if>
      <if test="message != null">
        MESSAGE,
      </if>
      <if test="tips != null">
        TIPS,
      </if>
      <if test="state != null">
        STATE,
      </if>
      <if test="createtime != null">
        CREATETIME,
      </if>
      <if test="createman != null">
        CREATEMAN,
      </if>
      <if test="closetime != null">
        CLOSETIME,
      </if>
      <if test="closeman != null">
        CLOSEMAN,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="messageid != null">
        #{messageid,jdbcType=VARCHAR},
      </if>
      <if test="relation != null">
        #{relation,jdbcType=VARCHAR},
      </if>
      <if test="role != null">
        #{role,jdbcType=VARCHAR},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="message != null">
        #{message,jdbcType=VARCHAR},
      </if>
      <if test="tips != null">
        #{tips,jdbcType=VARCHAR},
      </if>
      <if test="state != null">
        #{state,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        #{createtime,jdbcType=VARCHAR},
      </if>
      <if test="createman != null">
        #{createman,jdbcType=VARCHAR},
      </if>
      <if test="closetime != null">
        #{closetime,jdbcType=VARCHAR},
      </if>
      <if test="closeman != null">
        #{closeman,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKey" parameterType="com.steerinfo.ems.emswebsocketlog.model.EmsWebsocketLog">
    update EMS_WEBSOCKET_LOG
    set RELATION = #{relation,jdbcType=VARCHAR},
      ROLE = #{role,jdbcType=VARCHAR},
      TITLE = #{title,jdbcType=VARCHAR},
      MESSAGE = #{message,jdbcType=VARCHAR},
      TIPS = #{tips,jdbcType=VARCHAR},
      STATE = #{state,jdbcType=VARCHAR},
      CREATETIME = #{createtime,jdbcType=VARCHAR},
      CREATEMAN = #{createman,jdbcType=VARCHAR},
      CLOSETIME = #{closetime,jdbcType=VARCHAR},
      CLOSEMAN = #{closeman,jdbcType=VARCHAR}
    where MESSAGEID = #{messageid,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.steerinfo.ems.emswebsocketlog.model.EmsWebsocketLog">
    update EMS_WEBSOCKET_LOG
    <set>
      <if test="relation != null">
        RELATION = #{relation,jdbcType=VARCHAR},
      </if>
      <if test="role != null">
        ROLE = #{role,jdbcType=VARCHAR},
      </if>
      <if test="title != null">
        TITLE = #{title,jdbcType=VARCHAR},
      </if>
      <if test="message != null">
        MESSAGE = #{message,jdbcType=VARCHAR},
      </if>
      <if test="tips != null">
        TIPS = #{tips,jdbcType=VARCHAR},
      </if>
      <if test="state != null">
        STATE = #{state,jdbcType=VARCHAR},
      </if>
      <if test="createtime != null">
        CREATETIME = #{createtime,jdbcType=VARCHAR},
      </if>
      <if test="createman != null">
        CREATEMAN = #{createman,jdbcType=VARCHAR},
      </if>
      <if test="closetime != null">
        CLOSETIME = #{closetime,jdbcType=VARCHAR},
      </if>
      <if test="closeman != null">
        CLOSEMAN = #{closeman,jdbcType=VARCHAR},
      </if>
    </set>
    where MESSAGEID = #{messageid,jdbcType=VARCHAR}
  </update>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <include refid="select"/>
    where MESSAGEID = #{messageid,jdbcType=VARCHAR}
  </select>
  <select id="selectByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="where"/>
    ORDER BY CREATETIME DESC
  </select>
  <select id="selectLikeByParameters" parameterType="java.util.HashMap" resultMap="BaseResultMap">
    <include refid="select"/>
    <include refid="whereLike"/>
    ORDER BY CREATETIME DESC
  </select>
  <insert id="batchInsert" parameterType="java.util.List">
    insert into EMS_WEBSOCKET_LOG 
      (MESSAGEID, 
      RELATION, ROLE, TITLE, 
      MESSAGE, TIPS, STATE, 
      CREATETIME, CREATEMAN, CLOSETIME, 
      CLOSEMAN)
    ( <foreach collection="list" item="item" separator="union all"> 
   select  
      #{item.messageid,jdbcType=VARCHAR}, 
      #{item.relation,jdbcType=VARCHAR}, #{item.role,jdbcType=VARCHAR}, #{item.title,jdbcType=VARCHAR}, 
      #{item.message,jdbcType=VARCHAR}, #{item.tips,jdbcType=VARCHAR}, #{item.state,jdbcType=VARCHAR}, 
      #{item.createtime,jdbcType=VARCHAR}, #{item.createman,jdbcType=VARCHAR}, #{item.closetime,jdbcType=VARCHAR}, 
      #{item.closeman,jdbcType=VARCHAR} from dual  
   </foreach> )
  </insert>
  <update id="batchUpdate" parameterType="java.util.List">
     update EMS_WEBSOCKET_LOG
     set
       MESSAGEID=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.messageid,jdbcType=VARCHAR}
       </foreach>
       ,RELATION=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.relation,jdbcType=VARCHAR}
       </foreach>
       ,ROLE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.role,jdbcType=VARCHAR}
       </foreach>
       ,TITLE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.title,jdbcType=VARCHAR}
       </foreach>
       ,MESSAGE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.message,jdbcType=VARCHAR}
       </foreach>
       ,TIPS=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.tips,jdbcType=VARCHAR}
       </foreach>
       ,STATE=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.state,jdbcType=VARCHAR}
       </foreach>
       ,CREATETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.createtime,jdbcType=VARCHAR}
       </foreach>
       ,CREATEMAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.createman,jdbcType=VARCHAR}
       </foreach>
       ,CLOSETIME=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.closetime,jdbcType=VARCHAR}
       </foreach>
       ,CLOSEMAN=
       <foreach collection="list" item="item" index="index" separator=" " open="case MESSAGEID" close="end">
          when #{item.messageid,jdbcType=VARCHAR} then #{item.closeman,jdbcType=VARCHAR}
       </foreach>
     where MESSAGEID in 
     <foreach collection="list" index="index" item="item" separator="," open="(" close=")">
    #{item.messageid,jdbcType=VARCHAR}
     </foreach> 
  </update>
  <delete id="batchDelete" parameterType="java.util.List">
    delete from EMS_WEBSOCKET_LOG
    where MESSAGEID in 
    <foreach collection="list" item="id" open="(" close=")" separator=",">
      #{id}
    </foreach>
  </delete>
  <!-- 友情提示！！！-->
  <!-- 请将自己写的代码放在此标签之下，方便以后粘贴复制。-->
  
</mapper>