feat 根据code查询所有档案
This commit is contained in:
@@ -46,6 +46,17 @@ public class GainfosController : ControllerBase
|
||||
return await _gainfoService.GetPageAsync(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 档案分页(所有人)
|
||||
/// </summary>
|
||||
/// <param name="code"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost("page-all")]
|
||||
public async Task<Pagination<GainfoAllPageResponse>> GetPageByCodeAsync(string code)
|
||||
{
|
||||
return await _gainfoService.GetPageByCodeAsync(code);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 当前人员信息,余额
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
namespace Dlhis.Basic.Organization.Response;
|
||||
|
||||
public class GainfoAllPageResponse
|
||||
{
|
||||
public string No { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 姓名
|
||||
/// </summary>
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工号
|
||||
/// </summary>
|
||||
public string Code { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工作地
|
||||
/// </summary>
|
||||
public string Workplace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
public string Factory { get; set; }
|
||||
}
|
||||
@@ -9,6 +9,8 @@ public interface IGainfoService : IScopeDependency
|
||||
{
|
||||
Task<Pagination<GainfoPageResponse>> GetPageAsync(GainfoPageRequest request);
|
||||
|
||||
Task<Pagination<GainfoAllPageResponse>> GetPageByCodeAsync(string code);
|
||||
|
||||
Task SaveAsync(List<GainfoSaveRequest> requests);
|
||||
|
||||
Task UpdateAsync(GainfoSaveRequest request);
|
||||
|
||||
@@ -4,6 +4,7 @@ using Dlhis.Basic.Organization.Response;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Dlhis.Entity.Basic.Enums;
|
||||
using Dlhis.Entity.Device.Enums;
|
||||
using Dlhis.Sys.Api;
|
||||
using Kurisu.AspNetCore.Utils;
|
||||
using Kurisu.AspNetCore.Utils.Extensions;
|
||||
using Kurisu.Core.DataAccess.Dto;
|
||||
@@ -26,6 +27,7 @@ public class GainfoService : IGainfoService
|
||||
private readonly RedisCache _redisCache;
|
||||
private readonly IServiceProvider _serviceProvider;
|
||||
private readonly IConfiguration _configuration;
|
||||
private readonly ITenantApi _tenantApi;
|
||||
private readonly ILogger<GainfoService> _logger;
|
||||
|
||||
public GainfoService(IGainfoStore gainfoStore,
|
||||
@@ -35,8 +37,8 @@ public class GainfoService : IGainfoService
|
||||
RedisCache redisCache,
|
||||
IServiceProvider serviceProvider,
|
||||
IConfiguration configuration,
|
||||
ILogger<GainfoService> logger,
|
||||
IDepartmentService departmentService)
|
||||
ITenantApi tenantApi,
|
||||
ILogger<GainfoService> logger)
|
||||
{
|
||||
_gainfoStore = gainfoStore;
|
||||
_dbContext = dbContext;
|
||||
@@ -45,6 +47,7 @@ public class GainfoService : IGainfoService
|
||||
_redisCache = redisCache;
|
||||
_serviceProvider = serviceProvider;
|
||||
_configuration = configuration;
|
||||
_tenantApi = tenantApi;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
@@ -83,6 +86,26 @@ public class GainfoService : IGainfoService
|
||||
return page;
|
||||
}
|
||||
|
||||
public async Task<Pagination<GainfoAllPageResponse>> GetPageByCodeAsync(string code)
|
||||
{
|
||||
var page = await _gainfoStore.Queryable()
|
||||
.Where(x => x.Code == code)
|
||||
.Select<GainfoAllPageResponse>()
|
||||
.ToPageListAsync(new PageDto { PageIndex = 1, PageSize = 1 });
|
||||
|
||||
|
||||
var tenantsResult = await _tenantApi.GetTenantsInternalAsync();
|
||||
var tenants = tenantsResult.Data;
|
||||
|
||||
page.Data.ForEach(x =>
|
||||
{
|
||||
x.Workplace = tenants.FirstOrDefault(item => item.Code == x.Workplace)?.Name;
|
||||
x.Factory = tenants.FirstOrDefault(item => item.Code == x.Factory)?.Name;
|
||||
});
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///保存档案号
|
||||
/// </summary>
|
||||
@@ -508,5 +531,4 @@ public class GainfoService : IGainfoService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user