fix 用户和菜单权限联合

This commit is contained in:
2024-01-08 10:35:25 +08:00
parent 82e77027e3
commit f4e401d649
22 changed files with 257 additions and 93 deletions

View File

@@ -8,6 +8,9 @@ using Dlhis.Entity.Sys.Enums;
namespace Dlhis.Sys.Menu.Controllers;
/// <summary>
/// 菜单
/// </summary>
[Authorize]
[Route("api/[controller]")]
[ApiController]
@@ -23,14 +26,11 @@ public class MenusController : ControllerBase
/// <summary>
/// 菜单列表
/// </summary>
/// <param name="platform">菜单平台类型 PlatformEnumType</param>
/// <returns></returns>
[HttpGet("list")]
public async Task<List<MenuResponse>> GetListAsync([EnumDataType(typeof(PlatformEnumType))] PlatformEnumType? platform)
public async Task<List<MenuResponse>> GetListAsync([EnumDataType(typeof(PlatformEnumType))] PlatformEnumType? platform = PlatformEnumType.PCAdmin)
{
if (!platform.HasValue)
{
platform = PlatformEnumType.UserMobile;
}
return await _menuService.GetListAsync(platform.Value);
}
@@ -59,17 +59,19 @@ public class MenusController : ControllerBase
/// <summary>
/// 当前类型的权限分配
/// </summary>
/// <param name="permissionType">权限类型</param>
/// <param name="uniqueType">权限分配类型 MenuAssignmentTypeEnumType</param>
/// <param name="uniqueValue">类型对应的唯一值</param>
/// <returns></returns>
[HttpGet("assignments")]
public async Task<List<string>> GetAssignmentsAsync([EnumDataType(typeof(MenuPermissionTypeEnumType))] MenuPermissionTypeEnumType permissionType, [Required] string uniqueValue)
public async Task<List<string>> GetAssignmentsAsync(
[EnumDataType(typeof(MenuAssignmentTypeEnumType))] MenuAssignmentTypeEnumType uniqueType,
[Required] string uniqueValue)
{
return await _menuService.GetAssignmentCodesAsync(permissionType, uniqueValue);
return await _menuService.GetAssignmentCodesAsync(uniqueType, uniqueValue);
}
/// <summary>
/// 获取所有权限分配
/// 获取我的所有权限
/// </summary>
/// <returns></returns>
[HttpGet("assignments/all")]
@@ -79,7 +81,7 @@ public class MenusController : ControllerBase
}
/// <summary>
/// 我的菜单
/// 获取我的菜单
/// </summary>
/// <returns></returns>
[HttpGet("my")]
@@ -89,7 +91,7 @@ public class MenusController : ControllerBase
}
/// <summary>
/// 重置
/// 重置所有路由
/// </summary>
/// <param name="request"></param>
/// <returns></returns>