mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	调整 API 访问日志,从 system 归到 infra 更合适
This commit is contained in:
		| @@ -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; | ||||
| @@ -1 +1,4 @@ | ||||
| /** | ||||
|  * 使用 MyBatis Plus 提升使用 MyBatis 的开发效率 | ||||
|  */ | ||||
| package cn.iocoder.dashboard.framework.mybatis; | ||||
|   | ||||
| @@ -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<SysApiAccessLogRespVO> 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<InfApiAccessLogRespVO> 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<PageResult<SysApiAccessLogRespVO>> getApiAccessLogPage(@Valid SysApiAccessLogPageReqVO pageVO) { | ||||
|         PageResult<SysApiAccessLogDO> pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); | ||||
|         return success(SysApiAccessLogConvert.INSTANCE.convertPage(pageResult)); | ||||
|     @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") | ||||
|     public CommonResult<PageResult<InfApiAccessLogRespVO>> getApiAccessLogPage(@Valid InfApiAccessLogPageReqVO pageVO) { | ||||
|         PageResult<InfApiAccessLogDO> 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<SysApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); | ||||
|         List<InfApiAccessLogDO> list = apiAccessLogService.getApiAccessLogList(exportReqVO); | ||||
|         // 导出 Excel | ||||
|         List<SysApiAccessLogExcelVO> datas = SysApiAccessLogConvert.INSTANCE.convertList02(list); | ||||
|         ExcelUtils.write(response, "API 访问日志.xls", "数据", SysApiAccessLogExcelVO.class, datas); | ||||
|         List<InfApiAccessLogExcelVO> datas = InfApiAccessLogConvert.INSTANCE.convertList02(list); | ||||
|         ExcelUtils.write(response, "API 访问日志.xls", "数据", InfApiAccessLogExcelVO.class, datas); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| @@ -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 = "链路追踪编号不能为空") | ||||
| @@ -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; | ||||
| @@ -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; | ||||
| @@ -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; | ||||
| @@ -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; | ||||
| @@ -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<InfApiAccessLogRespVO> convertList(List<InfApiAccessLogDO> list); | ||||
|  | ||||
|     PageResult<InfApiAccessLogRespVO> convertPage(PageResult<InfApiAccessLogDO> page); | ||||
|  | ||||
|     List<InfApiAccessLogExcelVO> convertList02(List<InfApiAccessLogDO> list); | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,6 @@ | ||||
| /** | ||||
|  * 提供 POJO 类的实体转换 | ||||
|  * | ||||
|  * 目前使用 MapStruct 框架 | ||||
|  */ | ||||
| package cn.iocoder.dashboard.modules.infra.convert; | ||||
| @@ -0,0 +1 @@ | ||||
| <http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao> | ||||
| @@ -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 { | ||||
| 
 | ||||
|     /** | ||||
|      * 编号 | ||||
| @@ -0,0 +1,4 @@ | ||||
| package cn.iocoder.dashboard.modules.infra.dal.dataobject.logger; | ||||
|  | ||||
| public class InfApiErrorLogDO { | ||||
| } | ||||
| @@ -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<SysApiAccessLogDO> { | ||||
| public interface InfApiAccessLogMapper extends BaseMapperX<InfApiAccessLogDO> { | ||||
| 
 | ||||
|     default PageResult<SysApiAccessLogDO> selectPage(SysApiAccessLogPageReqVO reqVO) { | ||||
|         return selectPage(reqVO, new QueryWrapperX<SysApiAccessLogDO>() | ||||
|     default PageResult<InfApiAccessLogDO> selectPage(InfApiAccessLogPageReqVO reqVO) { | ||||
|         return selectPage(reqVO, new QueryWrapperX<InfApiAccessLogDO>() | ||||
|                 .eqIfPresent("user_id", reqVO.getUserId()) | ||||
|                 .eqIfPresent("user_type", reqVO.getUserType()) | ||||
|                 .eqIfPresent("application_name", reqVO.getApplicationName()) | ||||
| @@ -27,11 +27,12 @@ public interface SysApiAccessLogMapper extends BaseMapperX<SysApiAccessLogDO> { | ||||
|                 .betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime()) | ||||
|                 .geIfPresent("duration", reqVO.getDuration()) | ||||
|                 .eqIfPresent("result_code", reqVO.getResultCode()) | ||||
|                 .orderByDesc("id") | ||||
|         ); | ||||
|     } | ||||
| 
 | ||||
|     default List<SysApiAccessLogDO> selectList(SysApiAccessLogExportReqVO reqVO) { | ||||
|         return selectList(new QueryWrapperX<SysApiAccessLogDO>() | ||||
|     default List<InfApiAccessLogDO> selectList(InfApiAccessLogExportReqVO reqVO) { | ||||
|         return selectList(new QueryWrapperX<InfApiAccessLogDO>() | ||||
|                 .eqIfPresent("user_id", reqVO.getUserId()) | ||||
|                 .eqIfPresent("user_type", reqVO.getUserType()) | ||||
|                 .eqIfPresent("application_name", reqVO.getApplicationName()) | ||||
| @@ -39,6 +40,7 @@ public interface SysApiAccessLogMapper extends BaseMapperX<SysApiAccessLogDO> { | ||||
|                 .betweenIfPresent("begin_time", reqVO.getBeginBeginTime(), reqVO.getEndBeginTime()) | ||||
|                 .geIfPresent("duration", reqVO.getDuration()) | ||||
|                 .eqIfPresent("result_code", reqVO.getResultCode()) | ||||
|                 .orderByDesc("id") | ||||
|         ); | ||||
|     } | ||||
| 
 | ||||
| @@ -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<SysApiAccessLogDO> getApiAccessLogPage(SysApiAccessLogPageReqVO pageReqVO); | ||||
|     PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO); | ||||
| 
 | ||||
|     /** | ||||
|      * 获得 API 访问日志列表, 用于 Excel 导出 | ||||
| @@ -37,6 +37,6 @@ public interface SysApiAccessLogService extends ApiAccessLogFrameworkService { | ||||
|      * @param exportReqVO 查询条件 | ||||
|      * @return API 访问日志分页 | ||||
|      */ | ||||
|     List<SysApiAccessLogDO> getApiAccessLogList(SysApiAccessLogExportReqVO exportReqVO); | ||||
|     List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO); | ||||
| 
 | ||||
| } | ||||
| @@ -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<SysApiAccessLogDO> getApiAccessLogPage(SysApiAccessLogPageReqVO pageReqVO) { | ||||
|     public PageResult<InfApiAccessLogDO> getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO) { | ||||
|         return apiAccessLogMapper.selectPage(pageReqVO); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public List<SysApiAccessLogDO> getApiAccessLogList(SysApiAccessLogExportReqVO exportReqVO) { | ||||
|     public List<InfApiAccessLogDO> getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO) { | ||||
|         return apiAccessLogMapper.selectList(exportReqVO); | ||||
|     } | ||||
| 
 | ||||
| @@ -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<SysApiAccessLogRespVO> convertList(List<SysApiAccessLogDO> list); | ||||
|  | ||||
|     PageResult<SysApiAccessLogRespVO> convertPage(PageResult<SysApiAccessLogDO> page); | ||||
|  | ||||
|     List<SysApiAccessLogExcelVO> convertList02(List<SysApiAccessLogDO> list); | ||||
|  | ||||
| } | ||||
| @@ -1 +1 @@ | ||||
| <http://www.iocoder.cn/Spring-Boot/MapStruct/?dashboard> | ||||
| <http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao> | ||||
|   | ||||
| @@ -1,4 +0,0 @@ | ||||
| package cn.iocoder.dashboard.modules.system.dal.dataobject.logger; | ||||
|  | ||||
| public class SysApiErrorLogDO { | ||||
| } | ||||
| @@ -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 倒序 | ||||
|         ); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 YunaiV
					YunaiV