127 lines
3.7 KiB
Java
127 lines
3.7 KiB
Java
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));
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getMethod")
|
|
public AjaxResult getMethod()
|
|
{
|
|
List<String> strings=requestLogService.getMethod();
|
|
return AjaxResult.success(requestLogService.getMethod());
|
|
}
|
|
|
|
// 获取原系统
|
|
@GetMapping("/getSource")
|
|
public AjaxResult getSource()
|
|
{
|
|
List<String> strings=requestLogService.getSource();
|
|
return AjaxResult.success(requestLogService.getSource());
|
|
}
|
|
// 获取目标系统
|
|
@GetMapping("/getTarget")
|
|
public AjaxResult getTarget()
|
|
{
|
|
List<String> strings=requestLogService.getTarget();
|
|
return AjaxResult.success(requestLogService.getTarget());
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 删除接口记录
|
|
*/
|
|
@PreAuthorize("@ss.hasPermi('requestInterface:log:remove')")
|
|
@Log(title = "接口记录", businessType = BusinessType.DELETE)
|
|
@DeleteMapping("/{requestIds}")
|
|
public AjaxResult remove(@PathVariable Long[] requestIds)
|
|
{
|
|
return toAjax(requestLogService.deleteRequestLogByRequestIds(requestIds));
|
|
}
|
|
}
|