Browse Source

操作日志增加事件类型和事件级别功能。

wukai 1 year ago
parent
commit
43be28d471

File diff suppressed because it is too large
+ 0 - 95
README.md


+ 2 - 1
doc-admin/src/main/java/com/doc/web/controller/system/SysUserController.java

@@ -9,6 +9,7 @@ import com.doc.common.core.domain.entity.SysRole;
 import com.doc.common.core.domain.entity.SysUser;
 import com.doc.common.core.page.TableDataInfo;
 import com.doc.common.enums.BusinessType;
+import com.doc.common.enums.EventLevel;
 import com.doc.common.utils.SecurityUtils;
 import com.doc.common.utils.StringUtils;
 import com.doc.common.utils.bean.BeanUtils;
@@ -174,7 +175,7 @@ public class SysUserController extends BaseController {
      * 新增用户
      */
     @PreAuthorize("@ss.hasPermi('system:user:add')")
-    @Log(title = "用户管理", businessType = BusinessType.INSERT)
+    @Log(title = "用户管理", businessType = BusinessType.INSERT, eventLevel = EventLevel.HIGH)
     @PostMapping
     public AjaxResult add(@Validated @RequestBody SysUser user) {
         if (!userService.checkUserNameUnique(user)) {

+ 9 - 2
doc-admin/src/test/java/com/test/DocTest.java

@@ -14,6 +14,7 @@ import javax.annotation.Resource;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
+import java.util.Properties;
 
 /**
  * Test$
@@ -39,7 +40,13 @@ public class DocTest {
     }
 
     public static void main(String[] args) throws FileNotFoundException {
-        File f = new File("D:\\SYSTEM\\Desktop\\temp\\doc\\word.docx");
-        FileInputStream is = new FileInputStream(f);
+//        File f = new File("D:\\SYSTEM\\Desktop\\temp\\doc\\word.docx");
+//        FileInputStream is = new FileInputStream(f);
+
+        Properties properties = System.getProperties();
+
+        String osName = properties.getProperty("os.name");
+
+        System.out.println("操作系统 :" + osName);
     }
 }

+ 15 - 5
doc-common/src/main/java/com/doc/common/annotation/Log.java

@@ -1,21 +1,21 @@
 package com.doc.common.annotation;
 
 import com.doc.common.enums.BusinessType;
+import com.doc.common.enums.EventLevel;
+import com.doc.common.enums.EventType;
 import com.doc.common.enums.OperatorType;
 
 import java.lang.annotation.*;
 
 /**
  * 自定义操作日志记录注解
- * 
- * @author ruoyi
  *
+ * @author ruoyi
  */
-@Target({ ElementType.PARAMETER, ElementType.METHOD })
+@Target({ElementType.PARAMETER, ElementType.METHOD})
 @Retention(RetentionPolicy.RUNTIME)
 @Documented
-public @interface Log
-{
+public @interface Log {
     /**
      * 模块
      */
@@ -32,6 +32,16 @@ public @interface Log
     public OperatorType operatorType() default OperatorType.MANAGE;
 
     /**
+     * 事件类型
+     */
+    public EventType eventType() default EventType.BUSINESS;
+
+    /**
+     * 事件类型
+     */
+    public EventLevel eventLevel() default EventLevel.LOW;
+
+    /**
      * 是否保存请求的参数
      */
     public boolean isSaveRequestData() default true;

+ 22 - 0
doc-common/src/main/java/com/doc/common/enums/EventLevel.java

@@ -0,0 +1,22 @@
+package com.doc.common.enums;
+
+/**
+ * 事件级别
+ *
+ * @author ruoyi
+ */
+public enum EventLevel {
+    /**
+     * 高
+     */
+    HIGH,
+
+    /**
+     * 中
+     */
+    MIDDLE,
+    /**
+     * 低
+     */
+    LOW,
+}

+ 18 - 0
doc-common/src/main/java/com/doc/common/enums/EventType.java

@@ -0,0 +1,18 @@
+package com.doc.common.enums;
+
+/**
+ * 事件类型
+ *
+ * @author ruoyi
+ */
+public enum EventType {
+    /**
+     * 系统事件
+     */
+    SYSTEM,
+
+    /**
+     * 业务事件
+     */
+    BUSINESS,
+}

+ 47 - 74
doc-framework/src/main/java/com/doc/framework/aspectj/LogAspect.java

@@ -33,27 +33,29 @@ import java.util.Map;
 
 /**
  * 操作日志记录处理
- * 
+ *
  * @author ruoyi
  */
 @Aspect
 @Component
-public class LogAspect
-{
+public class LogAspect {
     private static final Logger log = LoggerFactory.getLogger(LogAspect.class);
 
-    /** 排除敏感属性字段 */
-    public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" };
+    /**
+     * 排除敏感属性字段
+     */
+    public static final String[] EXCLUDE_PROPERTIES = {"password", "oldPassword", "newPassword", "confirmPassword"};
 
-    /** 计算操作消耗时间 */
+    /**
+     * 计算操作消耗时间
+     */
     private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time");
 
     /**
      * 处理请求前执行
      */
     @Before(value = "@annotation(controllerLog)")
-    public void boBefore(JoinPoint joinPoint, Log controllerLog)
-    {
+    public void boBefore(JoinPoint joinPoint, Log controllerLog) {
         TIME_THREADLOCAL.set(System.currentTimeMillis());
     }
 
@@ -63,27 +65,23 @@ public class LogAspect
      * @param joinPoint 切点
      */
     @AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult")
-    public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult)
-    {
+    public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult) {
         handleLog(joinPoint, controllerLog, null, jsonResult);
     }
 
     /**
      * 拦截异常操作
-     * 
+     *
      * @param joinPoint 切点
-     * @param e 异常
+     * @param e         异常
      */
     @AfterThrowing(value = "@annotation(controllerLog)", throwing = "e")
-    public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e)
-    {
+    public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e) {
         handleLog(joinPoint, controllerLog, e, null);
     }
 
-    protected void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult)
-    {
-        try
-        {
+    protected void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult) {
+        try {
             // 获取当前的用户
             LoginUser loginUser = SecurityUtils.getLoginUser();
 
@@ -94,13 +92,11 @@ public class LogAspect
             String ip = IpUtils.getIpAddr();
             operLog.setOperIp(ip);
             operLog.setOperUrl(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255));
-            if (loginUser != null)
-            {
+            if (loginUser != null) {
                 operLog.setOperName(loginUser.getUsername());
             }
 
-            if (e != null)
-            {
+            if (e != null) {
                 operLog.setStatus(BusinessStatus.FAIL.ordinal());
                 operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000));
             }
@@ -116,65 +112,58 @@ public class LogAspect
             operLog.setCostTime(System.currentTimeMillis() - TIME_THREADLOCAL.get());
             // 保存数据库
             AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
-        }
-        catch (Exception exp)
-        {
+        } catch (Exception exp) {
             // 记录本地异常日志
             log.error("异常信息:{}", exp.getMessage());
             exp.printStackTrace();
-        }
-        finally
-        {
+        } finally {
             TIME_THREADLOCAL.remove();
         }
     }
 
     /**
      * 获取注解中对方法的描述信息 用于Controller层注解
-     * 
-     * @param log 日志
+     *
+     * @param log     日志
      * @param operLog 操作日志
      * @throws Exception
      */
-    public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception
-    {
+    public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception {
         // 设置action动作
         operLog.setBusinessType(log.businessType().ordinal());
         // 设置标题
         operLog.setTitle(log.title());
+        // 设置事件类型
+        operLog.setEventType(log.eventType().ordinal());
+        // 设置事件级别
+        operLog.setEventLevel(log.eventLevel().ordinal());
         // 设置操作人类别
         operLog.setOperatorType(log.operatorType().ordinal());
         // 是否需要保存request,参数和值
-        if (log.isSaveRequestData())
-        {
+        if (log.isSaveRequestData()) {
             // 获取参数的信息,传入到数据库中。
             setRequestValue(joinPoint, operLog, log.excludeParamNames());
         }
         // 是否需要保存response,参数和值
-        if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult))
-        {
+        if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult)) {
             operLog.setJsonResult(StringUtils.substring(JSON.toJSONString(jsonResult), 0, 2000));
         }
     }
 
     /**
      * 获取请求的参数,放到log中
-     * 
+     *
      * @param operLog 操作日志
      * @throws Exception 异常
      */
-    private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog, String[] excludeParamNames) throws Exception
-    {
+    private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog, String[] excludeParamNames) throws Exception {
         Map<?, ?> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest());
         String requestMethod = operLog.getRequestMethod();
         if (StringUtils.isEmpty(paramsMap)
-                && (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod)))
-        {
+                && (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod))) {
             String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames);
             operLog.setOperParam(StringUtils.substring(params, 0, 2000));
-        }
-        else
-        {
+        } else {
             operLog.setOperParam(StringUtils.substring(JSON.toJSONString(paramsMap, excludePropertyPreFilter(excludeParamNames)), 0, 2000));
         }
     }
@@ -182,22 +171,15 @@ public class LogAspect
     /**
      * 参数拼装
      */
-    private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames)
-    {
+    private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames) {
         String params = "";
-        if (paramsArray != null && paramsArray.length > 0)
-        {
-            for (Object o : paramsArray)
-            {
-                if (StringUtils.isNotNull(o) && !isFilterObject(o))
-                {
-                    try
-                    {
+        if (paramsArray != null && paramsArray.length > 0) {
+            for (Object o : paramsArray) {
+                if (StringUtils.isNotNull(o) && !isFilterObject(o)) {
+                    try {
                         String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames));
                         params += jsonObj.toString() + " ";
-                    }
-                    catch (Exception e)
-                    {
+                    } catch (Exception e) {
                     }
                 }
             }
@@ -208,38 +190,29 @@ public class LogAspect
     /**
      * 忽略敏感属性
      */
-    public PropertyPreExcludeFilter excludePropertyPreFilter(String[] excludeParamNames)
-    {
+    public PropertyPreExcludeFilter excludePropertyPreFilter(String[] excludeParamNames) {
         return new PropertyPreExcludeFilter().addExcludes(ArrayUtils.addAll(EXCLUDE_PROPERTIES, excludeParamNames));
     }
 
     /**
      * 判断是否需要过滤的对象。
-     * 
+     *
      * @param o 对象信息。
      * @return 如果是需要过滤的对象,则返回true;否则返回false。
      */
     @SuppressWarnings("rawtypes")
-    public boolean isFilterObject(final Object o)
-    {
+    public boolean isFilterObject(final Object o) {
         Class<?> clazz = o.getClass();
-        if (clazz.isArray())
-        {
+        if (clazz.isArray()) {
             return clazz.getComponentType().isAssignableFrom(MultipartFile.class);
-        }
-        else if (Collection.class.isAssignableFrom(clazz))
-        {
+        } else if (Collection.class.isAssignableFrom(clazz)) {
             Collection collection = (Collection) o;
-            for (Object value : collection)
-            {
+            for (Object value : collection) {
                 return value instanceof MultipartFile;
             }
-        }
-        else if (Map.class.isAssignableFrom(clazz))
-        {
+        } else if (Map.class.isAssignableFrom(clazz)) {
             Map map = (Map) o;
-            for (Object value : map.entrySet())
-            {
+            for (Object value : map.entrySet()) {
                 Map.Entry entry = (Map.Entry) value;
                 return entry.getValue() instanceof MultipartFile;
             }

+ 114 - 94
doc-system/src/main/java/com/doc/system/domain/SysOperLog.java

@@ -9,262 +9,282 @@ import java.util.Date;
 
 /**
  * 操作日志记录表 oper_log
- * 
+ *
  * @author ruoyi
  */
-public class SysOperLog extends BaseEntity
-{
+public class SysOperLog extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 日志主键 */
+    /**
+     * 日志主键
+     */
     @Excel(name = "操作序号", cellType = ColumnType.NUMERIC)
     private Long operId;
 
-    /** 操作模块 */
+    /**
+     * 操作模块
+     */
     @Excel(name = "操作模块")
     private String title;
-
-    /** 业务类型(0其它 1新增 2修改 3删除) */
+    @Excel(name = "事件类型")
+    private Integer eventType;
+    @Excel(name = "事件级别")
+    private Integer eventLevel;
+
+    /**
+     * 业务类型(0其它 1新增 2修改 3删除)
+     */
     @Excel(name = "业务类型", readConverterExp = "0=其它,1=新增,2=修改,3=删除,4=授权,5=导出,6=导入,7=强退,8=生成代码,9=清空数据")
     private Integer businessType;
 
-    /** 业务类型数组 */
+    /**
+     * 业务类型数组
+     */
     private Integer[] businessTypes;
 
-    /** 请求方法 */
+    /**
+     * 请求方法
+     */
     @Excel(name = "请求方法")
     private String method;
 
-    /** 请求方式 */
+    /**
+     * 请求方式
+     */
     @Excel(name = "请求方式")
     private String requestMethod;
 
-    /** 操作类别(0其它 1后台用户 2手机端用户) */
+    /**
+     * 操作类别(0其它 1后台用户 2手机端用户)
+     */
     @Excel(name = "操作类别", readConverterExp = "0=其它,1=后台用户,2=手机端用户")
     private Integer operatorType;
 
-    /** 操作人员 */
+    /**
+     * 操作人员
+     */
     @Excel(name = "操作人员")
     private String operName;
 
-    /** 部门名称 */
+    /**
+     * 部门名称
+     */
     @Excel(name = "部门名称")
     private String deptName;
 
-    /** 请求url */
+    /**
+     * 请求url
+     */
     @Excel(name = "请求地址")
     private String operUrl;
 
-    /** 操作地址 */
+    /**
+     * 操作地址
+     */
     @Excel(name = "操作地址")
     private String operIp;
 
-    /** 操作地点 */
+    /**
+     * 操作地点
+     */
     @Excel(name = "操作地点")
     private String operLocation;
 
-    /** 请求参数 */
+    /**
+     * 请求参数
+     */
     @Excel(name = "请求参数")
     private String operParam;
 
-    /** 返回参数 */
+    /**
+     * 返回参数
+     */
     @Excel(name = "返回参数")
     private String jsonResult;
 
-    /** 操作状态(0正常 1异常) */
+    /**
+     * 操作状态(0正常 1异常)
+     */
     @Excel(name = "状态", readConverterExp = "0=正常,1=异常")
     private Integer status;
 
-    /** 错误消息 */
+    /**
+     * 错误消息
+     */
     @Excel(name = "错误消息")
     private String errorMsg;
 
-    /** 操作时间 */
+    /**
+     * 操作时间
+     */
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date operTime;
 
-    /** 消耗时间 */
+    /**
+     * 消耗时间
+     */
     @Excel(name = "消耗时间", suffix = "毫秒")
     private Long costTime;
 
-    public Long getOperId()
-    {
+
+    public Integer getEventType() {
+        return eventType;
+    }
+
+    public void setEventType(Integer eventType) {
+        this.eventType = eventType;
+    }
+
+    public Integer getEventLevel() {
+        return eventLevel;
+    }
+
+    public void setEventLevel(Integer eventLevel) {
+        this.eventLevel = eventLevel;
+    }
+
+    public Long getOperId() {
         return operId;
     }
 
-    public void setOperId(Long operId)
-    {
+    public void setOperId(Long operId) {
         this.operId = operId;
     }
 
-    public String getTitle()
-    {
+    public String getTitle() {
         return title;
     }
 
-    public void setTitle(String title)
-    {
+    public void setTitle(String title) {
         this.title = title;
     }
 
-    public Integer getBusinessType()
-    {
+    public Integer getBusinessType() {
         return businessType;
     }
 
-    public void setBusinessType(Integer businessType)
-    {
+    public void setBusinessType(Integer businessType) {
         this.businessType = businessType;
     }
 
-    public Integer[] getBusinessTypes()
-    {
+    public Integer[] getBusinessTypes() {
         return businessTypes;
     }
 
-    public void setBusinessTypes(Integer[] businessTypes)
-    {
+    public void setBusinessTypes(Integer[] businessTypes) {
         this.businessTypes = businessTypes;
     }
 
-    public String getMethod()
-    {
+    public String getMethod() {
         return method;
     }
 
-    public void setMethod(String method)
-    {
+    public void setMethod(String method) {
         this.method = method;
     }
 
-    public String getRequestMethod()
-    {
+    public String getRequestMethod() {
         return requestMethod;
     }
 
-    public void setRequestMethod(String requestMethod)
-    {
+    public void setRequestMethod(String requestMethod) {
         this.requestMethod = requestMethod;
     }
 
-    public Integer getOperatorType()
-    {
+    public Integer getOperatorType() {
         return operatorType;
     }
 
-    public void setOperatorType(Integer operatorType)
-    {
+    public void setOperatorType(Integer operatorType) {
         this.operatorType = operatorType;
     }
 
-    public String getOperName()
-    {
+    public String getOperName() {
         return operName;
     }
 
-    public void setOperName(String operName)
-    {
+    public void setOperName(String operName) {
         this.operName = operName;
     }
 
-    public String getDeptName()
-    {
+    public String getDeptName() {
         return deptName;
     }
 
-    public void setDeptName(String deptName)
-    {
+    public void setDeptName(String deptName) {
         this.deptName = deptName;
     }
 
-    public String getOperUrl()
-    {
+    public String getOperUrl() {
         return operUrl;
     }
 
-    public void setOperUrl(String operUrl)
-    {
+    public void setOperUrl(String operUrl) {
         this.operUrl = operUrl;
     }
 
-    public String getOperIp()
-    {
+    public String getOperIp() {
         return operIp;
     }
 
-    public void setOperIp(String operIp)
-    {
+    public void setOperIp(String operIp) {
         this.operIp = operIp;
     }
 
-    public String getOperLocation()
-    {
+    public String getOperLocation() {
         return operLocation;
     }
 
-    public void setOperLocation(String operLocation)
-    {
+    public void setOperLocation(String operLocation) {
         this.operLocation = operLocation;
     }
 
-    public String getOperParam()
-    {
+    public String getOperParam() {
         return operParam;
     }
 
-    public void setOperParam(String operParam)
-    {
+    public void setOperParam(String operParam) {
         this.operParam = operParam;
     }
 
-    public String getJsonResult()
-    {
+    public String getJsonResult() {
         return jsonResult;
     }
 
-    public void setJsonResult(String jsonResult)
-    {
+    public void setJsonResult(String jsonResult) {
         this.jsonResult = jsonResult;
     }
 
-    public Integer getStatus()
-    {
+    public Integer getStatus() {
         return status;
     }
 
-    public void setStatus(Integer status)
-    {
+    public void setStatus(Integer status) {
         this.status = status;
     }
 
-    public String getErrorMsg()
-    {
+    public String getErrorMsg() {
         return errorMsg;
     }
 
-    public void setErrorMsg(String errorMsg)
-    {
+    public void setErrorMsg(String errorMsg) {
         this.errorMsg = errorMsg;
     }
 
-    public Date getOperTime()
-    {
+    public Date getOperTime() {
         return operTime;
     }
 
-    public void setOperTime(Date operTime)
-    {
+    public void setOperTime(Date operTime) {
         this.operTime = operTime;
     }
 
-    public Long getCostTime()
-    {
+    public Long getCostTime() {
         return costTime;
     }
 
-    public void setCostTime(Long costTime)
-    {
+    public void setCostTime(Long costTime) {
         this.costTime = costTime;
     }
 }

+ 103 - 73
doc-system/src/main/resources/mapper/system/SysOperLogMapper.xml

@@ -1,83 +1,113 @@
 <?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">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.doc.system.mapper.SysOperLogMapper">
 
-	<resultMap type="SysOperLog" id="SysOperLogResult">
-		<id     property="operId"         column="oper_id"        />
-		<result property="title"          column="title"          />
-		<result property="businessType"   column="business_type"  />
-		<result property="method"         column="method"         />
-		<result property="requestMethod"  column="request_method" />
-		<result property="operatorType"   column="operator_type"  />
-		<result property="operName"       column="oper_name"      />
-		<result property="deptName"       column="dept_name"      />
-		<result property="operUrl"        column="oper_url"       />
-		<result property="operIp"         column="oper_ip"        />
-		<result property="operLocation"   column="oper_location"  />
-		<result property="operParam"      column="oper_param"     />
-		<result property="jsonResult"     column="json_result"    />
-		<result property="status"         column="status"         />
-		<result property="errorMsg"       column="error_msg"      />
-		<result property="operTime"       column="oper_time"      />
-		<result property="costTime"       column="cost_time"      />
-	</resultMap>
+    <resultMap type="SysOperLog" id="SysOperLogResult">
+        <id property="operId" column="oper_id"/>
+        <result property="title" column="title"/>
+        <result property="eventType" column="event_type"/>
+        <result property="eventLevel" column="event_level"/>
+        <result property="businessType" column="business_type"/>
+        <result property="method" column="method"/>
+        <result property="requestMethod" column="request_method"/>
+        <result property="operatorType" column="operator_type"/>
+        <result property="operName" column="oper_name"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="operUrl" column="oper_url"/>
+        <result property="operIp" column="oper_ip"/>
+        <result property="operLocation" column="oper_location"/>
+        <result property="operParam" column="oper_param"/>
+        <result property="jsonResult" column="json_result"/>
+        <result property="status" column="status"/>
+        <result property="errorMsg" column="error_msg"/>
+        <result property="operTime" column="oper_time"/>
+        <result property="costTime" column="cost_time"/>
+    </resultMap>
 
-	<sql id="selectOperLogVo">
-        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
+    <sql id="selectOperLogVo">
+        select oper_id,
+               title,
+               event_type,
+               event_level,
+               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
         from sys_oper_log
     </sql>
-    
-	<insert id="insertOperlog" parameterType="SysOperLog">
-		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)
-        values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{costTime}, sysdate())
-	</insert>
-	
-	<select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
-		<include refid="selectOperLogVo"/>
-		<where>
-			<if test="title != null and title != ''">
-				AND title like concat('%', #{title}, '%')
-			</if>
-			<if test="businessType != null">
-				AND business_type = #{businessType}
-			</if>
-			<if test="businessTypes != null and businessTypes.length > 0">
-			    AND business_type in
-			    <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
-		 			#{businessType}
-		        </foreach> 
-			</if>
-			<if test="status != null">
-				AND status = #{status}
-			</if>
-			<if test="operName != null and operName != ''">
-				AND oper_name like concat('%', #{operName}, '%')
-			</if>
-			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				AND oper_time &gt;= #{params.beginTime}
-			</if>
-			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				AND oper_time &lt;= #{params.endTime}
-			</if>
-		</where>
-		order by oper_id desc
-	</select>
-	
-	<delete id="deleteOperLogByIds" parameterType="Long">
- 		delete from sys_oper_log where oper_id in
- 		<foreach collection="array" item="operId" open="(" separator="," close=")">
- 			#{operId}
-        </foreach> 
- 	</delete>
- 	
- 	<select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
-		<include refid="selectOperLogVo"/>
-		where oper_id = #{operId}
-	</select>
-	
-	<update id="cleanOperLog">
+
+    <insert id="insertOperlog" parameterType="SysOperLog">
+        insert into sys_oper_log(title, event_type, event_level, 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)
+        values (#{title}, #{eventType}, #{eventLevel}, #{businessType}, #{method}, #{requestMethod}, #{operatorType},
+                #{operName}, #{deptName}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult},
+                #{status}, #{errorMsg}, #{costTime}, sysdate())
+    </insert>
+
+    <select id="selectOperLogList" parameterType="SysOperLog" resultMap="SysOperLogResult">
+        <include refid="selectOperLogVo"/>
+        <where>
+            <if test="title != null and title != ''">
+                AND title like concat('%', #{title}, '%')
+            </if>
+            <if test="eventType != null">
+                AND event_type = #{eventType}
+            </if>
+            <if test="eventLevel != null">
+                AND event_level = #{eventLevel}
+            </if>
+            <if test="businessType != null">
+                AND business_type = #{businessType}
+            </if>
+            <if test="businessTypes != null and businessTypes.length > 0">
+                AND business_type in
+                <foreach collection="businessTypes" item="businessType" open="(" separator="," close=")">
+                    #{businessType}
+                </foreach>
+            </if>
+            <if test="status != null">
+                AND status = #{status}
+            </if>
+            <if test="operName != null and operName != ''">
+                AND oper_name like concat('%', #{operName}, '%')
+            </if>
+            <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
+                AND oper_time &gt;= #{params.beginTime}
+            </if>
+            <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
+                AND oper_time &lt;= #{params.endTime}
+            </if>
+        </where>
+        order by oper_id desc
+    </select>
+
+    <delete id="deleteOperLogByIds" parameterType="Long">
+        delete from sys_oper_log where oper_id in
+        <foreach collection="array" item="operId" open="(" separator="," close=")">
+            #{operId}
+        </foreach>
+    </delete>
+
+    <select id="selectOperLogById" parameterType="Long" resultMap="SysOperLogResult">
+        <include refid="selectOperLogVo"/>
+        where oper_id = #{operId}
+    </select>
+
+    <update id="cleanOperLog">
         truncate table sys_oper_log
     </update>
 

Some files were not shown because too many files changed in this diff