diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/config/ThreadPoolConfig.java b/ruoyi-common/src/main/java/com/ruoyi/common/config/ThreadPoolConfig.java deleted file mode 100644 index dac6f6e8b..000000000 --- a/ruoyi-common/src/main/java/com/ruoyi/common/config/ThreadPoolConfig.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.ruoyi.framework.config; - -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.ScheduledThreadPoolExecutor; -import java.util.concurrent.ThreadPoolExecutor; - -import org.apache.commons.lang3.concurrent.BasicThreadFactory; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; -import com.ruoyi.common.utils.Threads; - -/** - * 线程池配置 - * - * @author ruoyi - **/ -@Configuration -public class ThreadPoolConfig { - // 核心线程池大小 - private int corePoolSize = 50; - - // 最大可创建的线程数 - private int maxPoolSize = 200; - - // 队列最大长度 - private int queueCapacity = 1000; - - // 线程池维护线程所允许的空闲时间 - private int keepAliveSeconds = 300; - - @Bean(name = "threadPoolTaskExecutor") - public ThreadPoolTaskExecutor threadPoolTaskExecutor() { - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); - executor.setMaxPoolSize(maxPoolSize); - executor.setCorePoolSize(corePoolSize); - executor.setQueueCapacity(queueCapacity); - executor.setKeepAliveSeconds(keepAliveSeconds); - // 线程池对拒绝任务(无线程可用)的处理策略 - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); - return executor; - } - - /** - * 执行周期性或定时任务 - */ - @Bean(name = "scheduledExecutorService") - protected ScheduledExecutorService scheduledExecutorService() { - return new ScheduledThreadPoolExecutor(corePoolSize, - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) { - @Override - protected void afterExecute(Runnable r, Throwable t) { - super.afterExecute(r, t); - Threads.printException(r, t); - } - }; - } -} diff --git a/ruoyi-common/src/main/resources/application.yml b/ruoyi-common/src/main/resources/application.yml deleted file mode 100644 index 24c97bc13..000000000 --- a/ruoyi-common/src/main/resources/application.yml +++ /dev/null @@ -1,35 +0,0 @@ -# 项目相关配置 -ruoyi: - # 名称 - name: RuoYi - # 版本 - version: 3.3.0 - # 版权年份 - copyrightYear: 2020 - # 实例演示开关 - demoEnabled: true - # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) - profile: D:/ruoyi/uploadPath - # 获取ip地址开关 - addressEnabled: false - -# 开发环境配置 -server: - # 服务器的HTTP端口,默认为8080 - port: 8080 - servlet: - # 应用的访问路径 - context-path: / - tomcat: - # tomcat的URI编码 - uri-encoding: UTF-8 - # tomcat最大线程数,默认为200 - max-threads: 800 - # Tomcat启动初始化的线程数,默认值25 - min-spare-threads: 30 - -# 日志配置 -logging: - level: - com.ruoyi: debug - org.springframework: warn diff --git a/ruoyi-ui/src/api/infra/apiAccessLog.js b/ruoyi-ui/src/api/infra/apiAccessLog.js new file mode 100644 index 000000000..5d1249a1e --- /dev/null +++ b/ruoyi-ui/src/api/infra/apiAccessLog.js @@ -0,0 +1,55 @@ +import request from '@/utils/request' + +// 创建API 访问日志 +export function createApiAccessLog(data) { + return request({ + url: '/infra/api-access-log/create', + method: 'post', + data: data + }) +} + +// 更新API 访问日志 +export function updateApiAccessLog(data) { + return request({ + url: '/infra/api-access-log/update', + method: 'put', + data: data + }) +} + + +// 删除API 访问日志 +export function deleteApiAccessLog(id) { + return request({ + url: '/infra/api-access-log/delete?id=' + id, + method: 'delete' + }) +} + +// 获得API 访问日志 +export function getApiAccessLog(id) { + return request({ + url: '/infra/api-access-log/get?id=' + id, + method: 'get' + }) +} + +// 获得API 访问日志分页 +export function getApiAccessLogPage(query) { + return request({ + url: '/infra/api-access-log/page', + method: 'get', + params: query + }) +} + +// 导出API 访问日志 Excel +export function exportApiAccessLogExcel(query) { + return request({ + url: '/infra/api-access-log/export-excel', + method: 'get', + params: query, + responseType: 'blob' + }) +} diff --git a/ruoyi-ui/src/utils/dict.js b/ruoyi-ui/src/utils/dict.js index 30bb2a099..f402fd598 100644 --- a/ruoyi-ui/src/utils/dict.js +++ b/ruoyi-ui/src/utils/dict.js @@ -6,6 +6,8 @@ import store from '@/store' export const DICT_TYPE = { + USER_TYPE: 'user_type', + SYS_COMMON_STATUS: 'sys_common_status', SYS_MENU_TYPE: 'sys_menu_type', SYS_ROLE_TYPE: 'sys_role_type', diff --git a/ruoyi-ui/src/views/infra/apiAccessLog/index.vue b/ruoyi-ui/src/views/infra/apiAccessLog/index.vue new file mode 100644 index 000000000..ee7819f3c --- /dev/null +++ b/ruoyi-ui/src/views/infra/apiAccessLog/index.vue @@ -0,0 +1,204 @@ + + + diff --git a/src/main/java/cn/iocoder/dashboard/framework/monitor/AdminServerConfiguration.java b/src/main/java/cn/iocoder/dashboard/framework/monitor/config/AdminServerConfiguration.java similarity index 78% rename from src/main/java/cn/iocoder/dashboard/framework/monitor/AdminServerConfiguration.java rename to src/main/java/cn/iocoder/dashboard/framework/monitor/config/AdminServerConfiguration.java index 30e5e23c4..77c166c8f 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/monitor/AdminServerConfiguration.java +++ b/src/main/java/cn/iocoder/dashboard/framework/monitor/config/AdminServerConfiguration.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.framework.monitor; +package cn.iocoder.dashboard.framework.monitor.config; import de.codecentric.boot.admin.server.config.EnableAdminServer; import org.springframework.context.annotation.Configuration; diff --git a/src/main/java/cn/iocoder/dashboard/framework/mybatis/package-info.java b/src/main/java/cn/iocoder/dashboard/framework/mybatis/package-info.java index 30fb75d67..d6dfba781 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/mybatis/package-info.java +++ b/src/main/java/cn/iocoder/dashboard/framework/mybatis/package-info.java @@ -1 +1,4 @@ +/** + * 使用 MyBatis Plus 提升使用 MyBatis 的开发效率 + */ package cn.iocoder.dashboard.framework.mybatis; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysApiAccessLogController.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/InfApiAccessLogController.java similarity index 52% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysApiAccessLogController.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/InfApiAccessLogController.java index 546362960..b3f0f78bc 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysApiAccessLogController.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/InfApiAccessLogController.java @@ -1,16 +1,16 @@ -package cn.iocoder.dashboard.modules.system.controller.logger; +package cn.iocoder.dashboard.modules.infra.controller.logger; import cn.iocoder.dashboard.common.pojo.CommonResult; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExcelVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExportReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogPageReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogRespVO; -import cn.iocoder.dashboard.modules.system.convert.logger.SysApiAccessLogConvert; -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; -import cn.iocoder.dashboard.modules.system.service.logger.SysApiAccessLogService; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogRespVO; +import cn.iocoder.dashboard.modules.infra.convert.logger.InfApiAccessLogConvert; +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; +import cn.iocoder.dashboard.modules.infra.service.logger.InfApiAccessLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -32,40 +32,40 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat @Api(tags = "API 访问日志") @RestController -@RequestMapping("/system/api-access-log") +@RequestMapping("/infra/api-access-log") @Validated -public class SysApiAccessLogController { +public class InfApiAccessLogController { @Resource - private SysApiAccessLogService apiAccessLogService; + private InfApiAccessLogService apiAccessLogService; @GetMapping("/get") @ApiOperation("获得API 访问日志") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) - @PreAuthorize("@ss.hasPermission('system:api-access-log:query')") - public CommonResult getApiAccessLog(@RequestParam("id") Long id) { - SysApiAccessLogDO apiAccessLog = apiAccessLogService.getApiAccessLog(id); - return success(SysApiAccessLogConvert.INSTANCE.convert(apiAccessLog)); + @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") + public CommonResult getApiAccessLog(@RequestParam("id") Long id) { + InfApiAccessLogDO apiAccessLog = apiAccessLogService.getApiAccessLog(id); + return success(InfApiAccessLogConvert.INSTANCE.convert(apiAccessLog)); } @GetMapping("/page") @ApiOperation("获得API 访问日志分页") - @PreAuthorize("@ss.hasPermission('system:api-access-log:query')") - public CommonResult> getApiAccessLogPage(@Valid SysApiAccessLogPageReqVO pageVO) { - PageResult pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); - return success(SysApiAccessLogConvert.INSTANCE.convertPage(pageResult)); + @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") + public CommonResult> getApiAccessLogPage(@Valid InfApiAccessLogPageReqVO pageVO) { + PageResult pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); + return success(InfApiAccessLogConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @ApiOperation("导出API 访问日志 Excel") - @PreAuthorize("@ss.hasPermission('system:api-access-log:export')") + @PreAuthorize("@ss.hasPermission('infra:api-access-log:export')") @OperateLog(type = EXPORT) - public void exportApiAccessLogExcel(@Valid SysApiAccessLogExportReqVO exportReqVO, + public void exportApiAccessLogExcel(@Valid InfApiAccessLogExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = apiAccessLogService.getApiAccessLogList(exportReqVO); + List list = apiAccessLogService.getApiAccessLogList(exportReqVO); // 导出 Excel - List datas = SysApiAccessLogConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "API 访问日志.xls", "数据", SysApiAccessLogExcelVO.class, datas); + List datas = InfApiAccessLogConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "API 访问日志.xls", "数据", InfApiAccessLogExcelVO.class, datas); } } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogBaseVO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogBaseVO.java similarity index 96% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogBaseVO.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogBaseVO.java index bf8169834..ecfa69d3f 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogBaseVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogBaseVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -14,7 +14,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class SysApiAccessLogBaseVO { +public class InfApiAccessLogBaseVO { @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") @NotNull(message = "链路追踪编号不能为空") diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogExcelVO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java similarity index 92% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogExcelVO.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java index 056a26d2e..96fe3571b 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogExcelVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; @@ -15,7 +15,7 @@ import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.USE * @author 芋道源码 */ @Data -public class SysApiAccessLogExcelVO { +public class InfApiAccessLogExcelVO { @ExcelProperty("日志主键") private Long id; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogExportReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExportReqVO.java similarity index 87% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogExportReqVO.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExportReqVO.java index 048b697f6..7821cfc89 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogExportReqVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExportReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -9,9 +9,9 @@ import java.util.Date; import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "API 访问日志 Excel 导出 Request VO", description = "参数和 SysApiAccessLogPageReqVO 是一致的") +@ApiModel(value = "API 访问日志 Excel 导出 Request VO", description = "参数和 InfApiAccessLogPageReqVO 是一致的") @Data -public class SysApiAccessLogExportReqVO { +public class InfApiAccessLogExportReqVO { @ApiModelProperty(value = "用户编号", example = "666") private Long userId; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogPageReqVO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogPageReqVO.java similarity index 91% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogPageReqVO.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogPageReqVO.java index 48323e109..df0b12b9f 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogPageReqVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogPageReqVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; import cn.iocoder.dashboard.common.pojo.PageParam; import io.swagger.annotations.ApiModel; @@ -16,7 +16,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SysApiAccessLogPageReqVO extends PageParam { +public class InfApiAccessLogPageReqVO extends PageParam { @ApiModelProperty(value = "用户编号", example = "666") private Long userId; diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogRespVO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogRespVO.java similarity index 77% rename from src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogRespVO.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogRespVO.java index 7f0c2d0b6..d3300c8c6 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogRespVO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -12,7 +12,7 @@ import java.util.Date; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class SysApiAccessLogRespVO extends SysApiAccessLogBaseVO { +public class InfApiAccessLogRespVO extends InfApiAccessLogBaseVO { @ApiModelProperty(value = "日志主键", required = true, example = "1024") private Long id; diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/convert/logger/InfApiAccessLogConvert.java b/src/main/java/cn/iocoder/dashboard/modules/infra/convert/logger/InfApiAccessLogConvert.java new file mode 100644 index 000000000..be013240f --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/convert/logger/InfApiAccessLogConvert.java @@ -0,0 +1,33 @@ +package cn.iocoder.dashboard.modules.infra.convert.logger; + +import cn.iocoder.dashboard.common.pojo.PageResult; +import cn.iocoder.dashboard.framework.logger.apilog.core.service.dto.ApiAccessLogCreateDTO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogRespVO; +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * API 访问日志 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface InfApiAccessLogConvert { + + InfApiAccessLogConvert INSTANCE = Mappers.getMapper(InfApiAccessLogConvert.class); + + InfApiAccessLogDO convert(ApiAccessLogCreateDTO bean); + + InfApiAccessLogRespVO convert(InfApiAccessLogDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/convert/package-info.java b/src/main/java/cn/iocoder/dashboard/modules/infra/convert/package-info.java new file mode 100644 index 000000000..6be625219 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/convert/package-info.java @@ -0,0 +1,6 @@ +/** + * 提供 POJO 类的实体转换 + * + * 目前使用 MapStruct 框架 + */ +package cn.iocoder.dashboard.modules.infra.convert; diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md b/src/main/java/cn/iocoder/dashboard/modules/infra/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md new file mode 100644 index 000000000..8153487b7 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md @@ -0,0 +1 @@ + diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/logger/SysApiAccessLogDO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiAccessLogDO.java similarity index 93% rename from src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/logger/SysApiAccessLogDO.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiAccessLogDO.java index 266592fdc..ae8a26371 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/logger/SysApiAccessLogDO.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiAccessLogDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.dashboard.modules.system.dal.dataobject.logger; +package cn.iocoder.dashboard.modules.infra.dal.dataobject.logger; import cn.iocoder.dashboard.common.enums.UserTypeEnum; import cn.iocoder.dashboard.common.pojo.CommonResult; @@ -14,14 +14,14 @@ import java.util.Date; * * @author 芋道源码 */ -@TableName("sys_api_access_log") +@TableName("inf_api_access_log") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class SysApiAccessLogDO extends BaseDO { +public class InfApiAccessLogDO extends BaseDO { /** * 编号 diff --git a/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiErrorLogDO.java b/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiErrorLogDO.java new file mode 100644 index 000000000..1cc630bf0 --- /dev/null +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiErrorLogDO.java @@ -0,0 +1,4 @@ +package cn.iocoder.dashboard.modules.infra.dal.dataobject.logger; + +public class InfApiErrorLogDO { +} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/logger/SysApiAccessLogMapper.java b/src/main/java/cn/iocoder/dashboard/modules/infra/dal/mysql/logger/InfApiAccessLogMapper.java similarity index 65% rename from src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/logger/SysApiAccessLogMapper.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/dal/mysql/logger/InfApiAccessLogMapper.java index c9644a335..740bfeb7b 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/logger/SysApiAccessLogMapper.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/dal/mysql/logger/InfApiAccessLogMapper.java @@ -1,11 +1,11 @@ -package cn.iocoder.dashboard.modules.system.dal.mysql.logger; +package cn.iocoder.dashboard.modules.infra.dal.mysql.logger; 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.apiaccesslog.SysApiAccessLogExportReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogPageReqVO; -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -16,10 +16,10 @@ import java.util.List; * @author 芋道源码 */ @Mapper -public interface SysApiAccessLogMapper extends BaseMapperX { +public interface InfApiAccessLogMapper extends BaseMapperX { - default PageResult selectPage(SysApiAccessLogPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() + default PageResult selectPage(InfApiAccessLogPageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() .eqIfPresent("user_id", reqVO.getUserId()) .eqIfPresent("user_type", reqVO.getUserType()) .eqIfPresent("application_name", reqVO.getApplicationName()) @@ -27,11 +27,12 @@ public interface SysApiAccessLogMapper extends BaseMapperX { .betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime()) .geIfPresent("duration", reqVO.getDuration()) .eqIfPresent("result_code", reqVO.getResultCode()) + .orderByDesc("id") ); } - default List selectList(SysApiAccessLogExportReqVO reqVO) { - return selectList(new QueryWrapperX() + default List selectList(InfApiAccessLogExportReqVO reqVO) { + return selectList(new QueryWrapperX() .eqIfPresent("user_id", reqVO.getUserId()) .eqIfPresent("user_type", reqVO.getUserType()) .eqIfPresent("application_name", reqVO.getApplicationName()) @@ -39,6 +40,7 @@ public interface SysApiAccessLogMapper extends BaseMapperX { .betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime()) .geIfPresent("duration", reqVO.getDuration()) .eqIfPresent("result_code", reqVO.getResultCode()) + .orderByDesc("id") ); } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysApiAccessLogService.java b/src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/InfApiAccessLogService.java similarity index 54% rename from src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysApiAccessLogService.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/InfApiAccessLogService.java index db4ff2648..ba9aafbee 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysApiAccessLogService.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/InfApiAccessLogService.java @@ -1,10 +1,10 @@ -package cn.iocoder.dashboard.modules.system.service.logger; +package cn.iocoder.dashboard.modules.infra.service.logger; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.framework.logger.apilog.core.service.ApiAccessLogFrameworkService; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExportReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogPageReqVO; -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; import java.util.List; @@ -13,7 +13,7 @@ import java.util.List; * * @author 芋道源码 */ -public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { +public interface InfApiAccessLogService extends ApiAccessLogFrameworkService { /** * 获得 API 访问日志 @@ -21,7 +21,7 @@ public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { * @param id 编号 * @return API 访问日志 */ - SysApiAccessLogDO getApiAccessLog(Long id); + InfApiAccessLogDO getApiAccessLog(Long id); /** * 获得 API 访问日志分页 @@ -29,7 +29,7 @@ public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { * @param pageReqVO 分页查询 * @return API 访问日志分页 */ - PageResult getApiAccessLogPage(SysApiAccessLogPageReqVO pageReqVO); + PageResult getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO); /** * 获得 API 访问日志列表, 用于 Excel 导出 @@ -37,6 +37,6 @@ public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { * @param exportReqVO 查询条件 * @return API 访问日志分页 */ - List getApiAccessLogList(SysApiAccessLogExportReqVO exportReqVO); + List getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO); } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysApiAccessLogServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/impl/InfApiAccessLogServiceImpl.java similarity index 51% rename from src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysApiAccessLogServiceImpl.java rename to src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/impl/InfApiAccessLogServiceImpl.java index eebf76bad..9698eb536 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysApiAccessLogServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/impl/InfApiAccessLogServiceImpl.java @@ -1,13 +1,13 @@ -package cn.iocoder.dashboard.modules.system.service.logger.impl; +package cn.iocoder.dashboard.modules.infra.service.logger.impl; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.framework.logger.apilog.core.service.dto.ApiAccessLogCreateDTO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExportReqVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogPageReqVO; -import cn.iocoder.dashboard.modules.system.convert.logger.SysApiAccessLogConvert; -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; -import cn.iocoder.dashboard.modules.system.dal.mysql.logger.SysApiAccessLogMapper; -import cn.iocoder.dashboard.modules.system.service.logger.SysApiAccessLogService; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; +import cn.iocoder.dashboard.modules.infra.convert.logger.InfApiAccessLogConvert; +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; +import cn.iocoder.dashboard.modules.infra.dal.mysql.logger.InfApiAccessLogMapper; +import cn.iocoder.dashboard.modules.infra.service.logger.InfApiAccessLogService; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -23,31 +23,31 @@ import java.util.List; */ @Service @Validated -public class SysApiAccessLogServiceImpl implements SysApiAccessLogService { +public class InfApiAccessLogServiceImpl implements InfApiAccessLogService { @Resource - private SysApiAccessLogMapper apiAccessLogMapper; + private InfApiAccessLogMapper apiAccessLogMapper; @Override @Async public void createApiAccessLogAsync(@Valid ApiAccessLogCreateDTO createDTO) { // 插入 - SysApiAccessLogDO apiAccessLog = SysApiAccessLogConvert.INSTANCE.convert(createDTO); + InfApiAccessLogDO apiAccessLog = InfApiAccessLogConvert.INSTANCE.convert(createDTO); apiAccessLogMapper.insert(apiAccessLog); } @Override - public SysApiAccessLogDO getApiAccessLog(Long id) { + public InfApiAccessLogDO getApiAccessLog(Long id) { return apiAccessLogMapper.selectById(id); } @Override - public PageResult getApiAccessLogPage(SysApiAccessLogPageReqVO pageReqVO) { + public PageResult getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO) { return apiAccessLogMapper.selectPage(pageReqVO); } @Override - public List getApiAccessLogList(SysApiAccessLogExportReqVO exportReqVO) { + public List getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO) { return apiAccessLogMapper.selectList(exportReqVO); } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysApiAccessLogConvert.java b/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysApiAccessLogConvert.java deleted file mode 100644 index 2b97cfb57..000000000 --- a/src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysApiAccessLogConvert.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.iocoder.dashboard.modules.system.convert.logger; - -import cn.iocoder.dashboard.common.pojo.PageResult; -import cn.iocoder.dashboard.framework.logger.apilog.core.service.dto.ApiAccessLogCreateDTO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExcelVO; -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogRespVO; -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * API 访问日志 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface SysApiAccessLogConvert { - - SysApiAccessLogConvert INSTANCE = Mappers.getMapper(SysApiAccessLogConvert.class); - - SysApiAccessLogDO convert(ApiAccessLogCreateDTO bean); - - SysApiAccessLogRespVO convert(SysApiAccessLogDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md b/src/main/java/cn/iocoder/dashboard/modules/system/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md index af9fdefc5..8153487b7 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md +++ b/src/main/java/cn/iocoder/dashboard/modules/system/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md @@ -1 +1 @@ - + diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/logger/SysApiErrorLogDO.java b/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/logger/SysApiErrorLogDO.java deleted file mode 100644 index af1391677..000000000 --- a/src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/logger/SysApiErrorLogDO.java +++ /dev/null @@ -1,4 +0,0 @@ -package cn.iocoder.dashboard.modules.system.dal.dataobject.logger; - -public class SysApiErrorLogDO { -} diff --git a/src/main/resources/codegen/java/dal/mapper.vm b/src/main/resources/codegen/java/dal/mapper.vm index 8d3a81ddd..1b40308c3 100644 --- a/src/main/resources/codegen/java/dal/mapper.vm +++ b/src/main/resources/codegen/java/dal/mapper.vm @@ -52,12 +52,13 @@ public interface ${table.className}Mapper extends BaseMapperX<${table.className} default PageResult<${table.className}DO> selectPage(${table.className}PageReqVO reqVO) { return selectPage(reqVO, new QueryWrapperX<${table.className}DO>() #listCondition() + .orderByDesc("id")# 大多数情况下,id 倒序 ); } default List<${table.className}DO> selectList(${table.className}ExportReqVO reqVO) { return selectList(new QueryWrapperX<${table.className}DO>() - #listCondition() + #listCondition()# 大多数情况下,id 倒序 ); }