<?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.usoft.credit.dal.mapper.LogMapper">
  <resultMap id="BaseResultMap" type="com.usoft.credit.dal.entity.Log">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="code" jdbcType="VARCHAR" property="code" />
    <result column="log_message" jdbcType="VARCHAR" property="logMessage" />
    <result column="log_title" jdbcType="VARCHAR" property="logTitle" />
    <result column="log_type" jdbcType="VARCHAR" property="logType" />
  </resultMap>
  <sql id="Base_Column_List">
    id, code, log_message, log_title, log_type
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from t_log
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_log
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.usoft.credit.dal.entity.Log">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_log (code, log_message, log_title, 
      log_type)
    values (#{code,jdbcType=VARCHAR}, #{logMessage,jdbcType=VARCHAR}, #{logTitle,jdbcType=VARCHAR}, 
      #{logType,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.usoft.credit.dal.entity.Log">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into t_log
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="code != null">
        code,
      </if>
      <if test="logMessage != null">
        log_message,
      </if>
      <if test="logTitle != null">
        log_title,
      </if>
      <if test="logType != null">
        log_type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="code != null">
        #{code,jdbcType=VARCHAR},
      </if>
      <if test="logMessage != null">
        #{logMessage,jdbcType=VARCHAR},
      </if>
      <if test="logTitle != null">
        #{logTitle,jdbcType=VARCHAR},
      </if>
      <if test="logType != null">
        #{logType,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.usoft.credit.dal.entity.Log">
    update t_log
    <set>
      <if test="code != null">
        code = #{code,jdbcType=VARCHAR},
      </if>
      <if test="logMessage != null">
        log_message = #{logMessage,jdbcType=VARCHAR},
      </if>
      <if test="logTitle != null">
        log_title = #{logTitle,jdbcType=VARCHAR},
      </if>
      <if test="logType != null">
        log_type = #{logType,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.usoft.credit.dal.entity.Log">
    update t_log
    set code = #{code,jdbcType=VARCHAR},
      log_message = #{logMessage,jdbcType=VARCHAR},
      log_title = #{logTitle,jdbcType=VARCHAR},
      log_type = #{logType,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>