refactor: 抽象操作日志模块

This commit is contained in:
陈淳
2023-02-22 16:49:24 +08:00
parent fa4e0b3752
commit 99aa7d3361
43 changed files with 415 additions and 212 deletions

View File

@@ -12,6 +12,8 @@ using SqlSugar;
using Mapster;
using Microsoft.AspNetCore.Mvc;
using Yi.Framework.Auth.JwtBearer.Authorization;
using Yi.RBAC.Application.Contracts.Identity.Dtos.User;
using Yi.Framework.Core.CurrentUsers;
namespace Yi.RBAC.Application.Identity
{
@@ -31,6 +33,9 @@ namespace Yi.RBAC.Application.Identity
[Autowired]
private IUserRepository _userRepository { get; set; }
[Autowired]
private ICurrentUser _currentUser { get; set; }
/// <summary>
/// 查询用户
/// </summary>
@@ -135,6 +140,20 @@ namespace Yi.RBAC.Application.Identity
return await MapToGetOutputDtoAsync(entity);
}
/// <summary>
/// 更新个人中心
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public async Task<UserGetOutputDto> UpdateProfileAsync(ProfileUpdateInputVo input)
{
var entity = await _repository.GetByIdAsync(_currentUser.Id);
_mapper.Map(input, entity);
await _repository.UpdateAsync(entity);
var dto = _mapper.Map<UserGetOutputDto>(entity);
return dto;
}
/// <summary>
/// 更新状态
/// </summary>
@@ -142,7 +161,7 @@ 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)
public async Task<UserGetOutputDto> UpdateStateAsync([FromRoute] long id, [FromRoute] bool state)
{
var entity = await _repository.GetByIdAsync(id);
if (entity is null)