优化日志模块:重构操作日志记录与查询功能,支持批量操作日志记录,完善日志查询接口,增加软删除操作类型
This commit is contained in:
@@ -12,33 +12,7 @@ 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
|
||||
// GetByCollectionId 根据collectionId获取操作日志列表
|
||||
func (c *operationLog) GetByCollectionId(ctx context.Context, req *dto.ListLogsReq) (res *dto.ListLogsResp, err error) {
|
||||
return service.OperationLog.GetByCollectionId(ctx, req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user