<?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.huatek.frame.base.mapper.RequestLogMapper">

  <resultMap id="BaseResultMap" type="com.huatek.frame.base.entity.RequestLog">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="ip_address" jdbcType="VARCHAR" property="ipAddress" />
    <result column="method_name" jdbcType="VARCHAR" property="methodName" />
    <result column="model_name" jdbcType="VARCHAR" property="modelName" />
    <result column="project_name" jdbcType="VARCHAR" property="projectName" />
    <result column="request_method" jdbcType="VARCHAR" property="requestMethod" />
    <result column="request_name" jdbcType="VARCHAR" property="requestName" />
    <result column="request_url" jdbcType="VARCHAR" property="requestUrl" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
  </resultMap>
  
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.huatek.frame.base.entity.RequestLog">
    <result column="param" jdbcType="LONGVARCHAR" property="param" />
  </resultMap>
   
  <sql id="Base_Column_List">
    log.id, log.create_date, log.ip_address, log.method_name, log.model_name, log.project_name, log.request_method, 
    log.request_name, log.request_url, log.user_name 
  </sql>
  
  <sql id="Blob_Column_List">
    log.param
  </sql>
  
  <select id="selectRequestLogPage" parameterType="com.huatek.frame.base.entity.RequestLog" resultMap="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from 
    	sys_request_log log 
    <where>
	    <if test="userName != null  and  userName != '' ">
	    	log.user_name like concat('%',#{userName},'%')  
	    </if>
    </where>	 
    order by create_date desc
  </select> 
   
</mapper>