Commit c6734c4bbcdd8909985a20bdb376318d462610de
1 parent
0678fb7c
调整 API 访问日志,从 system 归到 infra 更合适
Showing
24 changed files
with
360 additions
and
179 deletions
ruoyi-common/src/main/java/com/ruoyi/common/config/ThreadPoolConfig.java deleted
| 1 | -package com.ruoyi.framework.config; | |
| 2 | - | |
| 3 | -import java.util.concurrent.ScheduledExecutorService; | |
| 4 | -import java.util.concurrent.ScheduledThreadPoolExecutor; | |
| 5 | -import java.util.concurrent.ThreadPoolExecutor; | |
| 6 | - | |
| 7 | -import org.apache.commons.lang3.concurrent.BasicThreadFactory; | |
| 8 | -import org.springframework.context.annotation.Bean; | |
| 9 | -import org.springframework.context.annotation.Configuration; | |
| 10 | -import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | |
| 11 | -import com.ruoyi.common.utils.Threads; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 线程池配置 | |
| 15 | - * | |
| 16 | - * @author ruoyi | |
| 17 | - **/ | |
| 18 | -@Configuration | |
| 19 | -public class ThreadPoolConfig { | |
| 20 | - // 核心线程池大小 | |
| 21 | - private int corePoolSize = 50; | |
| 22 | - | |
| 23 | - // 最大可创建的线程数 | |
| 24 | - private int maxPoolSize = 200; | |
| 25 | - | |
| 26 | - // 队列最大长度 | |
| 27 | - private int queueCapacity = 1000; | |
| 28 | - | |
| 29 | - // 线程池维护线程所允许的空闲时间 | |
| 30 | - private int keepAliveSeconds = 300; | |
| 31 | - | |
| 32 | - @Bean(name = "threadPoolTaskExecutor") | |
| 33 | - public ThreadPoolTaskExecutor threadPoolTaskExecutor() { | |
| 34 | - ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); | |
| 35 | - executor.setMaxPoolSize(maxPoolSize); | |
| 36 | - executor.setCorePoolSize(corePoolSize); | |
| 37 | - executor.setQueueCapacity(queueCapacity); | |
| 38 | - executor.setKeepAliveSeconds(keepAliveSeconds); | |
| 39 | - // 线程池对拒绝任务(无线程可用)的处理策略 | |
| 40 | - executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); | |
| 41 | - return executor; | |
| 42 | - } | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 执行周期性或定时任务 | |
| 46 | - */ | |
| 47 | - @Bean(name = "scheduledExecutorService") | |
| 48 | - protected ScheduledExecutorService scheduledExecutorService() { | |
| 49 | - return new ScheduledThreadPoolExecutor(corePoolSize, | |
| 50 | - new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build()) { | |
| 51 | - @Override | |
| 52 | - protected void afterExecute(Runnable r, Throwable t) { | |
| 53 | - super.afterExecute(r, t); | |
| 54 | - Threads.printException(r, t); | |
| 55 | - } | |
| 56 | - }; | |
| 57 | - } | |
| 58 | -} |
ruoyi-common/src/main/resources/application.yml deleted
| 1 | -# 项目相关配置 | |
| 2 | -ruoyi: | |
| 3 | - # 名称 | |
| 4 | - name: RuoYi | |
| 5 | - # 版本 | |
| 6 | - version: 3.3.0 | |
| 7 | - # 版权年份 | |
| 8 | - copyrightYear: 2020 | |
| 9 | - # 实例演示开关 | |
| 10 | - demoEnabled: true | |
| 11 | - # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath) | |
| 12 | - profile: D:/ruoyi/uploadPath | |
| 13 | - # 获取ip地址开关 | |
| 14 | - addressEnabled: false | |
| 15 | - | |
| 16 | -# 开发环境配置 | |
| 17 | -server: | |
| 18 | - # 服务器的HTTP端口,默认为8080 | |
| 19 | - port: 8080 | |
| 20 | - servlet: | |
| 21 | - # 应用的访问路径 | |
| 22 | - context-path: / | |
| 23 | - tomcat: | |
| 24 | - # tomcat的URI编码 | |
| 25 | - uri-encoding: UTF-8 | |
| 26 | - # tomcat最大线程数,默认为200 | |
| 27 | - max-threads: 800 | |
| 28 | - # Tomcat启动初始化的线程数,默认值25 | |
| 29 | - min-spare-threads: 30 | |
| 30 | - | |
| 31 | -# 日志配置 | |
| 32 | -logging: | |
| 33 | - level: | |
| 34 | - com.ruoyi: debug | |
| 35 | - org.springframework: warn |
ruoyi-ui/src/api/infra/apiAccessLog.js
0 → 100644
| 1 | +import request from '@/utils/request' | |
| 2 | + | |
| 3 | +// 创建API 访问日志 | |
| 4 | +export function createApiAccessLog(data) { | |
| 5 | + return request({ | |
| 6 | + url: '/infra/api-access-log/create', | |
| 7 | + method: 'post', | |
| 8 | + data: data | |
| 9 | + }) | |
| 10 | +} | |
| 11 | + | |
| 12 | +// 更新API 访问日志 | |
| 13 | +export function updateApiAccessLog(data) { | |
| 14 | + return request({ | |
| 15 | + url: '/infra/api-access-log/update', | |
| 16 | + method: 'put', | |
| 17 | + data: data | |
| 18 | + }) | |
| 19 | +} | |
| 20 | + | |
| 21 | + | |
| 22 | +// 删除API 访问日志 | |
| 23 | +export function deleteApiAccessLog(id) { | |
| 24 | + return request({ | |
| 25 | + url: '/infra/api-access-log/delete?id=' + id, | |
| 26 | + method: 'delete' | |
| 27 | + }) | |
| 28 | +} | |
| 29 | + | |
| 30 | +// 获得API 访问日志 | |
| 31 | +export function getApiAccessLog(id) { | |
| 32 | + return request({ | |
| 33 | + url: '/infra/api-access-log/get?id=' + id, | |
| 34 | + method: 'get' | |
| 35 | + }) | |
| 36 | +} | |
| 37 | + | |
| 38 | +// 获得API 访问日志分页 | |
| 39 | +export function getApiAccessLogPage(query) { | |
| 40 | + return request({ | |
| 41 | + url: '/infra/api-access-log/page', | |
| 42 | + method: 'get', | |
| 43 | + params: query | |
| 44 | + }) | |
| 45 | +} | |
| 46 | + | |
| 47 | +// 导出API 访问日志 Excel | |
| 48 | +export function exportApiAccessLogExcel(query) { | |
| 49 | + return request({ | |
| 50 | + url: '/infra/api-access-log/export-excel', | |
| 51 | + method: 'get', | |
| 52 | + params: query, | |
| 53 | + responseType: 'blob' | |
| 54 | + }) | |
| 55 | +} | ... | ... |
ruoyi-ui/src/utils/dict.js
ruoyi-ui/src/views/infra/apiAccessLog/index.vue
0 → 100644
| 1 | +<template> | |
| 2 | + <div class="app-container"> | |
| 3 | + | |
| 4 | + <!-- 搜索工作栏 --> | |
| 5 | + <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px"> | |
| 6 | + <el-form-item label="用户编号" prop="userId"> | |
| 7 | + <el-input v-model="queryParams.userId" placeholder="请输入用户编号" clearable size="small" @keyup.enter.native="handleQuery"/> | |
| 8 | + </el-form-item> | |
| 9 | + <el-form-item label="用户类型" prop="userType"> | |
| 10 | + <el-select v-model="queryParams.userType" placeholder="请选择用户类型" clearable size="small"> | |
| 11 | + <el-option v-for="dict in this.getDictDatas(DICT_TYPE.USER_TYPE)" | |
| 12 | + :key="dict.value" :label="dict.label" :value="dict.value"/> | |
| 13 | + </el-select> | |
| 14 | + </el-form-item> | |
| 15 | + <el-form-item label="应用名" prop="applicationName"> | |
| 16 | + <el-input v-model="queryParams.applicationName" placeholder="请输入应用名" clearable size="small" @keyup.enter.native="handleQuery"/> | |
| 17 | + </el-form-item> | |
| 18 | + <el-form-item label="请求地址" prop="requestUrl"> | |
| 19 | + <el-input v-model="queryParams.requestUrl" placeholder="请输入请求地址" clearable size="small" @keyup.enter.native="handleQuery"/> | |
| 20 | + </el-form-item> | |
| 21 | + <el-form-item label="开始请求时间"> | |
| 22 | + <el-date-picker v-model="dateRangeBeginTime" size="small" style="width: 240px" value-format="yyyy-MM-dd" | |
| 23 | + type="daterange" range-separator="-" start-placeholder="开始日期" end-placeholder="结束日期" /> | |
| 24 | + </el-form-item> | |
| 25 | + <el-form-item label="执行时长" prop="duration"> | |
| 26 | + <el-input v-model="queryParams.duration" placeholder="请输入执行时长" clearable size="small" @keyup.enter.native="handleQuery"/> | |
| 27 | + </el-form-item> | |
| 28 | + <el-form-item label="结果码" prop="resultCode"> | |
| 29 | + <el-input v-model="queryParams.resultCode" placeholder="请输入结果码" clearable size="small" @keyup.enter.native="handleQuery"/> | |
| 30 | + </el-form-item> | |
| 31 | + <el-form-item> | |
| 32 | + <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button> | |
| 33 | + <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> | |
| 34 | + </el-form-item> | |
| 35 | + </el-form> | |
| 36 | + | |
| 37 | + <!-- 操作工具栏 --> | |
| 38 | + <el-row :gutter="10" class="mb8"> | |
| 39 | + <el-col :span="1.5"> | |
| 40 | + <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport" | |
| 41 | + v-hasPermi="['infra:api-access-log:export']">导出</el-button> | |
| 42 | + </el-col> | |
| 43 | + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> | |
| 44 | + </el-row> | |
| 45 | + | |
| 46 | + <!-- 列表 --> | |
| 47 | + <el-table v-loading="loading" :data="list"> | |
| 48 | + <el-table-column label="日志主键" align="center" prop="id" /> | |
| 49 | + <el-table-column label="链路追踪编号" align="center" prop="traceId" /> | |
| 50 | + <el-table-column label="用户编号" align="center" prop="userId" /> | |
| 51 | + <el-table-column label="用户类型" align="center" prop="userType"> | |
| 52 | + <template slot-scope="scope"> | |
| 53 | + <span>{{ getDictDataLabel(DICT_TYPE.USER_TYPE, scope.row.userType) }}</span> | |
| 54 | + </template> | |
| 55 | + </el-table-column>> | |
| 56 | + <el-table-column label="应用名" align="center" prop="applicationName" /> | |
| 57 | + <el-table-column label="请求方法名" align="center" prop="requestMethod" /> | |
| 58 | + <el-table-column label="请求地址" align="center" prop="requestUrl" /> | |
| 59 | + <el-table-column label="Java 方法的参数" align="center" prop="requestParams" /> | |
| 60 | + <el-table-column label="用户 IP" align="center" prop="userIp" /> | |
| 61 | + <el-table-column label="浏览器 UA" align="center" prop="userAgent" /> | |
| 62 | + <el-table-column label="开始请求时间" align="center" prop="beginTime" width="180"> | |
| 63 | + <template slot-scope="scope"> | |
| 64 | + <span>{{ parseTime(scope.row.beginTime, '{y}-{m}-{d}') }}</span> | |
| 65 | + </template> | |
| 66 | + </el-table-column> | |
| 67 | + <el-table-column label="结束请求时间" align="center" prop="endTime" width="180"> | |
| 68 | + <template slot-scope="scope"> | |
| 69 | + <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span> | |
| 70 | + </template> | |
| 71 | + </el-table-column> | |
| 72 | + <el-table-column label="执行时长" align="center" prop="duration" /> | |
| 73 | + <el-table-column label="结果码" align="center" prop="resultCode" /> | |
| 74 | + <el-table-column label="结果提示" align="center" prop="resultMsg" /> | |
| 75 | + <el-table-column label="创建时间" align="center" prop="createTime" width="180"> | |
| 76 | + <template slot-scope="scope"> | |
| 77 | + <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span> | |
| 78 | + </template> | |
| 79 | + </el-table-column> | |
| 80 | + <el-table-column label="操作" align="center" class-name="small-padding fixed-width"> | |
| 81 | + <template slot-scope="scope"> | |
| 82 | + | |
| 83 | + </template> | |
| 84 | + </el-table-column> | |
| 85 | + </el-table> | |
| 86 | + <!-- 分页组件 --> | |
| 87 | + <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNo" :limit.sync="queryParams.pageSize" | |
| 88 | + @pagination="getList"/> | |
| 89 | + | |
| 90 | + </div> | |
| 91 | +</template> | |
| 92 | + | |
| 93 | +<script> | |
| 94 | +import { getApiAccessLog, getApiAccessLogPage, exportApiAccessLogExcel } from "@/api/infra/apiAccessLog"; | |
| 95 | + | |
| 96 | +export default { | |
| 97 | + name: "ApiAccessLog", | |
| 98 | + components: { | |
| 99 | + }, | |
| 100 | + data() { | |
| 101 | + return { | |
| 102 | + // 遮罩层 | |
| 103 | + loading: true, | |
| 104 | + // 显示搜索条件 | |
| 105 | + showSearch: true, | |
| 106 | + // 总条数 | |
| 107 | + total: 0, | |
| 108 | + // API 访问日志列表 | |
| 109 | + list: [], | |
| 110 | + // 弹出层标题 | |
| 111 | + title: "", | |
| 112 | + // 是否显示弹出层 | |
| 113 | + open: false, | |
| 114 | + dateRangeBeginTime: [], | |
| 115 | + // 查询参数 | |
| 116 | + queryParams: { | |
| 117 | + pageNo: 1, | |
| 118 | + pageSize: 10, | |
| 119 | + userId: null, | |
| 120 | + userType: null, | |
| 121 | + applicationName: null, | |
| 122 | + requestUrl: null, | |
| 123 | + duration: null, | |
| 124 | + resultCode: null, | |
| 125 | + }, | |
| 126 | + // 表单参数 | |
| 127 | + form: {}, | |
| 128 | + }; | |
| 129 | + }, | |
| 130 | + created() { | |
| 131 | + this.getList(); | |
| 132 | + }, | |
| 133 | + methods: { | |
| 134 | + /** 查询列表 */ | |
| 135 | + getList() { | |
| 136 | + this.loading = true; | |
| 137 | + // 处理查询参数 | |
| 138 | + let params = {...this.queryParams}; | |
| 139 | + this.addBeginAndEndTime(params, this.dateRangeBeginTime, 'beginTime'); | |
| 140 | + // 执行查询 | |
| 141 | + getApiAccessLogPage(params).then(response => { | |
| 142 | + this.list = response.data.list; | |
| 143 | + this.total = response.data.total; | |
| 144 | + this.loading = false; | |
| 145 | + }); | |
| 146 | + }, | |
| 147 | + /** 取消按钮 */ | |
| 148 | + cancel() { | |
| 149 | + this.open = false; | |
| 150 | + this.reset(); | |
| 151 | + }, | |
| 152 | + /** 表单重置 */ | |
| 153 | + reset() { | |
| 154 | + this.form = { | |
| 155 | + id: undefined, | |
| 156 | + traceId: undefined, | |
| 157 | + userId: undefined, | |
| 158 | + userType: undefined, | |
| 159 | + applicationName: undefined, | |
| 160 | + requestMethod: undefined, | |
| 161 | + requestUrl: undefined, | |
| 162 | + requestParams: undefined, | |
| 163 | + userIp: undefined, | |
| 164 | + userAgent: undefined, | |
| 165 | + beginTime: undefined, | |
| 166 | + endTime: undefined, | |
| 167 | + duration: undefined, | |
| 168 | + resultCode: undefined, | |
| 169 | + resultMsg: undefined, | |
| 170 | + }; | |
| 171 | + this.resetForm("form"); | |
| 172 | + }, | |
| 173 | + /** 搜索按钮操作 */ | |
| 174 | + handleQuery() { | |
| 175 | + this.queryParams.pageNo = 1; | |
| 176 | + this.getList(); | |
| 177 | + }, | |
| 178 | + /** 重置按钮操作 */ | |
| 179 | + resetQuery() { | |
| 180 | + this.dateRangeBeginTime = []; | |
| 181 | + this.resetForm("queryForm"); | |
| 182 | + this.handleQuery(); | |
| 183 | + }, | |
| 184 | + /** 导出按钮操作 */ | |
| 185 | + handleExport() { | |
| 186 | + // 处理查询参数 | |
| 187 | + let params = {...this.queryParams}; | |
| 188 | + params.pageNo = undefined; | |
| 189 | + params.pageSize = undefined; | |
| 190 | + this.addBeginAndEndTime(params, this.dateRangeBeginTime, 'beginTime'); | |
| 191 | + // 执行导出 | |
| 192 | + this.$confirm('是否确认导出所有API 访问日志数据项?', "警告", { | |
| 193 | + confirmButtonText: "确定", | |
| 194 | + cancelButtonText: "取消", | |
| 195 | + type: "warning" | |
| 196 | + }).then(function() { | |
| 197 | + return exportApiAccessLogExcel(params); | |
| 198 | + }).then(response => { | |
| 199 | + this.downloadExcel(response, 'API 访问日志.xls'); | |
| 200 | + }) | |
| 201 | + } | |
| 202 | + } | |
| 203 | +}; | |
| 204 | +</script> | ... | ... |
src/main/java/cn/iocoder/dashboard/framework/monitor/AdminServerConfiguration.java renamed to src/main/java/cn/iocoder/dashboard/framework/monitor/config/AdminServerConfiguration.java
src/main/java/cn/iocoder/dashboard/framework/mybatis/package-info.java
src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/SysApiAccessLogController.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/InfApiAccessLogController.java
| 1 | -package cn.iocoder.dashboard.modules.system.controller.logger; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.controller.logger; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 5 | 5 | import cn.iocoder.dashboard.framework.excel.core.util.ExcelUtils; |
| 6 | 6 | import cn.iocoder.dashboard.framework.logger.operatelog.core.annotations.OperateLog; |
| 7 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExcelVO; | |
| 8 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExportReqVO; | |
| 9 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogPageReqVO; | |
| 10 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogRespVO; | |
| 11 | -import cn.iocoder.dashboard.modules.system.convert.logger.SysApiAccessLogConvert; | |
| 12 | -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; | |
| 13 | -import cn.iocoder.dashboard.modules.system.service.logger.SysApiAccessLogService; | |
| 7 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; | |
| 8 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | |
| 9 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | |
| 10 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogRespVO; | |
| 11 | +import cn.iocoder.dashboard.modules.infra.convert.logger.InfApiAccessLogConvert; | |
| 12 | +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | |
| 13 | +import cn.iocoder.dashboard.modules.infra.service.logger.InfApiAccessLogService; | |
| 14 | 14 | import io.swagger.annotations.Api; |
| 15 | 15 | import io.swagger.annotations.ApiImplicitParam; |
| 16 | 16 | import io.swagger.annotations.ApiOperation; |
| ... | ... | @@ -32,40 +32,40 @@ import static cn.iocoder.dashboard.framework.logger.operatelog.core.enums.Operat |
| 32 | 32 | |
| 33 | 33 | @Api(tags = "API 访问日志") |
| 34 | 34 | @RestController |
| 35 | -@RequestMapping("/system/api-access-log") | |
| 35 | +@RequestMapping("/infra/api-access-log") | |
| 36 | 36 | @Validated |
| 37 | -public class SysApiAccessLogController { | |
| 37 | +public class InfApiAccessLogController { | |
| 38 | 38 | |
| 39 | 39 | @Resource |
| 40 | - private SysApiAccessLogService apiAccessLogService; | |
| 40 | + private InfApiAccessLogService apiAccessLogService; | |
| 41 | 41 | |
| 42 | 42 | @GetMapping("/get") |
| 43 | 43 | @ApiOperation("获得API 访问日志") |
| 44 | 44 | @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) |
| 45 | - @PreAuthorize("@ss.hasPermission('system:api-access-log:query')") | |
| 46 | - public CommonResult<SysApiAccessLogRespVO> getApiAccessLog(@RequestParam("id") Long id) { | |
| 47 | - SysApiAccessLogDO apiAccessLog = apiAccessLogService.getApiAccessLog(id); | |
| 48 | - return success(SysApiAccessLogConvert.INSTANCE.convert(apiAccessLog)); | |
| 45 | + @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") | |
| 46 | + public CommonResult<InfApiAccessLogRespVO> getApiAccessLog(@RequestParam("id") Long id) { | |
| 47 | + InfApiAccessLogDO apiAccessLog = apiAccessLogService.getApiAccessLog(id); | |
| 48 | + return success(InfApiAccessLogConvert.INSTANCE.convert(apiAccessLog)); | |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | @GetMapping("/page") |
| 52 | 52 | @ApiOperation("获得API 访问日志分页") |
| 53 | - @PreAuthorize("@ss.hasPermission('system:api-access-log:query')") | |
| 54 | - public CommonResult<PageResult<SysApiAccessLogRespVO>> getApiAccessLogPage(@Valid SysApiAccessLogPageReqVO pageVO) { | |
| 55 | - PageResult<SysApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); | |
| 56 | - return success(SysApiAccessLogConvert.INSTANCE.convertPage(pageResult)); | |
| 53 | + @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") | |
| 54 | + public CommonResult<PageResult<InfApiAccessLogRespVO>> getApiAccessLogPage(@Valid InfApiAccessLogPageReqVO pageVO) { | |
| 55 | + PageResult<InfApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); | |
| 56 | + return success(InfApiAccessLogConvert.INSTANCE.convertPage(pageResult)); | |
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | @GetMapping("/export-excel") |
| 60 | 60 | @ApiOperation("导出API 访问日志 Excel") |
| 61 | - @PreAuthorize("@ss.hasPermission('system:api-access-log:export')") | |
| 61 | + @PreAuthorize("@ss.hasPermission('infra:api-access-log:export')") | |
| 62 | 62 | @OperateLog(type = EXPORT) |
| 63 | - public void exportApiAccessLogExcel(@Valid SysApiAccessLogExportReqVO exportReqVO, | |
| 63 | + public void exportApiAccessLogExcel(@Valid InfApiAccessLogExportReqVO exportReqVO, | |
| 64 | 64 | HttpServletResponse response) throws IOException { |
| 65 | - List<SysApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); | |
| 65 | + List<InfApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); | |
| 66 | 66 | // 导出 Excel |
| 67 | - List<SysApiAccessLogExcelVO> datas = SysApiAccessLogConvert.INSTANCE.convertList02(list); | |
| 68 | - ExcelUtils.write(response, "API 访问日志.xls", "数据", SysApiAccessLogExcelVO.class, datas); | |
| 67 | + List<InfApiAccessLogExcelVO> datas = InfApiAccessLogConvert.INSTANCE.convertList02(list); | |
| 68 | + ExcelUtils.write(response, "API 访问日志.xls", "数据", InfApiAccessLogExcelVO.class, datas); | |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | } | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogBaseVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogBaseVO.java
| 1 | -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; | |
| 2 | 2 | |
| 3 | 3 | import io.swagger.annotations.ApiModelProperty; |
| 4 | 4 | import lombok.Data; |
| ... | ... | @@ -14,7 +14,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU |
| 14 | 14 | * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
| 15 | 15 | */ |
| 16 | 16 | @Data |
| 17 | -public class SysApiAccessLogBaseVO { | |
| 17 | +public class InfApiAccessLogBaseVO { | |
| 18 | 18 | |
| 19 | 19 | @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") |
| 20 | 20 | @NotNull(message = "链路追踪编号不能为空") | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogExcelVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java
| 1 | -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.framework.excel.core.annotations.DictFormat; |
| 4 | 4 | import cn.iocoder.dashboard.framework.excel.core.convert.DictConvert; |
| ... | ... | @@ -15,7 +15,7 @@ import static cn.iocoder.dashboard.modules.system.enums.dict.SysDictTypeEnum.USE |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| 17 | 17 | @Data |
| 18 | -public class SysApiAccessLogExcelVO { | |
| 18 | +public class InfApiAccessLogExcelVO { | |
| 19 | 19 | |
| 20 | 20 | @ExcelProperty("日志主键") |
| 21 | 21 | private Long id; | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogExportReqVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExportReqVO.java
| 1 | -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; | |
| 2 | 2 | |
| 3 | 3 | import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| ... | ... | @@ -9,9 +9,9 @@ import java.util.Date; |
| 9 | 9 | |
| 10 | 10 | import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 11 | |
| 12 | -@ApiModel(value = "API 访问日志 Excel 导出 Request VO", description = "参数和 SysApiAccessLogPageReqVO 是一致的") | |
| 12 | +@ApiModel(value = "API 访问日志 Excel 导出 Request VO", description = "参数和 InfApiAccessLogPageReqVO 是一致的") | |
| 13 | 13 | @Data |
| 14 | -public class SysApiAccessLogExportReqVO { | |
| 14 | +public class InfApiAccessLogExportReqVO { | |
| 15 | 15 | |
| 16 | 16 | @ApiModelProperty(value = "用户编号", example = "666") |
| 17 | 17 | private Long userId; | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogPageReqVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogPageReqVO.java
| 1 | -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.common.pojo.PageParam; |
| 4 | 4 | import io.swagger.annotations.ApiModel; |
| ... | ... | @@ -16,7 +16,7 @@ import static cn.iocoder.dashboard.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOU |
| 16 | 16 | @Data |
| 17 | 17 | @EqualsAndHashCode(callSuper = true) |
| 18 | 18 | @ToString(callSuper = true) |
| 19 | -public class SysApiAccessLogPageReqVO extends PageParam { | |
| 19 | +public class InfApiAccessLogPageReqVO extends PageParam { | |
| 20 | 20 | |
| 21 | 21 | @ApiModelProperty(value = "用户编号", example = "666") |
| 22 | 22 | private Long userId; | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/controller/logger/vo/apiaccesslog/SysApiAccessLogRespVO.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogRespVO.java
| 1 | -package cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog; | |
| 2 | 2 | |
| 3 | 3 | import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| ... | ... | @@ -12,7 +12,7 @@ import java.util.Date; |
| 12 | 12 | @Data |
| 13 | 13 | @EqualsAndHashCode(callSuper = true) |
| 14 | 14 | @ToString(callSuper = true) |
| 15 | -public class SysApiAccessLogRespVO extends SysApiAccessLogBaseVO { | |
| 15 | +public class InfApiAccessLogRespVO extends InfApiAccessLogBaseVO { | |
| 16 | 16 | |
| 17 | 17 | @ApiModelProperty(value = "日志主键", required = true, example = "1024") |
| 18 | 18 | private Long id; | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/convert/logger/SysApiAccessLogConvert.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/convert/logger/InfApiAccessLogConvert.java
| 1 | -package cn.iocoder.dashboard.modules.system.convert.logger; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.convert.logger; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.dashboard.framework.logger.apilog.core.service.dto.ApiAccessLogCreateDTO; |
| 5 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExcelVO; | |
| 6 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogRespVO; | |
| 7 | -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; | |
| 5 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; | |
| 6 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogRespVO; | |
| 7 | +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | |
| 8 | 8 | import org.mapstruct.Mapper; |
| 9 | 9 | import org.mapstruct.factory.Mappers; |
| 10 | 10 | |
| ... | ... | @@ -16,18 +16,18 @@ import java.util.List; |
| 16 | 16 | * @author 芋道源码 |
| 17 | 17 | */ |
| 18 | 18 | @Mapper |
| 19 | -public interface SysApiAccessLogConvert { | |
| 19 | +public interface InfApiAccessLogConvert { | |
| 20 | 20 | |
| 21 | - SysApiAccessLogConvert INSTANCE = Mappers.getMapper(SysApiAccessLogConvert.class); | |
| 21 | + InfApiAccessLogConvert INSTANCE = Mappers.getMapper(InfApiAccessLogConvert.class); | |
| 22 | 22 | |
| 23 | - SysApiAccessLogDO convert(ApiAccessLogCreateDTO bean); | |
| 23 | + InfApiAccessLogDO convert(ApiAccessLogCreateDTO bean); | |
| 24 | 24 | |
| 25 | - SysApiAccessLogRespVO convert(SysApiAccessLogDO bean); | |
| 25 | + InfApiAccessLogRespVO convert(InfApiAccessLogDO bean); | |
| 26 | 26 | |
| 27 | - List<SysApiAccessLogRespVO> convertList(List<SysApiAccessLogDO> list); | |
| 27 | + List<InfApiAccessLogRespVO> convertList(List<InfApiAccessLogDO> list); | |
| 28 | 28 | |
| 29 | - PageResult<SysApiAccessLogRespVO> convertPage(PageResult<SysApiAccessLogDO> page); | |
| 29 | + PageResult<InfApiAccessLogRespVO> convertPage(PageResult<InfApiAccessLogDO> page); | |
| 30 | 30 | |
| 31 | - List<SysApiAccessLogExcelVO> convertList02(List<SysApiAccessLogDO> list); | |
| 31 | + List<InfApiAccessLogExcelVO> convertList02(List<InfApiAccessLogDO> list); | |
| 32 | 32 | |
| 33 | 33 | } | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/infra/convert/package-info.java
0 → 100644
src/main/java/cn/iocoder/dashboard/modules/infra/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md
0 → 100644
| 1 | +<http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao> | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/logger/SysApiAccessLogDO.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiAccessLogDO.java
| 1 | -package cn.iocoder.dashboard.modules.system.dal.dataobject.logger; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.dal.dataobject.logger; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.common.enums.UserTypeEnum; |
| 4 | 4 | import cn.iocoder.dashboard.common.pojo.CommonResult; |
| ... | ... | @@ -14,14 +14,14 @@ import java.util.Date; |
| 14 | 14 | * |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| 17 | -@TableName("sys_api_access_log") | |
| 17 | +@TableName("inf_api_access_log") | |
| 18 | 18 | @Data |
| 19 | 19 | @EqualsAndHashCode(callSuper = true) |
| 20 | 20 | @ToString(callSuper = true) |
| 21 | 21 | @Builder |
| 22 | 22 | @NoArgsConstructor |
| 23 | 23 | @AllArgsConstructor |
| 24 | -public class SysApiAccessLogDO extends BaseDO { | |
| 24 | +public class InfApiAccessLogDO extends BaseDO { | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * 编号 | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/infra/dal/dataobject/logger/InfApiErrorLogDO.java
0 → 100644
src/main/java/cn/iocoder/dashboard/modules/system/dal/mysql/logger/SysApiAccessLogMapper.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/dal/mysql/logger/InfApiAccessLogMapper.java
| 1 | -package cn.iocoder.dashboard.modules.system.dal.mysql.logger; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.dal.mysql.logger; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.dashboard.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.dashboard.framework.mybatis.core.query.QueryWrapperX; |
| 6 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExportReqVO; | |
| 7 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogPageReqVO; | |
| 8 | -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; | |
| 6 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | |
| 7 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | |
| 8 | +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | |
| 9 | 9 | import org.apache.ibatis.annotations.Mapper; |
| 10 | 10 | |
| 11 | 11 | import java.util.List; |
| ... | ... | @@ -16,10 +16,10 @@ import java.util.List; |
| 16 | 16 | * @author 芋道源码 |
| 17 | 17 | */ |
| 18 | 18 | @Mapper |
| 19 | -public interface SysApiAccessLogMapper extends BaseMapperX<SysApiAccessLogDO> { | |
| 19 | +public interface InfApiAccessLogMapper extends BaseMapperX<InfApiAccessLogDO> { | |
| 20 | 20 | |
| 21 | - default PageResult<SysApiAccessLogDO> selectPage(SysApiAccessLogPageReqVO reqVO) { | |
| 22 | - return selectPage(reqVO, new QueryWrapperX<SysApiAccessLogDO>() | |
| 21 | + default PageResult<InfApiAccessLogDO> selectPage(InfApiAccessLogPageReqVO reqVO) { | |
| 22 | + return selectPage(reqVO, new QueryWrapperX<InfApiAccessLogDO>() | |
| 23 | 23 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 24 | 24 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 25 | 25 | .eqIfPresent("application_name", reqVO.getApplicationName()) |
| ... | ... | @@ -27,11 +27,12 @@ public interface SysApiAccessLogMapper extends BaseMapperX<SysApiAccessLogDO> { |
| 27 | 27 | .betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime()) |
| 28 | 28 | .geIfPresent("duration", reqVO.getDuration()) |
| 29 | 29 | .eqIfPresent("result_code", reqVO.getResultCode()) |
| 30 | + .orderByDesc("id") | |
| 30 | 31 | ); |
| 31 | 32 | } |
| 32 | 33 | |
| 33 | - default List<SysApiAccessLogDO> selectList(SysApiAccessLogExportReqVO reqVO) { | |
| 34 | - return selectList(new QueryWrapperX<SysApiAccessLogDO>() | |
| 34 | + default List<InfApiAccessLogDO> selectList(InfApiAccessLogExportReqVO reqVO) { | |
| 35 | + return selectList(new QueryWrapperX<InfApiAccessLogDO>() | |
| 35 | 36 | .eqIfPresent("user_id", reqVO.getUserId()) |
| 36 | 37 | .eqIfPresent("user_type", reqVO.getUserType()) |
| 37 | 38 | .eqIfPresent("application_name", reqVO.getApplicationName()) |
| ... | ... | @@ -39,6 +40,7 @@ public interface SysApiAccessLogMapper extends BaseMapperX<SysApiAccessLogDO> { |
| 39 | 40 | .betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime()) |
| 40 | 41 | .geIfPresent("duration", reqVO.getDuration()) |
| 41 | 42 | .eqIfPresent("result_code", reqVO.getResultCode()) |
| 43 | + .orderByDesc("id") | |
| 42 | 44 | ); |
| 43 | 45 | } |
| 44 | 46 | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/service/logger/SysApiAccessLogService.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/InfApiAccessLogService.java
| 1 | -package cn.iocoder.dashboard.modules.system.service.logger; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.service.logger; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.dashboard.framework.logger.apilog.core.service.ApiAccessLogFrameworkService; |
| 5 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExportReqVO; | |
| 6 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogPageReqVO; | |
| 7 | -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; | |
| 5 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | |
| 6 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | |
| 7 | +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | |
| 8 | 8 | |
| 9 | 9 | import java.util.List; |
| 10 | 10 | |
| ... | ... | @@ -13,7 +13,7 @@ import java.util.List; |
| 13 | 13 | * |
| 14 | 14 | * @author 芋道源码 |
| 15 | 15 | */ |
| 16 | -public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { | |
| 16 | +public interface InfApiAccessLogService extends ApiAccessLogFrameworkService { | |
| 17 | 17 | |
| 18 | 18 | /** |
| 19 | 19 | * 获得 API 访问日志 |
| ... | ... | @@ -21,7 +21,7 @@ public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { |
| 21 | 21 | * @param id 编号 |
| 22 | 22 | * @return API 访问日志 |
| 23 | 23 | */ |
| 24 | - SysApiAccessLogDO getApiAccessLog(Long id); | |
| 24 | + InfApiAccessLogDO getApiAccessLog(Long id); | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * 获得 API 访问日志分页 |
| ... | ... | @@ -29,7 +29,7 @@ public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { |
| 29 | 29 | * @param pageReqVO 分页查询 |
| 30 | 30 | * @return API 访问日志分页 |
| 31 | 31 | */ |
| 32 | - PageResult<SysApiAccessLogDO> getApiAccessLogPage(SysApiAccessLogPageReqVO pageReqVO); | |
| 32 | + PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO); | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | 35 | * 获得 API 访问日志列表, 用于 Excel 导出 |
| ... | ... | @@ -37,6 +37,6 @@ public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { |
| 37 | 37 | * @param exportReqVO 查询条件 |
| 38 | 38 | * @return API 访问日志分页 |
| 39 | 39 | */ |
| 40 | - List<SysApiAccessLogDO> getApiAccessLogList(SysApiAccessLogExportReqVO exportReqVO); | |
| 40 | + List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO); | |
| 41 | 41 | |
| 42 | 42 | } | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/service/logger/impl/SysApiAccessLogServiceImpl.java renamed to src/main/java/cn/iocoder/dashboard/modules/infra/service/logger/impl/InfApiAccessLogServiceImpl.java
| 1 | -package cn.iocoder.dashboard.modules.system.service.logger.impl; | |
| 1 | +package cn.iocoder.dashboard.modules.infra.service.logger.impl; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.dashboard.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.dashboard.framework.logger.apilog.core.service.dto.ApiAccessLogCreateDTO; |
| 5 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogExportReqVO; | |
| 6 | -import cn.iocoder.dashboard.modules.system.controller.logger.vo.apiaccesslog.SysApiAccessLogPageReqVO; | |
| 7 | -import cn.iocoder.dashboard.modules.system.convert.logger.SysApiAccessLogConvert; | |
| 8 | -import cn.iocoder.dashboard.modules.system.dal.dataobject.logger.SysApiAccessLogDO; | |
| 9 | -import cn.iocoder.dashboard.modules.system.dal.mysql.logger.SysApiAccessLogMapper; | |
| 10 | -import cn.iocoder.dashboard.modules.system.service.logger.SysApiAccessLogService; | |
| 5 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; | |
| 6 | +import cn.iocoder.dashboard.modules.infra.controller.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; | |
| 7 | +import cn.iocoder.dashboard.modules.infra.convert.logger.InfApiAccessLogConvert; | |
| 8 | +import cn.iocoder.dashboard.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; | |
| 9 | +import cn.iocoder.dashboard.modules.infra.dal.mysql.logger.InfApiAccessLogMapper; | |
| 10 | +import cn.iocoder.dashboard.modules.infra.service.logger.InfApiAccessLogService; | |
| 11 | 11 | import org.springframework.scheduling.annotation.Async; |
| 12 | 12 | import org.springframework.stereotype.Service; |
| 13 | 13 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -23,31 +23,31 @@ import java.util.List; |
| 23 | 23 | */ |
| 24 | 24 | @Service |
| 25 | 25 | @Validated |
| 26 | -public class SysApiAccessLogServiceImpl implements SysApiAccessLogService { | |
| 26 | +public class InfApiAccessLogServiceImpl implements InfApiAccessLogService { | |
| 27 | 27 | |
| 28 | 28 | @Resource |
| 29 | - private SysApiAccessLogMapper apiAccessLogMapper; | |
| 29 | + private InfApiAccessLogMapper apiAccessLogMapper; | |
| 30 | 30 | |
| 31 | 31 | @Override |
| 32 | 32 | @Async |
| 33 | 33 | public void createApiAccessLogAsync(@Valid ApiAccessLogCreateDTO createDTO) { |
| 34 | 34 | // 插入 |
| 35 | - SysApiAccessLogDO apiAccessLog = SysApiAccessLogConvert.INSTANCE.convert(createDTO); | |
| 35 | + InfApiAccessLogDO apiAccessLog = InfApiAccessLogConvert.INSTANCE.convert(createDTO); | |
| 36 | 36 | apiAccessLogMapper.insert(apiAccessLog); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | @Override |
| 40 | - public SysApiAccessLogDO getApiAccessLog(Long id) { | |
| 40 | + public InfApiAccessLogDO getApiAccessLog(Long id) { | |
| 41 | 41 | return apiAccessLogMapper.selectById(id); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | @Override |
| 45 | - public PageResult<SysApiAccessLogDO> getApiAccessLogPage(SysApiAccessLogPageReqVO pageReqVO) { | |
| 45 | + public PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO) { | |
| 46 | 46 | return apiAccessLogMapper.selectPage(pageReqVO); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | @Override |
| 50 | - public List<SysApiAccessLogDO> getApiAccessLogList(SysApiAccessLogExportReqVO exportReqVO) { | |
| 50 | + public List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO) { | |
| 51 | 51 | return apiAccessLogMapper.selectList(exportReqVO); |
| 52 | 52 | } |
| 53 | 53 | ... | ... |
src/main/java/cn/iocoder/dashboard/modules/system/convert/《芋道 Spring Boot 对象转换 MapStruct 入门》.md
src/main/java/cn/iocoder/dashboard/modules/system/dal/dataobject/logger/SysApiErrorLogDO.java deleted
src/main/resources/codegen/java/dal/mapper.vm
| ... | ... | @@ -52,12 +52,13 @@ public interface ${table.className}Mapper extends BaseMapperX<${table.className} |
| 52 | 52 | default PageResult<${table.className}DO> selectPage(${table.className}PageReqVO reqVO) { |
| 53 | 53 | return selectPage(reqVO, new QueryWrapperX<${table.className}DO>() |
| 54 | 54 | #listCondition() |
| 55 | + .orderByDesc("id")# 大多数情况下,id 倒序 | |
| 55 | 56 | ); |
| 56 | 57 | } |
| 57 | 58 | |
| 58 | 59 | default List<${table.className}DO> selectList(${table.className}ExportReqVO reqVO) { |
| 59 | 60 | return selectList(new QueryWrapperX<${table.className}DO>() |
| 60 | - #listCondition() | |
| 61 | + #listCondition()# 大多数情况下,id 倒序 | |
| 61 | 62 | ); |
| 62 | 63 | } |
| 63 | 64 | ... | ... |