Files
DocprintService/src/YhCore.WebApi/Controllers/Api/Com/LogController.cs
T
2026-09-02 10:23:24 +08:00

52 lines
1.7 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Microsoft.AspNetCore.Mvc;
using YhCore.Common;
using YhCore.Common.UserContext;
using YhCore.Entity;
using YhCore.Model.Vo;
using YhCore.Service.Interfaces;
namespace YhCore.WebApi.Controllers.Api
{
/// <summary>
/// 日志查询接口(对应 Java 版 controller/api/LogController,路由 /api/log/)。
/// </summary>
[ApiController]
[Route(ApiRoutes.ApiPath + "/log")]
public class LogController : ControllerBase
{
private readonly ILogService _logService;
public LogController(ILogService logService)
{
_logService = logService;
}
/// <summary>
/// 系统操作日志搜索(对应 Java GET /api/log/systemSearch)。
/// </summary>
/// <param name="keyword">关键字(可空)</param>
/// <param name="page">页码,从 0 开始(对应 Spring Pageable.page)</param>
/// <param name="size">每页大小(对应 Spring Pageable.size)</param>
[HttpGet("systemSearch")]
public PageVO<SysOperationLog> SystemSearch(
[FromQuery] string keyword,
[FromQuery] int page = 0,
[FromQuery] int size = 20)
{
return _logService.Search(UserContextHolder.GetSchId(), keyword, true, page, size);
}
/// <summary>
/// 操作日志搜索(对应 Java GET /api/log/search)。
/// </summary>
[HttpGet("search")]
public PageVO<SysOperationLog> Search(
[FromQuery] string keyword,
[FromQuery] int page = 0,
[FromQuery] int size = 20)
{
return _logService.Search(UserContextHolder.GetSchId(), keyword, false, page, size);
}
}
}