refactor: 抽象操作日志模块
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user