LogMapper.xml 1.8 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.sibu.orderHelper.integral.web.dao.LogDao">
	
	<resultMap type="com.sibu.orderHelper.integral.sys.response.SystemLogResponse" id="listSysLog">
    	<id column="id" property="id"/>
        <result column="operation_username" property="operationUsername" />
        <result column="operation_nickname" property="operationNickname" />
        <result column="description" property="description" />
        <result column="operation_method" property="operationMethod" />
        <result column="request_ip" property="requestIp" />
        <result column="exception_code" property="exceptionCode" />
        <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
    </resultMap>

	<insert id="saveLog" parameterType="com.sibu.orderHelper.integral.model.LogBean">
		INSERT INTO system_log (
			operation_username,operation_nickname,description,operation_method,log_type,request_ip,exception_code,exception_detail,params,create_date
		) VALUES (
			#{operationUsername},#{operationNickname},#{description},#{operationMethod},#{logType},#{requestIp},#{exceptionCode}
			,#{exceptionDetail},#{params},NOW()
		)
	</insert>
	
	<!-- 查询日志 -->
	<select id="listSysLog" parameterType="com.sibu.orderHelper.integral.sys.request.SystemLogRequest" resultMap="listSysLog">
		select id,operation_username,operation_nickname,description,operation_method,request_ip,exception_code,create_date 
		from system_log 
		where log_type = ${logType} 
		order by id desc 
		limit ${pageNow},${pageSize}
	</select>
	<select id="countSysLog" resultType="int" parameterType="com.sibu.orderHelper.integral.sys.request.SystemLogRequest">
		select count(*) from system_log where log_type = ${logType}
	</select>
	
</mapper>