LOGMapper.xml 6.6 KB
<?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.tianbo.warehouse.dao.LOGMapper">
  <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.LOG">
    <id column="logId" jdbcType="INTEGER" property="logid" />
    <result column="userName" jdbcType="VARCHAR" property="username" />
    <result column="ip" jdbcType="VARCHAR" property="ip" />
    <result column="logCreatTime" jdbcType="TIMESTAMP" property="logcreattime" />
    <result column="methodName" jdbcType="VARCHAR" property="methodname" />
    <result column="modelNameCN" jdbcType="VARCHAR" property="modelnamecn" />
    <result column="operateNameCN" jdbcType="VARCHAR" property="operatenamecn" />
    <result column="className" jdbcType="VARCHAR" property="classname" />
  </resultMap>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.tianbo.warehouse.model.LOGWithBLOBs">
    <result column="parameters" jdbcType="LONGVARCHAR" property="parameters" />
    <result column="result" jdbcType="LONGVARCHAR" property="result" />
  </resultMap>
  <sql id="Base_Column_List">
    logId, userName, ip, logCreatTime, methodName, modelNameCN, operateNameCN, className
  </sql>
  <sql id="Blob_Column_List">
    parameters, result
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from log
    where logId = #{logid,jdbcType=INTEGER}
  </select>
  <select id="selectAll"  resultMap="ResultMapWithBLOBs">
    select
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from log
    where 1=1
    <if test="modelnamecn != ''">
      and modelNameCN = #{modelnamecn, jdbcType=VARCHAR}
    </if>
    <if test="username != ''">
      and userName = #{username, jdbcType=VARCHAR}
    </if>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from log
    where logId = #{logid,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs">
    insert into log (logId, userName, ip, 
      logCreatTime, methodName, modelNameCN, 
      operateNameCN, className, parameters, 
      result)
    values (#{logid,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{ip,jdbcType=VARCHAR}, 
      #{logcreattime,jdbcType=TIMESTAMP}, #{methodname,jdbcType=VARCHAR}, #{modelnamecn,jdbcType=VARCHAR}, 
      #{operatenamecn,jdbcType=VARCHAR}, #{classname,jdbcType=VARCHAR}, #{parameters,jdbcType=LONGVARCHAR}, 
      #{result,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs">
    insert into log
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="logid != null">
        logId,
      </if>
      <if test="username != null">
        userName,
      </if>
      <if test="ip != null">
        ip,
      </if>
      <if test="logcreattime != null">
        logCreatTime,
      </if>
      <if test="methodname != null">
        methodName,
      </if>
      <if test="modelnamecn != null">
        modelNameCN,
      </if>
      <if test="operatenamecn != null">
        operateNameCN,
      </if>
      <if test="classname != null">
        className,
      </if>
      <if test="parameters != null">
        parameters,
      </if>
      <if test="result != null">
        result,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="logid != null">
        #{logid,jdbcType=INTEGER},
      </if>
      <if test="username != null">
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="ip != null">
        #{ip,jdbcType=VARCHAR},
      </if>
      <if test="logcreattime != null">
        #{logcreattime,jdbcType=TIMESTAMP},
      </if>
      <if test="methodname != null">
        #{methodname,jdbcType=VARCHAR},
      </if>
      <if test="modelnamecn != null">
        #{modelnamecn,jdbcType=VARCHAR},
      </if>
      <if test="operatenamecn != null">
        #{operatenamecn,jdbcType=VARCHAR},
      </if>
      <if test="classname != null">
        #{classname,jdbcType=VARCHAR},
      </if>
      <if test="parameters != null">
        #{parameters,jdbcType=LONGVARCHAR},
      </if>
      <if test="result != null">
        #{result,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs">
    update log
    <set>
      <if test="username != null">
        userName = #{username,jdbcType=VARCHAR},
      </if>
      <if test="ip != null">
        ip = #{ip,jdbcType=VARCHAR},
      </if>
      <if test="logcreattime != null">
        logCreatTime = #{logcreattime,jdbcType=TIMESTAMP},
      </if>
      <if test="methodname != null">
        methodName = #{methodname,jdbcType=VARCHAR},
      </if>
      <if test="modelnamecn != null">
        modelNameCN = #{modelnamecn,jdbcType=VARCHAR},
      </if>
      <if test="operatenamecn != null">
        operateNameCN = #{operatenamecn,jdbcType=VARCHAR},
      </if>
      <if test="classname != null">
        className = #{classname,jdbcType=VARCHAR},
      </if>
      <if test="parameters != null">
        parameters = #{parameters,jdbcType=LONGVARCHAR},
      </if>
      <if test="result != null">
        result = #{result,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where logId = #{logid,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.tianbo.warehouse.model.LOGWithBLOBs">
    update log
    set userName = #{username,jdbcType=VARCHAR},
      ip = #{ip,jdbcType=VARCHAR},
      logCreatTime = #{logcreattime,jdbcType=TIMESTAMP},
      methodName = #{methodname,jdbcType=VARCHAR},
      modelNameCN = #{modelnamecn,jdbcType=VARCHAR},
      operateNameCN = #{operatenamecn,jdbcType=VARCHAR},
      className = #{classname,jdbcType=VARCHAR},
      parameters = #{parameters,jdbcType=LONGVARCHAR},
      result = #{result,jdbcType=LONGVARCHAR}
    where logId = #{logid,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.LOG">
    update log
    set userName = #{username,jdbcType=VARCHAR},
      ip = #{ip,jdbcType=VARCHAR},
      logCreatTime = #{logcreattime,jdbcType=TIMESTAMP},
      methodName = #{methodname,jdbcType=VARCHAR},
      modelNameCN = #{modelnamecn,jdbcType=VARCHAR},
      operateNameCN = #{operatenamecn,jdbcType=VARCHAR},
      className = #{classname,jdbcType=VARCHAR}
    where logId = #{logid,jdbcType=INTEGER}
  </update>
</mapper>