fix: 修复操作日志前端显示问题
This commit is contained in:
@@ -10,15 +10,7 @@ namespace Yi.RBAC.Application.Contracts.Logs.Dtos
|
||||
{
|
||||
public class OperationLogGetListInputVo : PagedAllResultRequestDto
|
||||
{
|
||||
public string? Title { get; set; }
|
||||
public OperEnum OperType { get; set; }
|
||||
public string? RequestMethod { get; set; }
|
||||
public OperEnum? OperType { get; set; }
|
||||
public string? OperUser { get; set; }
|
||||
public string? OperIp { get; set; }
|
||||
public string? OperLocation { get; set; }
|
||||
public string? Method { get; set; }
|
||||
public string? RequestParam { get; set; }
|
||||
public string? RequestResult { get; set; }
|
||||
public DateTime CreationTime { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -99,6 +99,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
}
|
||||
|
||||
entity.State = state;
|
||||
await _repository.UpdateAsync(entity);
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using SqlSugar;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Yi.Framework.Auth.JwtBearer.Authorization;
|
||||
using Yi.RBAC.Domain.Shared.Logs;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
@@ -67,6 +68,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="UserFriendlyException"></exception>
|
||||
[OperLog("添加用户", OperEnum.Insert)]
|
||||
public async override Task<UserGetOutputDto> CreateAsync(UserCreateInputVo input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input.Password))
|
||||
@@ -111,6 +113,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
/// <param name="id"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
[OperLog("更新用户", OperEnum.Update)]
|
||||
public async override Task<UserGetOutputDto> UpdateAsync(long id, UserUpdateInputVo input)
|
||||
{
|
||||
if (await _repository.IsAnyAsync(u => input.UserName!.Equals(u.UserName) && !id.Equals(u.Id)))
|
||||
@@ -142,7 +145,8 @@ namespace Yi.RBAC.Application.Identity
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
[Route("/api/user/{id}/{state}")]
|
||||
public async Task<UserGetOutputDto> UpdateStateAsync([FromRoute] long id,[FromRoute] bool state)
|
||||
[OperLog("更新用户状态", OperEnum.Update)]
|
||||
public async Task<UserGetOutputDto> UpdateStateAsync([FromRoute] long id, [FromRoute] bool state)
|
||||
{
|
||||
var entity = await _repository.GetByIdAsync(id);
|
||||
if (entity is null)
|
||||
@@ -151,6 +155,7 @@ namespace Yi.RBAC.Application.Identity
|
||||
}
|
||||
|
||||
entity.State = state;
|
||||
await _repository.UpdateAsync(entity);
|
||||
return await MapToGetOutputDtoAsync(entity);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using NET.AutoWebApi.Setting;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NET.AutoWebApi.Setting;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -29,5 +30,10 @@ namespace Yi.RBAC.Application.Logs
|
||||
return new PagedResultDto<LoginLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override Task<LoginLogGetListOutputDto> UpdateAsync(long id, LoginLogGetListOutputDto input)
|
||||
{
|
||||
return base.UpdateAsync(id, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ using Yi.RBAC.Domain.Logs.Entities;
|
||||
using Yi.Framework.Ddd.Services;
|
||||
using Yi.Framework.Model.RABC.Entitys;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using SqlSugar;
|
||||
using Yi.RBAC.Application.Contracts.Logs.Dtos.LoginLog;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yi.RBAC.Application.Logs
|
||||
{
|
||||
@@ -15,9 +18,23 @@ namespace Yi.RBAC.Application.Logs
|
||||
public class OperationLogService : CrudAppService<OperationLogEntity, OperationLogGetListOutputDto, long, OperationLogGetListInputVo >,
|
||||
IOperationLogService, IAutoApiService
|
||||
{
|
||||
public override Task<PagedResultDto<OperationLogGetListOutputDto>> GetListAsync(OperationLogGetListInputVo input)
|
||||
public override async Task<PagedResultDto<OperationLogGetListOutputDto>> GetListAsync(OperationLogGetListInputVo input)
|
||||
{
|
||||
return base.GetListAsync(input);
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.OperUser), x => x.OperUser.Contains(input.OperUser!))
|
||||
.WhereIF(input.OperType is not null, x => x.OperType==input.OperType)
|
||||
.WhereIF(input.StartTime is not null && input.EndTime is not null, x => x.CreationTime >= input.StartTime && x.CreationTime <= input.EndTime)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<OperationLogGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
[NonAction]
|
||||
public override Task<OperationLogGetListOutputDto> UpdateAsync(long id, OperationLogGetListOutputDto input)
|
||||
{
|
||||
return base.UpdateAsync(id, input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user