Jiarenxiang | 25a45b7 | 2025-03-13 16:09:13 +0800 | [diff] [blame^] | 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <!DOCTYPE mapper |
| 3 | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| 4 | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| 5 | <mapper namespace="com.ruoyi.system.mapper.SysOperLogMapper"> |
| 6 | |
| 7 | <resultMap type="SysOperLog" id="SysOperLogResult"> |
| 8 | <id property="operId" column="oper_id" /> |
| 9 | <result property="title" column="title" /> |
| 10 | <result property="businessType" column="business_type" /> |
| 11 | <result property="method" column="method" /> |
| 12 | <result property="requestMethod" column="request_method" /> |
| 13 | <result property="operatorType" column="operator_type" /> |
| 14 | <result property="operName" column="oper_name" /> |
| 15 | <result property="deptName" column="dept_name" /> |
| 16 | <result property="operUrl" column="oper_url" /> |
| 17 | <result property="operIp" column="oper_ip" /> |
| 18 | <result property="operLocation" column="oper_location" /> |
| 19 | <result property="operParam" column="oper_param" /> |
| 20 | <result property="jsonResult" column="json_result" /> |
| 21 | <result property="status" column="status" /> |
| 22 | <result property="errorMsg" column="error_msg" /> |
| 23 | <result property="operTime" column="oper_time" /> |
| 24 | <result property="costTime" column="cost_time" /> |
| 25 | </resultMap> |
| 26 | |
| 27 | <sql id="selectOperLogVo"> |
| 28 | select oper_id, title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, cost_time |
| 29 | from sys_oper_log |
| 30 | </sql> |
| 31 | |
| 32 | <insert id="insertOperlog" parameterType="SysOperLog"> |
| 33 | insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, cost_time, oper_time) |
| 34 | values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate()) |
| 35 | </insert> |
| 36 | |
| 37 | <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult"> |
| 38 | <include refid="selectOperLogVo"/> |
| 39 | <where> |
| 40 | <if test="operIp != null and operIp != ''"> |
| 41 | AND oper_ip like concat('%', #{operIp}, '%') |
| 42 | </if> |
| 43 | <if test="title != null and title != ''"> |
| 44 | AND title like concat('%', #{title}, '%') |
| 45 | </if> |
| 46 | <if test="businessType != null"> |
| 47 | AND business_type = #{businessType} |
| 48 | </if> |
| 49 | <if test="businessTypes != null and businessTypes.length > 0"> |
| 50 | AND business_type in |
| 51 | <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")"> |
| 52 | #{businessType} |
| 53 | </foreach> |
| 54 | </if> |
| 55 | <if test="status != null"> |
| 56 | AND status = #{status} |
| 57 | </if> |
| 58 | <if test="operName != null and operName != ''"> |
| 59 | AND oper_name like concat('%', #{operName}, '%') |
| 60 | </if> |
| 61 | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> |
| 62 | AND oper_time >= #{params.beginTime} |
| 63 | </if> |
| 64 | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> |
| 65 | AND oper_time <= #{params.endTime} |
| 66 | </if> |
| 67 | </where> |
| 68 | order by oper_id desc |
| 69 | </select> |
| 70 | |
| 71 | <delete id="deleteOperLogByIds" parameterType="Long"> |
| 72 | delete from sys_oper_log where oper_id in |
| 73 | <foreach collection="array" item="operId" open="(" separator="," close=")"> |
| 74 | #{operId} |
| 75 | </foreach> |
| 76 | </delete> |
| 77 | |
| 78 | <select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult"> |
| 79 | <include refid="selectOperLogVo"/> |
| 80 | where oper_id = #{operId} |
| 81 | </select> |
| 82 | |
| 83 | <update id="cleanOperLog"> |
| 84 | truncate table sys_oper_log |
| 85 | </update> |
| 86 | |
| 87 | </mapper> |