feat 获取部门下一级,扩展方法错误

This commit is contained in:
2024-06-11 16:46:26 +08:00
parent 1975e37294
commit 5141ce601c
5 changed files with 29 additions and 5 deletions

View File

@@ -29,4 +29,15 @@ public class DepartmentsController : ControllerBase
{
return await _departmentService.GetTreeAsync();
}
}
/// <summary>
/// 获取下一级
/// </summary>
/// <param name="nextNo"></param>
/// <returns></returns>
[HttpGet("next")]
public async Task<List<DepartmentTreeResponse>> GetNextListAsync(string nextNo)
{
return await _departmentService.GetNextListAsync(nextNo);
}
}

View File

@@ -33,7 +33,7 @@ public class GainfoOutsourceRequest
/// <summary>
/// 生日
/// </summary>
public DateTime Birthday { get; set; }
public DateTime? Birthday { get; set; }
/// <summary>
/// 手机号码

View File

@@ -5,4 +5,6 @@ namespace Dlhis.Basic.Organization.Services;
public interface IDepartmentService : IScopeDependency
{
Task<List<DepartmentTreeResponse>> GetTreeAsync();
}
Task<List<DepartmentTreeResponse>> GetNextListAsync(string nextNo);
}

View File

@@ -1,6 +1,7 @@
using Dlhis.Basic.Organization.Response;
using Dlhis.Entity.Basic.Entity;
using Kurisu.AspNetCore.DataAccess.SqlSugar.Services;
using Kurisu.AspNetCore.Utils.Extensions;
namespace Dlhis.Basic.Organization.Services.Implements;
@@ -23,6 +24,16 @@ public class DepartmentService : IDepartmentService
return tops;
}
public async Task<List<DepartmentTreeResponse>> GetNextListAsync(string nextNo)
{
return await _dbContext.Queryable<DepartmentEntity>()
.WhereIF(nextNo.IsPresent(), x => x.PNo == nextNo)
.WhereIF(nextNo.IsEmpty(), x => x.PNo == "00001000")
.Select<DepartmentTreeResponse>()
.ToListAsync();
}
//***************************************************** help methods ****************************************************************
private static void RecursionGetNext(DepartmentTreeResponse current, List<DepartmentTreeResponse> data)

View File

@@ -70,8 +70,8 @@ public class GainfoService : IGainfoService
}
var page = await _gainfoStore.Queryable(request.Status)
.WhereIF(request.DepartmentSelections.IsPresent(), where)
.WhereIF(request.DepartmentSelections.IsEmpty(), gainfo => gainfo.Factory == currentTenantId)
.WhereIF(request.DepartmentSelections?.Any() == true, where)
.WhereIF(request.DepartmentSelections?.Any() != true, gainfo => gainfo.Factory == currentTenantId)
.WhereIF(request.IsOutsource.HasValue && request.IsOutsource.Value, gainfo => SqlFunc.Subqueryable<OutsourceEntity>().Where(x => x.Code == gainfo.Code).Any())
.WhereIF(request.IsOutsource.HasValue && !request.IsOutsource.Value, gainfo => SqlFunc.Subqueryable<OutsourceEntity>().Where(x => x.Code == gainfo.Code).NotAny())
.WhereIF(request.Search.IsPresent(), gainfo =>