fix 变更返回的人员数据

This commit is contained in:
2025-05-13 10:06:14 +08:00
parent 2a45521ed7
commit b80ea0a771

View File

@@ -23,7 +23,18 @@ public class GainfoService : IGainfoService
public async Task<List<GainfoOpenResponse>> GetAllGainfosAsync() public async Task<List<GainfoOpenResponse>> GetAllGainfosAsync()
{ {
var factories = new[] { "2401", "301", "302", "303", "304", "305", "306", "307" }; var factories = new[]
{
"1201", "1701", "1801",
"1901", "1902", "201",
"2001", "2301", "2401",
"301", "302", "303",
"304", "305", "306",
"307", "401", "501",
"502", "503", "504",
"505", "701", "601",
"1601"
};
var gainfos = await _dbContext.Queryable<GainfoEntity>() var gainfos = await _dbContext.Queryable<GainfoEntity>()
.LeftJoin<DepartmentEntity>((x, d) => x.DepartmentNo == d.No) .LeftJoin<DepartmentEntity>((x, d) => x.DepartmentNo == d.No)
@@ -40,27 +51,29 @@ public class GainfoService : IGainfoService
}) })
.ToListAsync(); .ToListAsync();
var gainfoLeaves = await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave") // var gainfoLeaves = await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave")
.LeftJoin<DepartmentEntity>((x, d) => x.DepartmentNo == d.No) // .LeftJoin<DepartmentEntity>((x, d) => x.DepartmentNo == d.No)
.Where(x => factories.Contains(x.Factory)) // .Where(x => factories.Contains(x.Factory))
.Where(x => SqlFunc.Subqueryable<GainfoEntity>() // .Where(x => SqlFunc.Subqueryable<GainfoEntity>()
.Where(p => factories.Contains(p.Factory)) // .Where(p => factories.Contains(p.Factory))
.Where(p => p.Code == x.Code) // .Where(p => p.Code == x.Code)
.NotAny() // .NotAny()
) // )
.Select((x, d) => new GainfoOpenResponse // .Select((x, d) => new GainfoOpenResponse
{ // {
Code = x.Code, // Code = x.Code,
DepartmentNo = x.DepartmentNo, // DepartmentNo = x.DepartmentNo,
DepartmentName = d.Name, // DepartmentName = d.Name,
Name = x.Name, // Name = x.Name,
Gender = x.Gender, // Gender = x.Gender,
Factory = x.Factory, // Factory = x.Factory,
Status = GainfoStatusEnumType.Leave, // Status = GainfoStatusEnumType.Leave,
}) // })
.ToListAsync(); // .ToListAsync();
//
// return gainfos.Concat(gainfoLeaves).ToList();
return gainfos.Concat(gainfoLeaves).ToList(); return gainfos;
} }
/// <inheritdoc /> /// <inheritdoc />