初始化
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
package com.ruoyi.log.controller;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.log.domain.RequestLog;
|
||||
import com.ruoyi.log.service.IRequestLogService;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 接口记录Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-07-02
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/requestInterface/log")
|
||||
public class RequestLogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IRequestLogService requestLogService;
|
||||
|
||||
/**
|
||||
* 查询接口记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('requestInterface:log:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(RequestLog requestLog)
|
||||
{
|
||||
startPage();
|
||||
List<RequestLog> list = requestLogService.selectRequestLogList(requestLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出接口记录列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('requestInterface:log:export')")
|
||||
@Log(title = "接口记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, RequestLog requestLog)
|
||||
{
|
||||
List<RequestLog> list = requestLogService.selectRequestLogList(requestLog);
|
||||
ExcelUtil<RequestLog> util = new ExcelUtil<RequestLog>(RequestLog.class);
|
||||
util.exportExcel(response, list, "接口记录数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取接口记录详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('requestInterface:log:query')")
|
||||
@GetMapping(value = "/{requestId}")
|
||||
public AjaxResult getInfo(@PathVariable("requestId") Long requestId)
|
||||
{
|
||||
return success(requestLogService.selectRequestLogByRequestId(requestId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增接口记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('requestInterface:log:add')")
|
||||
@Log(title = "接口记录", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody RequestLog requestLog)
|
||||
{
|
||||
return toAjax(requestLogService.insertRequestLog(requestLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改接口记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('requestInterface:log:edit')")
|
||||
@Log(title = "接口记录", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody RequestLog requestLog)
|
||||
{
|
||||
return toAjax(requestLogService.updateRequestLog(requestLog));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除接口记录
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('requestInterface:log:remove')")
|
||||
@Log(title = "接口记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{requestIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] requestIds)
|
||||
{
|
||||
return toAjax(requestLogService.deleteRequestLogByRequestIds(requestIds));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user