45 lines
1.1 KiB
Go
45 lines
1.1 KiB
Go
package controller
|
|
|
|
import (
|
|
"context"
|
|
|
|
"gitee.com/red-future---jilin-g/common/log/model/dto"
|
|
"gitee.com/red-future---jilin-g/common/log/service"
|
|
)
|
|
|
|
type operationLog struct{}
|
|
|
|
// OperationLog 操作日志控制器
|
|
var OperationLog = new(operationLog)
|
|
|
|
// GetByID 根据ID获取操作日志
|
|
// @Summary 获取操作日志详情
|
|
// @Description 根据日志ID获取操作日志的详细信息
|
|
func (c *operationLog) GetByID(ctx context.Context, req *dto.GetLogReq) (res *dto.GetLogResp, err error) {
|
|
logInfo, err := service.OperationLog.GetByID(ctx, req.ID)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
res = &dto.GetLogResp{
|
|
OperationLogInfo: *logInfo,
|
|
}
|
|
return
|
|
}
|
|
|
|
// List 查询操作日志列表(通用方法,支持根据不同条件动态查询)
|
|
// @Summary 查询操作日志列表
|
|
// @Description 根据多个条件查询操作日志列表
|
|
func (c *operationLog) List(ctx context.Context, req *dto.ListLogsReq) (res *dto.ListLogsResp, err error) {
|
|
logs, total, err := service.OperationLog.List(ctx, req)
|
|
if err != nil {
|
|
return
|
|
}
|
|
|
|
res = &dto.ListLogsResp{
|
|
Logs: logs,
|
|
Total: total,
|
|
}
|
|
return
|
|
}
|