feat: 部门查询

This commit is contained in:
橙子
2023-02-10 19:49:28 +08:00
parent fdd1eda9ec
commit 5df1144cd0
2 changed files with 20 additions and 8 deletions

View File

@@ -7,16 +7,12 @@ using Yi.Framework.Ddd.Dtos;
namespace Yi.RBAC.Application.Contracts.Identity.Dtos
{
public class DeptGetListInputVo : PagedAndSortedResultRequestDto
public class DeptGetListInputVo : PagedAllResultRequestDto
{
public long Id { get; set; }
public DateTime CreationTime { get; set; } = DateTime.Now;
public long? CreatorId { get; set; }
public bool State { get; set; }
public string DeptName { get; set; }=string.Empty;
public string DeptCode { get; set; } = string.Empty;
public bool? State { get; set; }
public string? DeptName { get; set; }
public string? DeptCode { get; set; }
public string? Leader { get; set; }
public long ParentId { get; set; }
public string? Remark { get; set; }
}
}

View File

@@ -3,6 +3,8 @@ using NET.AutoWebApi.Setting;
using Yi.RBAC.Application.Contracts.Identity.Dtos;
using Yi.RBAC.Domain.Identity.Entities;
using Yi.Framework.Ddd.Services;
using Yi.Framework.Ddd.Dtos;
using SqlSugar;
namespace Yi.RBAC.Application.Identity
{
@@ -13,5 +15,19 @@ namespace Yi.RBAC.Application.Identity
public class DeptService : CrudAppService<DeptEntity, DeptGetOutputDto, DeptGetListOutputDto, long, DeptGetListInputVo, DeptCreateInputVo, DeptUpdateInputVo>,
IDeptService, IAutoApiService
{
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
};
}
}
}