feat: 添加用户、角色状态修改

This commit is contained in:
橙子
2023-02-19 22:18:04 +08:00
parent dffdaa8d68
commit 380f728de2
8 changed files with 64 additions and 6 deletions

View File

@@ -10,6 +10,7 @@ using Yi.Framework.Ddd.Dtos;
using Yi.RBAC.Domain.Identity.Repositories;
using SqlSugar;
using Mapster;
using Microsoft.AspNetCore.Mvc;
namespace Yi.RBAC.Application.Identity
{
@@ -132,5 +133,24 @@ namespace Yi.RBAC.Application.Identity
}
return await MapToGetOutputDtoAsync(entity);
}
/// <summary>
/// 更新状态
/// </summary>
/// <param name="id"></param>
/// <param name="state"></param>
/// <returns></returns>
[Route("/api/user/{id}/{state}")]
public async Task<UserGetOutputDto> UpdateStateAsync([FromRoute] long id,[FromRoute] bool state)
{
var entity = await _repository.GetByIdAsync(id);
if (entity is null)
{
throw new ApplicationException("用户未存在");
}
entity.State = state;
return await MapToGetOutputDtoAsync(entity);
}
}
}