diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml deleted file mode 100644 index febca0402..000000000 --- a/ruoyi-admin/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - ruoyi - com.ruoyi - 3.3.0 - - 4.0.0 - jar - ruoyi-admin - - - web服务入口 - - - - - - - org.springframework.boot - spring-boot-devtools - true - - - - - io.springfox - springfox-swagger2 - - - - - io.swagger - swagger-annotations - 1.5.21 - - - - io.swagger - swagger-models - 1.5.21 - - - - - io.springfox - springfox-swagger-ui - - - - - mysql - mysql-connector-java - - - - - com.ruoyi - ruoyi-framework - - - - - com.ruoyi - ruoyi-quartz - - - - - com.ruoyi - ruoyi-generator - - - - - - - - org.springframework.boot - spring-boot-maven-plugin - 2.1.1.RELEASE - - true - - - - - repackage - - - - - - org.apache.maven.plugins - maven-war-plugin - 3.1.0 - - false - ${project.artifactId} - - - - ${project.artifactId} - - - \ No newline at end of file diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java index 14f57fdaf..81650592f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysLogininforController.java @@ -19,7 +19,7 @@ import com.ruoyi.system.service.ISysLogininforService; /** * 系统访问记录 - * + * * @author ruoyi */ @RestController @@ -48,20 +48,4 @@ public class SysLogininforController extends BaseController return util.exportExcel(list, "登录日志"); } - @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") - @Log(title = "登录日志", businessType = BusinessType.DELETE) - @DeleteMapping("/{infoIds}") - public AjaxResult remove(@PathVariable Long[] infoIds) - { - return toAjax(logininforService.deleteLogininforByIds(infoIds)); - } - - @PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')") - @Log(title = "登录日志", businessType = BusinessType.CLEAN) - @DeleteMapping("/clean") - public AjaxResult clean() - { - logininforService.cleanLogininfor(); - return AjaxResult.success(); - } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java deleted file mode 100644 index 99f9f7648..000000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/monitor/SysOperlogController.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.ruoyi.web.controller.monitor; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; -import com.ruoyi.common.annotation.Log; -import com.ruoyi.common.core.controller.BaseController; -import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.core.page.TableDataInfo; -import com.ruoyi.common.enums.BusinessType; -import com.ruoyi.common.utils.poi.ExcelUtil; -import com.ruoyi.system.domain.SysOperLog; -import com.ruoyi.system.service.ISysOperLogService; - -/** - * 操作日志记录 - * - * @author ruoyi - */ - -public class SysOperlogController extends BaseController { - - @Autowired - private ISysOperLogService operLogService; - - - -} diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 929a8352f..8bc9dd382 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -42,13 +42,6 @@ spring: basename: i18n/messages profiles: active: druid - # 文件上传 - servlet: - multipart: - # 单个文件大小 - max-file-size: 10MB - # 设置总上传的文件大小 - max-request-size: 20MB # 服务模块 devtools: restart: @@ -77,13 +70,6 @@ spring: # #连接池最大阻塞等待时间(使用负值表示没有限制) max-wait: -1ms -# Swagger配置 -swagger: - # 是否开启swagger - enabled: true - # 请求前缀 - pathMapping: /dev-api - # 防止XSS攻击 xss: # 过滤开关 diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java deleted file mode 100644 index ed35aad56..000000000 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/SysLogininfor.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.ruoyi.system.domain; - -import java.util.Date; -import com.fasterxml.jackson.annotation.JsonFormat; -import com.ruoyi.common.annotation.Excel; -import com.ruoyi.common.annotation.Excel.ColumnType; -import com.ruoyi.common.core.domain.BaseEntity; - -/** - * 系统访问记录表 sys_logininfor - * - * @author ruoyi - */ -public class SysLogininfor extends BaseEntity -{ - private static final long serialVersionUID = 1L; - - /** ID */ - @Excel(name = "序号", cellType = ColumnType.NUMERIC) - private Long infoId; - - /** 用户账号 */ - @Excel(name = "用户账号") - private String userName; - - /** 登录状态 0成功 1失败 */ - @Excel(name = "登录状态", readConverterExp = "0=成功,1=失败") - private String status; - - /** 登录IP地址 */ - @Excel(name = "登录地址") - private String ipaddr; - - /** 登录地点 */ - @Excel(name = "登录地点") - private String loginLocation; - - /** 浏览器类型 */ - @Excel(name = "浏览器") - private String browser; - - /** 操作系统 */ - @Excel(name = "操作系统") - private String os; - - /** 提示消息 */ - @Excel(name = "提示消息") - private String msg; - - /** 访问时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") - private Date loginTime; - -} diff --git a/src/main/java/cn/iocoder/dashboard/framework/logger/operatelog/core/aop/OperateLogAspect.java b/src/main/java/cn/iocoder/dashboard/framework/logger/operatelog/core/aop/OperateLogAspect.java index 3c3b72ea2..54308a767 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/logger/operatelog/core/aop/OperateLogAspect.java +++ b/src/main/java/cn/iocoder/dashboard/framework/logger/operatelog/core/aop/OperateLogAspect.java @@ -10,7 +10,7 @@ import cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEn 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.controller.logger.vo.operatelog.SysOperateLogCreateReqVO; import cn.iocoder.dashboard.util.servlet.ServletUtils; import com.alibaba.fastjson.JSON; import com.google.common.collect.Maps; diff --git a/src/main/java/cn/iocoder/dashboard/framework/logger/operatelog/core/service/OperateLogFrameworkService.java b/src/main/java/cn/iocoder/dashboard/framework/logger/operatelog/core/service/OperateLogFrameworkService.java index 9077cc152..c02e4038a 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/logger/operatelog/core/service/OperateLogFrameworkService.java +++ b/src/main/java/cn/iocoder/dashboard/framework/logger/operatelog/core/service/OperateLogFrameworkService.java @@ -1,6 +1,6 @@ package cn.iocoder.dashboard.framework.logger.operatelog.core.service; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogCreateReqVO; public interface OperateLogFrameworkService { diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java index b71519f98..4e595ff64 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysOperateLogController.java @@ -6,10 +6,10 @@ import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog; import cn.iocoder.dashboard.framework.logger.operatelog.core.enums.OperateTypeEnum; import cn.iocoder.dashboard.framework.logger.operatelog.core.util.OperateLogUtils; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogExcelVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogExportReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogPageReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogRespVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogRespVO; import cn.iocoder.dashboard.modules.system.convert.logger.SysOperateLogConvert; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysOperateLogDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogBaseVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogBaseVO.java new file mode 100644 index 000000000..66ae5b6c5 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogBaseVO.java @@ -0,0 +1,47 @@ +package cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; + +/** + * 登陆日志 Base VO,提供给添加、修改、详细的子 VO 使用 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 + */ +@Data +public class SysLoginLogBaseVO { + + @ApiModelProperty(value = "链路追踪编号", required = true, example = "89aca178-a370-411c-ae02-3f0d672be4ab") + @NotEmpty(message = "链路追踪编号不能为空") + private String traceId; + + @ApiModelProperty(value = "用户编号", required = true, example = "1024") + @NotNull(message = "用户编号不能为空") + private Long userId; + + @ApiModelProperty(value = "用户账号", required = true, example = "yudao") + @NotBlank(message = "用户账号不能为空") + @Size(max = 30, message = "用户账号长度不能超过30个字符") + private String username; + + + @ApiModelProperty(value = "登陆结果", required = true, example = "1", notes = "参见 SysLoginResultEnum 枚举类") + @NotNull(message = "登陆结果不能为空") + private Integer result; + + @ApiModelProperty(value = "操作明细", example = "修改编号为 1 的用户信息,将性别从男改成女,将姓名从芋道改成源码。") + private String content; + + @ApiModelProperty(value = "用户 IP", required = true, example = "127.0.0.1") + @NotEmpty(message = "用户 IP 不能为空") + private String userIp; + + @ApiModelProperty(value = "浏览器 UserAgent", required = true, example = "Mozilla/5.0") + @NotEmpty(message = "浏览器 UserAgent 不能为空") + private String userAgent; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogCreateReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogCreateReqVO.java new file mode 100644 index 000000000..bc3ed6655 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogCreateReqVO.java @@ -0,0 +1,15 @@ +package cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog; + +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogCreateReqVO; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@ApiModel(value = "登陆日志创建 Request VO", + description = "暂时提供给前端,仅仅后端记录登陆日志时,进行使用") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SysLoginLogCreateReqVO extends SysOperateLogCreateReqVO { +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExcelVO.java new file mode 100644 index 000000000..c88b57632 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogExcelVO.java @@ -0,0 +1,39 @@ +package cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog; + +import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; +import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; +import cn.iocoder.dashboard.modules.system.enums.dict.DictTypeEnum; +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.util.Date; + +/** + * 登陆日志 Excel 导出响应 VO + */ +@Data +public class SysLoginLogExcelVO { + + @ExcelProperty("日志主键") + private Long id; + + @ExcelProperty("用户编号") + private Long userId; + + @ExcelProperty("用户账号") + private String username; + + @ExcelProperty(value = "登陆结果", converter = DictConvert.class) + @DictFormat(DictTypeEnum.SYS_LOGIN_RESULT) + private Integer result; + + @ExcelProperty("登陆 IP") + private String userIp; + + @ExcelProperty("浏览器 UA") + private String userAgent; + + @ExcelProperty("登陆时间") + private Date createTime; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogRespVO.java new file mode 100644 index 000000000..e3e3f9de1 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/loginlog/SysLoginLogRespVO.java @@ -0,0 +1,23 @@ +package cn.iocoder.dashboard.modules.system.controller.logger.vo.loginlog; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.Date; + +@ApiModel("操作日志 Response VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SysLoginLogRespVO extends SysLoginLogBaseVO { + + @ApiModelProperty(value = "日志编号", required = true, example = "1024") + private Long id; + + @ApiModelProperty(value = "登陆时间", required = true) + private Date createTime; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogBaseVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogBaseVO.java similarity index 99% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogBaseVO.java rename to src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogBaseVO.java index 35bc57f28..bcdce0fb2 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogBaseVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo; +package cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogCreateReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogCreateReqVO.java similarity index 97% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogCreateReqVO.java rename to src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogCreateReqVO.java index bf2e79419..5cb849093 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogCreateReqVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogCreateReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo; +package cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog; import io.swagger.annotations.ApiModel; import lombok.Data; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExcelVO.java similarity index 98% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogExcelVO.java rename to src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExcelVO.java index 814607837..46c4722cf 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo; +package cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogExportReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExportReqVO.java similarity index 98% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogExportReqVO.java rename to src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExportReqVO.java index 53f3dae9e..c1f23b2e4 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogExportReqVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo; +package cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogPageReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogPageReqVO.java similarity index 99% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogPageReqVO.java rename to src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogPageReqVO.java index 7602063f9..d4b36a350 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogPageReqVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo; +package cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog; import cn.iocoder.dashboard.common.pojo.PageParam; import io.swagger.annotations.ApiModel; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogRespVO.java similarity index 97% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogRespVO.java rename to src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogRespVO.java index 34b78b6cc..2ebdfeff0 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/SysOperateLogRespVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/operatelog/SysOperateLogRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo; +package cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/package-info.java deleted file mode 100644 index 80d384946..000000000 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysOperateLogConvert.java b/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysOperateLogConvert.java index 53dd381ca..da939093f 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysOperateLogConvert.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysOperateLogConvert.java @@ -1,9 +1,9 @@ package cn.iocoder.dashboard.modules.system.convert.logger; import cn.iocoder.dashboard.common.pojo.PageResult; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogCreateReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogExcelVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogRespVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExcelVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogRespVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysOperateLogDO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; import cn.iocoder.dashboard.util.collection.MapUtils; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/logger/SysOperateLogMapper.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/logger/SysOperateLogMapper.java index d52524483..827ccb165 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/logger/SysOperateLogMapper.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dao/logger/SysOperateLogMapper.java @@ -4,8 +4,8 @@ import cn.iocoder.dashboard.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogExportReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogPageReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysOperateLogDO; import org.apache.ibatis.annotations.Mapper; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/logger/SysLoginLogDO.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/logger/SysLoginLogDO.java new file mode 100644 index 000000000..da8e5ca00 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/dataobject/logger/SysLoginLogDO.java @@ -0,0 +1,53 @@ +package cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger; + +import cn.iocoder.dashboard.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.user.SysUserDO; +import cn.iocoder.dashboard.modules.system.enums.logger.SysLoginResultEnum; +import com.baomidou.mybatisplus.annotation.TableName; + +/** + * 系统访问记录表 + * + * @author ruoyi + */ +@TableName("用户登陆日志") +public class SysLoginLogDO extends BaseDO { + + /** + * 日志主键 + */ + private Long id; + /** + * 链路追踪编号 + */ + private String traceId; + /** + * 用户编号 + * + * 外键 {@link SysUserDO#getId()} + */ + private Long userId; + /** + * 用户账号 + * + * 冗余,因为账号可以变更 + */ + private String username; + /** + * 登陆结果 + * + * 枚举 {@link SysLoginResultEnum} + */ + private Integer result; + + /** + * 用户 IP + */ + private String userIp; + + /** + * 浏览器 UA + */ + private String userAgent; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/DictTypeEnum.java b/src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/DictTypeEnum.java index 4b8b96738..44c62ede0 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/DictTypeEnum.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/enums/dict/DictTypeEnum.java @@ -13,6 +13,7 @@ public enum DictTypeEnum { SYS_USER_SEX("sys_user_sex"), // 用户性别 SYS_COMMON_STATUS("sys_common_status"), // 系统状态 SYS_OPERATE_TYPE("sys_operate_type"), // 操作类型 + SYS_LOGIN_RESULT("sys_login_result"), // 登陆结果 ; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/enums/logger/SysLoginResultEnum.java b/src/main/java/cn/iocoder/dashboard/modules/system/enums/logger/SysLoginResultEnum.java new file mode 100644 index 000000000..cb66f6177 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/system/enums/logger/SysLoginResultEnum.java @@ -0,0 +1,21 @@ +package cn.iocoder.dashboard.modules.system.enums.logger; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 登陆结果的枚举类 + */ +@Getter +@AllArgsConstructor +public enum SysLoginResultEnum { + + SUCCESS(0), // 成功 + ; + + /** + * 结果 + */ + private final Integer result; + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysOperateLogService.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysOperateLogService.java index ed66ad4c6..6bbe29f22 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysOperateLogService.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysOperateLogService.java @@ -2,8 +2,8 @@ package cn.iocoder.dashboard.modules.system.service.logger; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.framework.logger.operatelog.core.service.OperateLogFrameworkService; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogExportReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogPageReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysOperateLogDO; import java.util.List; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysOperateLogServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysOperateLogServiceImpl.java index 0193d5dc0..d1193153c 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysOperateLogServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysOperateLogServiceImpl.java @@ -3,9 +3,9 @@ package cn.iocoder.dashboard.modules.system.service.logger.impl; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import cn.iocoder.dashboard.common.pojo.PageResult; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogCreateReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogExportReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.SysOperateLogPageReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogCreateReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogExportReqVO; +import cn.iocoder.dashboard.modules.system.controller.logger.vo.operatelog.SysOperateLogPageReqVO; import cn.iocoder.dashboard.modules.system.convert.logger.SysOperateLogConvert; import cn.iocoder.dashboard.modules.system.dal.mysql.dao.logger.SysOperateLogMapper; import cn.iocoder.dashboard.modules.system.dal.mysql.dataobject.logger.SysOperateLogDO;