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()
{
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>()
.LeftJoin<DepartmentEntity>((x, d) => x.DepartmentNo == d.No)
@@ -40,27 +51,29 @@ public class GainfoService : IGainfoService
})
.ToListAsync();
var gainfoLeaves = await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave")
.LeftJoin<DepartmentEntity>((x, d) => x.DepartmentNo == d.No)
.Where(x => factories.Contains(x.Factory))
.Where(x => SqlFunc.Subqueryable<GainfoEntity>()
.Where(p => factories.Contains(p.Factory))
.Where(p => p.Code == x.Code)
.NotAny()
)
.Select((x, d) => new GainfoOpenResponse
{
Code = x.Code,
DepartmentNo = x.DepartmentNo,
DepartmentName = d.Name,
Name = x.Name,
Gender = x.Gender,
Factory = x.Factory,
Status = GainfoStatusEnumType.Leave,
})
.ToListAsync();
// var gainfoLeaves = await _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave")
// .LeftJoin<DepartmentEntity>((x, d) => x.DepartmentNo == d.No)
// .Where(x => factories.Contains(x.Factory))
// .Where(x => SqlFunc.Subqueryable<GainfoEntity>()
// .Where(p => factories.Contains(p.Factory))
// .Where(p => p.Code == x.Code)
// .NotAny()
// )
// .Select((x, d) => new GainfoOpenResponse
// {
// Code = x.Code,
// DepartmentNo = x.DepartmentNo,
// DepartmentName = d.Name,
// Name = x.Name,
// Gender = x.Gender,
// Factory = x.Factory,
// Status = GainfoStatusEnumType.Leave,
// })
// .ToListAsync();
//
// return gainfos.Concat(gainfoLeaves).ToList();
return gainfos.Concat(gainfoLeaves).ToList();
return gainfos;
}
/// <inheritdoc />