feat: 完成查询动态条件筛选,做一个快乐的crud boy

This commit is contained in:
橙子
2023-02-19 17:18:52 +08:00
parent 0566606bfb
commit 1f33204697
9 changed files with 76 additions and 41 deletions

View File

@@ -6,6 +6,8 @@ using Yi.Framework.Ddd.Services;
using Yi.RBAC.Domain.Identity;
using Microsoft.AspNetCore.Identity;
using Yi.Framework.Uow;
using Yi.Framework.Ddd.Dtos;
using SqlSugar;
namespace Yi.RBAC.Application.Identity
{
@@ -22,6 +24,20 @@ namespace Yi.RBAC.Application.Identity
[Autowired]
private IUnitOfWorkManager _unitOfWorkManager { get; set; }
public override async Task<PagedResultDto<RoleGetListOutputDto>> GetListAsync(RoleGetListInputVo input)
{
var entity = await MapToEntityAsync(input);
RefAsync<int> total = 0;
var entities = await _DbQueryable.WhereIF(!string.IsNullOrEmpty(input.RoleCode), x => x.RoleCode.Contains(input.RoleCode!))
.WhereIF(!string.IsNullOrEmpty(input.RoleName), x => x.RoleName.Contains(input.RoleName!))
.WhereIF(input.State is not null, x => x.State == input.State)
.ToPageListAsync(input.PageNum, input.PageSize, total);
return new PagedResultDto<RoleGetListOutputDto>(total, await MapToGetListOutputDtosAsync(entities));
}
/// <summary>
/// 添加角色
/// </summary>