feat:furion rbac搭建
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
using SqlSugar;
|
||||
using Yi.Framework.Infrastructure.Ddd.Dtos;
|
||||
using Yi.Framework.Infrastructure.Ddd.Services;
|
||||
using Yi.Furion.Rbac.Application.System.Dtos.Dept;
|
||||
using Yi.Furion.Rbac.Core.Entities;
|
||||
|
||||
namespace Yi.Furion.Rbac.Application.System.Services.Impl
|
||||
{
|
||||
/// <summary>
|
||||
/// Dept服务实现
|
||||
/// </summary>
|
||||
public class DeptService : CrudAppService<DeptEntity, DeptGetOutputDto, DeptGetListOutputDto, long, DeptGetListInputVo, DeptCreateInputVo, DeptUpdateInputVo>,
|
||||
IDeptService, ITransient, IDynamicApiController
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 通过角色id查询该角色全部部门
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
//[Route("{roleId}")]
|
||||
public async Task<List<DeptGetListOutputDto>> GetListRoleIdAsync([FromRoute] long roleId)
|
||||
{
|
||||
var entities = await _DbQueryable.Where(d => SqlFunc.Subqueryable<RoleDeptEntity>().Where(rd => rd.RoleId == roleId && d.Id == rd.DeptId).Any()).ToListAsync();
|
||||
return await MapToGetListOutputDtosAsync(entities);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 多查
|
||||
/// </summary>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public override async Task<PagedResultDto<DeptGetListOutputDto>> GetListAsync(DeptGetListInputVo input)
|
||||
{
|
||||
RefAsync<int> total = 0;
|
||||
var entities = await _DbQueryable
|
||||
.WhereIF(!string.IsNullOrEmpty(input.DeptName), u => u.DeptName.Contains(input.DeptName!))
|
||||
.WhereIF(input.State is not null, u => u.State == input.State)
|
||||
.OrderBy(u => u.OrderNum, OrderByType.Asc)
|
||||
.ToPageListAsync(input.PageNum, input.PageSize, total);
|
||||
return new PagedResultDto<DeptGetListOutputDto>
|
||||
{
|
||||
Items = await MapToGetListOutputDtosAsync(entities),
|
||||
Total = total
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user