<?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.huaheng.pc.monitor.operlog.mapper.OperLogMapper"> <resultMap type="com.huaheng.pc.monitor.operlog.domain.OperLog" id="OperLogResult"> <id property="id" column="id" /> <result property="title" column="title" /> <result property="operating" column="operating" /> <result property="action" column="action" /> <result property="method" column="method" /> <result property="channel" column="channel" /> <result property="operName" column="operName" /> <result property="deptName" column="deptName" /> <result property="operUrl" column="operUrl" /> <result property="operIp" column="operIp" /> <result property="operLocation" column="operLocation" /> <result property="operParam" column="operParam" /> <result property="status" column="status" /> <result property="errorMsg" column="errorMsg" /> <result property="operTime" column="operTime" /> </resultMap> <sql id="selectOperLogVo"> select id, title, operating, action, method, channel, operName, deptName, operUrl, operIp,operLocation,operParam,status,errorMsg,operTime from sys_oper_log </sql> <insert id="insertOperlog"> insert into sys_oper_log(title, operating, action, method, channel, operName, deptName, operUrl, operIp, operLocation, operParam, status, errorMsg, operTime) values (#{title}, #{operating}, #{action}, #{method}, #{channel}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{status}, #{errorMsg}, sysdate()) </insert> <select id="selectOperLogList" resultMap="OperLogResult"> <include refid="selectOperLogVo"/> <where> <if test="title != null and title != ''"> AND title like concat('%', #{title}, '%') </if> <if test="operating != null and operating != ''"> AND operating like concat('%', #{operating}, '%') </if> <if test="action != null and action != ''"> AND action = #{action} </if> <if test="operName != null and operName != ''"> AND operName like concat('%', #{operName}, '%') </if> <if test="params != null and params.beginTime != null and params.beginTime !='' "><!-- 开始时间检索 --> and date_format(operTime,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d') </if> <if test="params != null and params.endTime != null and params.endTime !='' "><!-- 结束时间检索 --> and date_format(operTime,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d') </if> </where> </select> <delete id="deleteOperLogByIds"> delete from sys_oper_log where id in <foreach collection="array" item="id" open="(" separator="," close=")"> #{id} </foreach> </delete> <select id="selectOperLogById" resultMap="OperLogResult"> <include refid="selectOperLogVo"/> where id = #{id} </select> </mapper>