feat:furion rbac搭建
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Infrastructure.Ddd.Dtos;
|
||||
using Yi.Framework.Infrastructure.Ddd.Services;
|
||||
using Yi.Furion.Rbac.Application.System.Dtos.Menu;
|
||||
using Yi.Furion.Rbac.Core.Entities;
|
||||
|
||||
namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
{
|
||||
/// <summary>
|
||||
/// Menu服务实现
|
||||
/// </summary>
|
||||
public class MenuService : CrudAppService<MenuEntity, MenuGetOutputDto, MenuGetListOutputDto, long, MenuGetListInputVo, MenuCreateInputVo, MenuUpdateInputVo>,
|
||||
IMenuService, ITransient, IDynamicApiController
|
||||
{
|
||||
|
||||
public override async Task<PagedResultDto<MenuGetListOutputDto>> GetListAsync(MenuGetListInputVo input)
|
||||
{
|
||||
var entity = await MapToEntityAsync(input);
|
||||
|
||||
RefAsync<int> total = 0;
|
||||
|
||||
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.MenuName), x => x.MenuName.Contains(input.MenuName!))
|
||||
.WhereIF(input.State is not null, x => x.State == input.State)
|
||||
.OrderByDescending(x => x.OrderNum)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<MenuGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询当前角色的菜单
|
||||
/// </summary>
|
||||
/// <param name="roleId"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<MenuGetListOutputDto>> GetListRoleIdAsync(long roleId)
|
||||
{
|
||||
var entities = await _DbQueryable.Where(m => SqlFunc.Subqueryable<RoleMenuEntity>().Where(rm => rm.RoleId == roleId && rm.MenuId == m.Id).Any()).ToListAsync();
|
||||
|
||||
return await MapToGetListOutputDtosAsync(entities);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user