mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-07-19 21:45:06 +08:00
完善新操作日志的页面修改
This commit is contained in:
@ -4,6 +4,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
@Configuration
|
||||
@EnableAsync(proxyTargetClass = true)
|
||||
@EnableAsync
|
||||
public class AsyncConfiguration {
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.dashboard.framework.logger.operatelog.core.annotations;
|
||||
|
||||
import cn.iocoder.dashboard.modules.system.enums.logger.SysOperateLogTypeEnum;
|
||||
import cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateLogTypeEnum;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
@ -32,7 +32,7 @@ public @interface OperateLog {
|
||||
*
|
||||
* 实际并不是数组,因为枚举不能设置 null 作为默认值
|
||||
*/
|
||||
SysOperateLogTypeEnum[] type() default {};
|
||||
OperateLogTypeEnum[] type() default {};
|
||||
|
||||
// ========== 开关字段 ==========
|
||||
|
||||
|
@ -6,11 +6,11 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
import cn.iocoder.dashboard.common.pojo.CommonResult;
|
||||
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateLogTypeEnum;
|
||||
import cn.iocoder.dashboard.framework.logger.operatelog.core.service.OperateLogFrameworkService;
|
||||
import cn.iocoder.dashboard.framework.security.core.util.SecurityUtils;
|
||||
import cn.iocoder.dashboard.framework.tracer.core.util.TracerUtils;
|
||||
import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogCreateReqVO;
|
||||
import cn.iocoder.dashboard.modules.system.enums.logger.SysOperateLogTypeEnum;
|
||||
import cn.iocoder.dashboard.util.servlet.ServletUtils;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.common.collect.Maps;
|
||||
@ -180,7 +180,7 @@ public class OperateLogAspect {
|
||||
}
|
||||
if (operateLogVO.getType() == null) {
|
||||
RequestMethod requestMethod = obtainFirstMatchRequestMethod(obtainRequestMethod(joinPoint));
|
||||
SysOperateLogTypeEnum operateLogType = convertOperateLogType(requestMethod);
|
||||
OperateLogTypeEnum operateLogType = convertOperateLogType(requestMethod);
|
||||
operateLogVO.setType(operateLogType != null ? operateLogType.getType() : null);
|
||||
}
|
||||
// content 和 exts 属性
|
||||
@ -275,21 +275,21 @@ public class OperateLogAspect {
|
||||
return requestMethods[0];
|
||||
}
|
||||
|
||||
private static SysOperateLogTypeEnum convertOperateLogType(RequestMethod requestMethod) {
|
||||
private static OperateLogTypeEnum convertOperateLogType(RequestMethod requestMethod) {
|
||||
if (requestMethod == null) {
|
||||
return null;
|
||||
}
|
||||
switch (requestMethod) {
|
||||
case GET:
|
||||
return SysOperateLogTypeEnum.GET;
|
||||
return OperateLogTypeEnum.GET;
|
||||
case POST:
|
||||
return SysOperateLogTypeEnum.CREATE;
|
||||
return OperateLogTypeEnum.CREATE;
|
||||
case PUT:
|
||||
return SysOperateLogTypeEnum.UPDATE;
|
||||
return OperateLogTypeEnum.UPDATE;
|
||||
case DELETE:
|
||||
return SysOperateLogTypeEnum.DELETE;
|
||||
return OperateLogTypeEnum.DELETE;
|
||||
default:
|
||||
return SysOperateLogTypeEnum.OTHER;
|
||||
return OperateLogTypeEnum.OTHER;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,55 @@
|
||||
package cn.iocoder.dashboard.framework.logger.operatelog.core.enums;
|
||||
|
||||
import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 操作日志的操作类型
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum OperateLogTypeEnum {
|
||||
|
||||
/**
|
||||
* 查询
|
||||
*
|
||||
* 绝大多数情况下,不会记录查询动作,因为过于大量显得没有意义。
|
||||
* 在有需要的时候,通过声明 {@link OperateLog} 注解来记录
|
||||
*/
|
||||
GET(1),
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
CREATE(2),
|
||||
/**
|
||||
* 修改
|
||||
*/
|
||||
UPDATE(3),
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETE(4),
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
EXPORT(5),
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
IMPORT(6),
|
||||
/**
|
||||
* 其它
|
||||
*
|
||||
* 在无法归类时,可以选择使用其它。因为还有操作名可以进一步标识
|
||||
*/
|
||||
OTHER(0);
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.dashboard.framework.mybatis.core.mapper;
|
||||
|
||||
import cn.iocoder.dashboard.common.pojo.PageParam;
|
||||
import cn.iocoder.dashboard.common.pojo.PageResult;
|
||||
import cn.iocoder.dashboard.framework.mybatis.core.util.MyBatisUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 在 MyBatis Plus 的 BaseMapper 的基础上拓展,提供更多的能力
|
||||
*/
|
||||
public interface BaseMapperX<T> extends BaseMapper<T> {
|
||||
|
||||
default PageResult<T> selectPage(PageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) {
|
||||
// MyBatis Plus 查询
|
||||
IPage<T> mpPage = MyBatisUtils.buildPage(pageParam);
|
||||
selectPage(mpPage, queryWrapper);
|
||||
// 转换返回
|
||||
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user