|
|
|
@ -9,6 +9,9 @@ using Volo.Abp.Identity;
|
|
|
|
|
|
|
|
|
|
namespace Sanhe.Abp.Identity |
|
|
|
|
{ |
|
|
|
|
/// <summary> |
|
|
|
|
/// 组织单位 |
|
|
|
|
/// </summary> |
|
|
|
|
[RemoteService(Name = IdentityRemoteServiceConsts.RemoteServiceName)] |
|
|
|
|
[Area("identity")] |
|
|
|
|
[ControllerName("organization-units")] |
|
|
|
@ -17,125 +20,215 @@ namespace Sanhe.Abp.Identity
|
|
|
|
|
{ |
|
|
|
|
protected IOrganizationUnitAppService OrganizationUnitAppService { get; } |
|
|
|
|
|
|
|
|
|
public OrganizationUnitController( |
|
|
|
|
IOrganizationUnitAppService organizationUnitAppService) |
|
|
|
|
public OrganizationUnitController(IOrganizationUnitAppService organizationUnitAppService) |
|
|
|
|
{ |
|
|
|
|
OrganizationUnitAppService = organizationUnitAppService; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 创建组织单位 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpPost] |
|
|
|
|
public virtual async Task<OrganizationUnitDto> CreateAsync(OrganizationUnitCreateDto input) |
|
|
|
|
public async virtual Task<OrganizationUnitDto> CreateAsync(OrganizationUnitCreateDto input) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.CreateAsync(input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 删除组织单位 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id">Id</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpDelete] |
|
|
|
|
[Route("{id}")] |
|
|
|
|
public virtual async Task DeleteAsync(Guid id) |
|
|
|
|
public async virtual Task DeleteAsync(Guid id) |
|
|
|
|
{ |
|
|
|
|
await OrganizationUnitAppService.DeleteAsync(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 查找子单位 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("find-children")] |
|
|
|
|
public virtual async Task<ListResultDto<OrganizationUnitDto>> FindChildrenAsync(OrganizationUnitGetChildrenDto input) |
|
|
|
|
public async virtual Task<ListResultDto<OrganizationUnitDto>> FindChildrenAsync(OrganizationUnitGetChildrenDto input) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.FindChildrenAsync(input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 获取组织单位信息 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id">Id</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("{id}")] |
|
|
|
|
public virtual async Task<OrganizationUnitDto> GetAsync(Guid id) |
|
|
|
|
public async virtual Task<OrganizationUnitDto> GetAsync(Guid id) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetAsync(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 获取根组织单位 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("root-node")] |
|
|
|
|
public virtual async Task<ListResultDto<OrganizationUnitDto>> GetRootAsync() |
|
|
|
|
public async virtual Task<ListResultDto<OrganizationUnitDto>> GetRootAsync() |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetRootAsync(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 最后一个组织节点 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="parentId">父Id</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("last-children")] |
|
|
|
|
public virtual async Task<OrganizationUnitDto> GetLastChildOrNullAsync(Guid? parentId) |
|
|
|
|
public async virtual Task<OrganizationUnitDto> GetLastChildOrNullAsync(Guid? parentId) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetLastChildOrNullAsync(parentId); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 获取所有组织单位 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("all")] |
|
|
|
|
public virtual async Task<ListResultDto<OrganizationUnitDto>> GetAllListAsync() |
|
|
|
|
public async virtual Task<ListResultDto<OrganizationUnitDto>> GetAllListAsync() |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetAllListAsync(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 分页获取 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
public virtual async Task<PagedResultDto<OrganizationUnitDto>> GetListAsync(OrganizationUnitGetByPagedDto input) |
|
|
|
|
public async virtual Task<PagedResultDto<OrganizationUnitDto>> GetListAsync(OrganizationUnitGetByPagedDto input) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetListAsync(input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 获取该组织单位所有角色名称 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id">Id</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("{id}/role-names")] |
|
|
|
|
public virtual async Task<ListResultDto<string>> GetRoleNamesAsync(Guid id) |
|
|
|
|
public async virtual Task<ListResultDto<string>> GetRoleNamesAsync(Guid id) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetRoleNamesAsync(id); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 分页获取未添加的角色 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("{id}/unadded-roles")] |
|
|
|
|
public virtual async Task<PagedResultDto<IdentityRoleDto>> GetUnaddedRolesAsync(Guid id, OrganizationUnitGetUnaddedRoleByPagedDto input) |
|
|
|
|
public async virtual Task<PagedResultDto<IdentityRoleDto>> GetUnaddedRolesAsync(Guid id, OrganizationUnitGetUnaddedRoleByPagedDto input) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetUnaddedRolesAsync(id, input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 分页获取组织单位角色 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("{id}/roles")] |
|
|
|
|
public virtual async Task<PagedResultDto<IdentityRoleDto>> GetRolesAsync(Guid id, PagedAndSortedResultRequestDto input) |
|
|
|
|
public async virtual Task<PagedResultDto<IdentityRoleDto>> GetRolesAsync(Guid id, PagedAndSortedResultRequestDto input) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetRolesAsync(id, input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 分页获取未添加的用户 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("{id}/unadded-users")] |
|
|
|
|
public virtual async Task<PagedResultDto<IdentityUserDto>> GetUnaddedUsersAsync(Guid id, OrganizationUnitGetUnaddedUserByPagedDto input) |
|
|
|
|
public async virtual Task<PagedResultDto<IdentityUserDto>> GetUnaddedUsersAsync(Guid id, OrganizationUnitGetUnaddedUserByPagedDto input) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetUnaddedUsersAsync(id, input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 分页获取组织单位下用户 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id">Id</param> |
|
|
|
|
/// <param name="input">分页参数</param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpGet] |
|
|
|
|
[Route("{id}/users")] |
|
|
|
|
public virtual async Task<PagedResultDto<IdentityUserDto>> GetUsersAsync(Guid id, GetIdentityUsersInput input) |
|
|
|
|
public async virtual Task<PagedResultDto<IdentityUserDto>> GetUsersAsync(Guid id, GetIdentityUsersInput input) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.GetUsersAsync(id, input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 指定组织单位下添加用户 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpPost] |
|
|
|
|
[Route("{id}/users")] |
|
|
|
|
public virtual async Task AddUsersAsync(Guid id, OrganizationUnitAddUserDto input) |
|
|
|
|
public async virtual Task AddUsersAsync(Guid id, OrganizationUnitAddUserDto input) |
|
|
|
|
{ |
|
|
|
|
await OrganizationUnitAppService.AddUsersAsync(id, input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 指定组织单位下添加角色 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpPost] |
|
|
|
|
[Route("{id}/roles")] |
|
|
|
|
public virtual async Task AddRolesAsync(Guid id, OrganizationUnitAddRoleDto input) |
|
|
|
|
public async virtual Task AddRolesAsync(Guid id, OrganizationUnitAddRoleDto input) |
|
|
|
|
{ |
|
|
|
|
await OrganizationUnitAppService.AddRolesAsync(id, input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 移动 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id"></param> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpPut] |
|
|
|
|
[Route("{id}/move")] |
|
|
|
|
public virtual async Task MoveAsync(Guid id, OrganizationUnitMoveDto input) |
|
|
|
|
public async virtual Task MoveAsync(Guid id, OrganizationUnitMoveDto input) |
|
|
|
|
{ |
|
|
|
|
await OrganizationUnitAppService.MoveAsync(id, input); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
/// 修改组织单位信息 |
|
|
|
|
/// </summary> |
|
|
|
|
/// <param name="id">Id</param> |
|
|
|
|
/// <param name="input"></param> |
|
|
|
|
/// <returns></returns> |
|
|
|
|
[HttpPut] |
|
|
|
|
[Route("{id}")] |
|
|
|
|
public virtual async Task<OrganizationUnitDto> UpdateAsync(Guid id, OrganizationUnitUpdateDto input) |
|
|
|
|
public async virtual Task<OrganizationUnitDto> UpdateAsync(Guid id, OrganizationUnitUpdateDto input) |
|
|
|
|
{ |
|
|
|
|
return await OrganizationUnitAppService.UpdateAsync(id, input); |
|
|
|
|
} |
|
|
|
|