feat:【system/infra】访问日志、操作日志、错误日志,增加 get 接口,满足 admin uniapp 查询诉求
This commit is contained in:
parent
e45e2ae29f
commit
8b616c3153
@ -11,6 +11,7 @@ import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.Api
|
|||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO;
|
||||||
import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService;
|
import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@ -19,6 +20,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -36,6 +38,15 @@ public class ApiAccessLogController {
|
|||||||
@Resource
|
@Resource
|
||||||
private ApiAccessLogService apiAccessLogService;
|
private ApiAccessLogService apiAccessLogService;
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得 API 访问日志")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('infra:api-access-log:query')")
|
||||||
|
public CommonResult<ApiAccessLogRespVO> getApiAccessLog(@RequestParam("id") Long id) {
|
||||||
|
ApiAccessLogDO apiAccessLog = apiAccessLogService.getApiAccessLog(id);
|
||||||
|
return success(BeanUtils.toBean(apiAccessLog, ApiAccessLogRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得API 访问日志分页")
|
@Operation(summary = "获得API 访问日志分页")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:api-access-log:query')")
|
@PreAuthorize("@ss.hasPermission('infra:api-access-log:query')")
|
||||||
|
|||||||
@ -50,6 +50,15 @@ public class ApiErrorLogController {
|
|||||||
return success(true);
|
return success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得 API 错误日志")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('infra:api-error-log:query')")
|
||||||
|
public CommonResult<ApiErrorLogRespVO> getApiErrorLog(@RequestParam("id") Long id) {
|
||||||
|
ApiErrorLogDO apiErrorLog = apiErrorLogService.getApiErrorLog(id);
|
||||||
|
return success(BeanUtils.toBean(apiErrorLog, ApiErrorLogRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得 API 错误日志分页")
|
@Operation(summary = "获得 API 错误日志分页")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:api-error-log:query')")
|
@PreAuthorize("@ss.hasPermission('infra:api-error-log:query')")
|
||||||
|
|||||||
@ -19,6 +19,14 @@ public interface ApiAccessLogService {
|
|||||||
*/
|
*/
|
||||||
void createApiAccessLog(ApiAccessLogCreateReqDTO createReqDTO);
|
void createApiAccessLog(ApiAccessLogCreateReqDTO createReqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得 API 访问日志
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return API 访问日志
|
||||||
|
*/
|
||||||
|
ApiAccessLogDO getApiAccessLog(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得 API 访问日志分页
|
* 获得 API 访问日志分页
|
||||||
*
|
*
|
||||||
|
|||||||
@ -45,6 +45,11 @@ public class ApiAccessLogServiceImpl implements ApiAccessLogService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiAccessLogDO getApiAccessLog(Long id) {
|
||||||
|
return apiAccessLogMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO) {
|
public PageResult<ApiAccessLogDO> getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO) {
|
||||||
return apiAccessLogMapper.selectPage(pageReqVO);
|
return apiAccessLogMapper.selectPage(pageReqVO);
|
||||||
|
|||||||
@ -19,6 +19,14 @@ public interface ApiErrorLogService {
|
|||||||
*/
|
*/
|
||||||
void createApiErrorLog(ApiErrorLogCreateReqDTO createReqDTO);
|
void createApiErrorLog(ApiErrorLogCreateReqDTO createReqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得 API 错误日志
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return API 错误日志
|
||||||
|
*/
|
||||||
|
ApiErrorLogDO getApiErrorLog(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得 API 错误日志分页
|
* 获得 API 错误日志分页
|
||||||
*
|
*
|
||||||
|
|||||||
@ -58,6 +58,11 @@ public class ApiErrorLogServiceImpl implements ApiErrorLogService {
|
|||||||
return apiErrorLogMapper.selectPage(pageReqVO);
|
return apiErrorLogMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiErrorLogDO getApiErrorLog(Long id) {
|
||||||
|
return apiErrorLogMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
|
public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) {
|
||||||
ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
|
ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id);
|
||||||
|
|||||||
@ -13,6 +13,7 @@ import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO;
|
|||||||
import cn.iocoder.yudao.module.system.service.logger.OperateLogService;
|
import cn.iocoder.yudao.module.system.service.logger.OperateLogService;
|
||||||
import com.fhs.core.trans.anno.TransMethodResult;
|
import com.fhs.core.trans.anno.TransMethodResult;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
@ -21,6 +22,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -38,6 +40,15 @@ public class OperateLogController {
|
|||||||
@Resource
|
@Resource
|
||||||
private OperateLogService operateLogService;
|
private OperateLogService operateLogService;
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "查看操作日志")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:operate-log:query')")
|
||||||
|
public CommonResult<OperateLogRespVO> getOperateLog(@RequestParam("id") Long id) {
|
||||||
|
OperateLogDO operateLog = operateLogService.getOperateLog(id);
|
||||||
|
return success(BeanUtils.toBean(operateLog, OperateLogRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "查看操作日志分页列表")
|
@Operation(summary = "查看操作日志分页列表")
|
||||||
@PreAuthorize("@ss.hasPermission('system:operate-log:query')")
|
@PreAuthorize("@ss.hasPermission('system:operate-log:query')")
|
||||||
|
|||||||
@ -20,6 +20,14 @@ public interface OperateLogService {
|
|||||||
*/
|
*/
|
||||||
void createOperateLog(OperateLogCreateReqDTO createReqDTO);
|
void createOperateLog(OperateLogCreateReqDTO createReqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得操作日志
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 操作日志
|
||||||
|
*/
|
||||||
|
OperateLogDO getOperateLog(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得操作日志分页列表
|
* 获得操作日志分页列表
|
||||||
*
|
*
|
||||||
|
|||||||
@ -31,6 +31,11 @@ public class OperateLogServiceImpl implements OperateLogService {
|
|||||||
operateLogMapper.insert(log);
|
operateLogMapper.insert(log);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OperateLogDO getOperateLog(Long id) {
|
||||||
|
return operateLogMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<OperateLogDO> getOperateLogPage(OperateLogPageReqVO pageReqVO) {
|
public PageResult<OperateLogDO> getOperateLogPage(OperateLogPageReqVO pageReqVO) {
|
||||||
return operateLogMapper.selectPage(pageReqVO);
|
return operateLogMapper.selectPage(pageReqVO);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user