//
namespace SafeCampus.Web.Core;
///
/// 用户管理控制器
///
[ApiDescriptionSettings(Tag = "用户管理")]
[Route("sys/organization/[controller]")]
[SuperAdmin]
public class UserController : BaseController
{
private readonly ISysUserService _sysUserService;
private readonly ISysOrgService _sysOrgService;
private readonly ISysPositionService _sysPositionService;
private readonly ISysRoleService _sysRoleService;
public UserController(ISysUserService sysUserService, ISysOrgService sysOrgService, ISysPositionService sysPositionService,
ISysRoleService sysRoleService)
{
_sysUserService = sysUserService;
_sysOrgService = sysOrgService;
_sysPositionService = sysPositionService;
_sysRoleService = sysRoleService;
}
#region Get请求
///
/// 用户分页查询
///
///
///
[HttpGet("page")]
public async Task Page([FromQuery] UserPageInput input)
{
return await _sysUserService.Page(input);
}
///
/// 获取用户选择器
///
///
///
[HttpGet("selector")]
public async Task Selector([FromQuery] UserSelectorInput input)
{
return await _sysUserService.Selector(input);
}
///
/// 获取用户拥有角色
///
///
///
[HttpGet("ownRole")]
public async Task OwnRole([FromQuery] BaseIdInput input)
{
return await _sysUserService.OwnRole(input);
}
///
/// 获取用户拥有资源
///
///
///
[HttpGet("ownResource")]
public async Task OwnResource([FromQuery] BaseIdInput input)
{
return await _sysUserService.OwnResource(input);
}
///
/// 获取用户拥有权限
///
///
///
[HttpGet("ownPermission")]
public async Task OwnPermission([FromQuery] BaseIdInput input)
{
return await _sysUserService.OwnPermission(input);
}
///
/// 获取权限授权树
///
///
[HttpGet("permissionTreeSelector")]
public async Task PermissionTreeSelector([FromQuery] BaseIdInput input)
{
return await _sysUserService.UserPermissionTreeSelector(input);
}
///
/// 导入预览
///
///
///
[HttpPost("preview")]
[DisableRequestSizeLimit]
[SuppressMonitor]
public async Task Preview([FromForm] ImportPreviewInput input)
{
return await _sysUserService.Preview(input);
}
///
/// 模板下载
///
///
[HttpGet(template: "template")]
[SuppressMonitor]
public async Task Template()
{
return await _sysUserService.Template();
}
///
/// 用户详情
///
///
///
[HttpGet("detail")]
[DisplayName("用户详情")]
public async Task Detail([FromQuery] BaseIdInput input)
{
return await _sysUserService.Detail(input);
}
#endregion Get请求
#region Post请求
///
/// 添加用户
///
///
///
[HttpPost("add")]
[DisplayName("添加用户")]
public async Task Add([FromBody] UserAddInput input)
{
await _sysUserService.Add(input);
}
///
/// 修改用户
///
///
///
[HttpPost("edit")]
[DisplayName("修改用户")]
public async Task Edit([FromBody] UserEditInput input)
{
await _sysUserService.Edit(input);
}
///
/// 批量修改用户
///
///
///
[HttpPost("edits")]
[DisplayName("批量修改用户")]
public async Task Edits([FromBody] BatchEditInput input)
{
await _sysUserService.Edits(input);
}
///
/// 删除用户
///
///
///
[HttpPost("delete")]
[DisplayName("删除用户")]
public async Task Delete([FromBody] BaseIdListInput input)
{
await _sysUserService.Delete(input);
}
///
/// 禁用用户
///
///
///
[HttpPost("disableUser")]
[DisplayName("禁用用户")]
public async Task DisableUser([FromBody] BaseIdInput input)
{
await _sysUserService.DisableUser(input);
}
///
/// 启用用户
///
///
///
[HttpPost("enableUser")]
[DisplayName("启用用户")]
public async Task EnableUser([FromBody] BaseIdInput input)
{
await _sysUserService.EnableUser(input);
}
///
/// 重置密码
///
///
///
[HttpPost("resetPassword")]
[DisplayName("重置密码")]
public async Task ResetPassword([FromBody] BaseIdInput input)
{
await _sysUserService.ResetPassword(input);
}
///
/// 给用户授权角色
///
///
///
[HttpPost("grantRole")]
[DisplayName("授权角色")]
public async Task GrantRole([FromBody] UserGrantRoleInput input)
{
await _sysUserService.GrantRole(input);
}
///
/// 给用户授权资源
///
///
///
[HttpPost("grantResource")]
[DisplayName("用户授权资源")]
public async Task GrantResource([FromBody] UserGrantResourceInput input)
{
await _sysUserService.GrantResource(input);
}
///
/// 给用户授权权限
///
///
///
[HttpPost("grantPermission")]
[DisplayName("用户授权权限")]
public async Task GrantPermission([FromBody] GrantPermissionInput input)
{
await _sysUserService.GrantPermission(input);
}
///
/// 用户导入
///
///
///
[HttpPost("import")]
[DisplayName("用户导入")]
public async Task Import([SuppressMonitor][FromBody] ImportResultInput input)
{
return await _sysUserService.Import(input);
}
///
/// 用户导出
///
///
///
[HttpPost("export")]
[DisplayName("用户导出")]
public async Task Export([FromBody] UserPageInput input)
{
return await _sysUserService.Export(input);
}
#endregion Post请求
}