<?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.koobietech.eas.mbg.mapper.EasSysLogsMapper">
  <resultMap id="BaseResultMap" type="com.koobietech.eas.mbg.model.EasSysLogs">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="timestamp" jdbcType="TIMESTAMP" property="timestamp" />
    <result column="level" jdbcType="VARCHAR" property="level" />
    <result column="logger" jdbcType="VARCHAR" property="logger" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.koobietech.eas.mbg.model.EasSysLogs">
    <result column="message" jdbcType="LONGVARCHAR" property="message" />
    <result column="exception" jdbcType="LONGVARCHAR" property="exception" />
  </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, timestamp, level, logger
  </sql>
  <sql id="Blob_Column_List">
    message, exception
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.koobietech.eas.mbg.model.EasSysLogsExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from eas_sys_logs
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByExample" parameterType="com.koobietech.eas.mbg.model.EasSysLogsExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from eas_sys_logs
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from eas_sys_logs
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from eas_sys_logs
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.koobietech.eas.mbg.model.EasSysLogsExample">
    delete from eas_sys_logs
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.koobietech.eas.mbg.model.EasSysLogs">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into eas_sys_logs (timestamp, level, logger, 
      message, exception)
    values (#{timestamp,jdbcType=TIMESTAMP}, #{level,jdbcType=VARCHAR}, #{logger,jdbcType=VARCHAR}, 
      #{message,jdbcType=LONGVARCHAR}, #{exception,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.koobietech.eas.mbg.model.EasSysLogs">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into eas_sys_logs
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="timestamp != null">
        timestamp,
      </if>
      <if test="level != null">
        level,
      </if>
      <if test="logger != null">
        logger,
      </if>
      <if test="message != null">
        message,
      </if>
      <if test="exception != null">
        exception,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="timestamp != null">
        #{timestamp,jdbcType=TIMESTAMP},
      </if>
      <if test="level != null">
        #{level,jdbcType=VARCHAR},
      </if>
      <if test="logger != null">
        #{logger,jdbcType=VARCHAR},
      </if>
      <if test="message != null">
        #{message,jdbcType=LONGVARCHAR},
      </if>
      <if test="exception != null">
        #{exception,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.koobietech.eas.mbg.model.EasSysLogsExample" resultType="java.lang.Long">
    select count(*) from eas_sys_logs
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update eas_sys_logs
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.timestamp != null">
        timestamp = #{record.timestamp,jdbcType=TIMESTAMP},
      </if>
      <if test="record.level != null">
        level = #{record.level,jdbcType=VARCHAR},
      </if>
      <if test="record.logger != null">
        logger = #{record.logger,jdbcType=VARCHAR},
      </if>
      <if test="record.message != null">
        message = #{record.message,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.exception != null">
        exception = #{record.exception,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update eas_sys_logs
    set id = #{record.id,jdbcType=INTEGER},
      timestamp = #{record.timestamp,jdbcType=TIMESTAMP},
      level = #{record.level,jdbcType=VARCHAR},
      logger = #{record.logger,jdbcType=VARCHAR},
      message = #{record.message,jdbcType=LONGVARCHAR},
      exception = #{record.exception,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update eas_sys_logs
    set id = #{record.id,jdbcType=INTEGER},
      timestamp = #{record.timestamp,jdbcType=TIMESTAMP},
      level = #{record.level,jdbcType=VARCHAR},
      logger = #{record.logger,jdbcType=VARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.koobietech.eas.mbg.model.EasSysLogs">
    update eas_sys_logs
    <set>
      <if test="timestamp != null">
        timestamp = #{timestamp,jdbcType=TIMESTAMP},
      </if>
      <if test="level != null">
        level = #{level,jdbcType=VARCHAR},
      </if>
      <if test="logger != null">
        logger = #{logger,jdbcType=VARCHAR},
      </if>
      <if test="message != null">
        message = #{message,jdbcType=LONGVARCHAR},
      </if>
      <if test="exception != null">
        exception = #{exception,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.koobietech.eas.mbg.model.EasSysLogs">
    update eas_sys_logs
    set timestamp = #{timestamp,jdbcType=TIMESTAMP},
      level = #{level,jdbcType=VARCHAR},
      logger = #{logger,jdbcType=VARCHAR},
      message = #{message,jdbcType=LONGVARCHAR},
      exception = #{exception,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.koobietech.eas.mbg.model.EasSysLogs">
    update eas_sys_logs
    set timestamp = #{timestamp,jdbcType=TIMESTAMP},
      level = #{level,jdbcType=VARCHAR},
      logger = #{logger,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>