<?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.ErrLogMapper">

	<resultMap id="BaseResultMap"
		type="com.huatek.frame.base.entity.ErrLogWithBLOBs">
		<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="request_url" jdbcType="VARCHAR"
			property="requestUrl" />
		<result column="request_method" jdbcType="VARCHAR"
			property="requestMethod" />
		<result column="param" jdbcType="LONGVARCHAR" property="param" />
		<result column="text" jdbcType="LONGVARCHAR" property="text" />
	</resultMap>

	<sql id="Base_Column_List">
		id, create_date, ip_address, request_url, request_method
	</sql>

	<sql id="Blob_Column_List">
		param, text
	</sql>


	<select id="selectErrLogPage"
		parameterType="com.huatek.frame.base.entity.ErrLogWithBLOBs"
		resultMap="BaseResultMap">
		select
		<include refid="Base_Column_List" />
		,
		<include refid="Blob_Column_List" />
		from
		sys_err_log
		where
		1=1
		order by create_date desc
	</select>

	<insert id="insertBatch">
		INSERT INTO sys_err_log
		(id, param, text,create_date,ip_address,request_url,request_method)
		VALUES
		<foreach collection="list" item="log" separator=",">
			(#{log.id}, #{log.param}, #{log.text}, #{log.createDate}, #{log.ipAddress}, #{log.requestUrl}, #{log.requestMethod})
		</foreach>
	</insert>
</mapper>