feat: 添加用户、角色状态修改
This commit is contained in:
@@ -128,6 +128,14 @@
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.RoleService.UpdateStateAsync(System.Int64,System.Boolean)">
|
||||
<summary>
|
||||
更新状态
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="state"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Identity.UserService">
|
||||
<summary>
|
||||
User服务实现
|
||||
@@ -163,6 +171,14 @@
|
||||
<param name="input"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:Yi.RBAC.Application.Identity.UserService.UpdateStateAsync(System.Int64,System.Boolean)">
|
||||
<summary>
|
||||
更新状态
|
||||
</summary>
|
||||
<param name="id"></param>
|
||||
<param name="state"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="T:Yi.RBAC.Application.Setting.ConfigService">
|
||||
<summary>
|
||||
Config服务实现
|
||||
|
||||
@@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Identity;
|
||||
using Yi.Framework.Uow;
|
||||
using Yi.Framework.Ddd.Dtos;
|
||||
using SqlSugar;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace Yi.RBAC.Application.Identity
|
||||
{
|
||||
@@ -80,5 +81,25 @@ namespace Yi.RBAC.Application.Identity
|
||||
}
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 更新状态
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="state"></param>
|
||||
/// <returns></returns>
|
||||
[Route("/api/role/{id}/{state}")]
|
||||
public async Task<RoleGetOutputDto> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user