fix 查询优化
This commit is contained in:
@@ -4,7 +4,10 @@ namespace Dlhis.Basic.Organization.Request;
|
||||
|
||||
public class TenantDepartmentRequest
|
||||
{
|
||||
[Required]
|
||||
/// <summary>
|
||||
/// 厂区/基地/租户
|
||||
/// </summary>
|
||||
[Required(ErrorMessage = "厂区不能为空")]
|
||||
public string Tenant { get; set; }
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -105,11 +105,6 @@ public class GainfoDetailResponse
|
||||
/// </summary>
|
||||
public string CostId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 已婚/未婚
|
||||
/// </summary>
|
||||
public string Marital { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 国家
|
||||
/// </summary>
|
||||
@@ -120,16 +115,16 @@ public class GainfoDetailResponse
|
||||
/// </summary>
|
||||
public string NationName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 人脸base64
|
||||
/// </summary>
|
||||
public string Face { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区
|
||||
/// </summary>
|
||||
public string Factory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 工作地
|
||||
/// </summary>
|
||||
public string Workplace { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 厂区名称
|
||||
/// </summary>
|
||||
@@ -138,5 +133,14 @@ public class GainfoDetailResponse
|
||||
/// <summary>
|
||||
/// 入职日期
|
||||
/// </summary>
|
||||
public DateTime OnboardingDate { get; set; }
|
||||
public DateTime? EntryDate { get; set; }
|
||||
|
||||
|
||||
|
||||
//***********************************************************************************************************************
|
||||
|
||||
/// <summary>
|
||||
/// 人脸base64
|
||||
/// </summary>
|
||||
public string Face { get; set; }
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ using Kurisu.SqlSugar.Services;
|
||||
using Mapster;
|
||||
using Microsoft.AspNetCore.DataProtection;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Linq.Expressions;
|
||||
|
||||
namespace Dlhis.Basic.Organization.Services.Implements;
|
||||
|
||||
@@ -61,7 +60,7 @@ public class GainfoService : IGainfoService
|
||||
var currentTenantId = _currentUser.GetStringTenantId();
|
||||
|
||||
//根据组织架构搜索档案
|
||||
Expression<Func<GainfoEntity, bool>> where = LinqExpressionExtensions.False<GainfoEntity>();
|
||||
var where = LinqExpressionExtensions.False<GainfoEntity>();
|
||||
foreach (var item in request.DepartmentSelections)
|
||||
{
|
||||
var depts = await GetRecursionDepartmentNosAsync(item.DepartmentNos);
|
||||
@@ -449,13 +448,15 @@ public class GainfoService : IGainfoService
|
||||
Degree = ga.Degree,
|
||||
Werks = ga.Werks,
|
||||
CostId = ga.CostId,
|
||||
Marital = "未知",
|
||||
NativeName = ga.Native,
|
||||
CountryName = ga.CountryNo,
|
||||
NationName = ga.Nation,
|
||||
ClassName = ga.IdClass,
|
||||
|
||||
EntryDate = ga.EntryDate,
|
||||
|
||||
Workplace = ga.Workplace,
|
||||
Factory = ga.Factory,
|
||||
OnboardingDate = ga.CreateTime,
|
||||
|
||||
DepartmentName = de.Name,
|
||||
Position = pos.Name,
|
||||
@@ -477,9 +478,18 @@ public class GainfoService : IGainfoService
|
||||
info.Face = await _dbContext.ChangeDb("face").Queryable<GainfoFaceEntity>().Where(x => x.UserCode == info.Code).Select(x => x.Face).SingleAsync();
|
||||
}
|
||||
|
||||
var tenantsResult = await _tenantApi.GetTenantsInternalAsync();
|
||||
var tenants = tenantsResult.Data;
|
||||
info.FactoryName = tenants.FirstOrDefault(x => x.Code == info.Factory)?.Name;
|
||||
try
|
||||
{
|
||||
var tenantsResult = await _tenantApi.GetTenantsInternalAsync();
|
||||
var tenants = tenantsResult.Data;
|
||||
|
||||
info.Workplace = tenants.FirstOrDefault(x => x.Code == info.Workplace)?.Name;
|
||||
info.Factory = tenants.FirstOrDefault(x => x.Code == info.Factory)?.Name;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
@@ -546,9 +556,10 @@ public class GainfoService : IGainfoService
|
||||
|
||||
return departmentNos.Distinct().ToList();
|
||||
|
||||
void RecursionGetNext(string currentCode, List<DepartmentEntity> departments, List<string> result)
|
||||
//local method
|
||||
void RecursionGetNext(string currentNo, List<DepartmentEntity> departments, List<string> result)
|
||||
{
|
||||
var next = departments.Where(x => x.PNo == currentCode).ToList();
|
||||
var next = departments.Where(x => x.PNo == currentNo).ToList();
|
||||
|
||||
foreach (var item in next)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user