fix 优化网格查询

This commit is contained in:
2025-04-08 14:16:33 +08:00
parent 5ae0f55c67
commit f84dee5716

View File

@@ -147,12 +147,16 @@ public class WorkGridService : IWorkGridService
.LeftJoin<GainfoEntity>((x, ga) => x.LeaderUserCode == ga.Code)
.WhereIF(!isAll, x => x.LeaderUserCode == userCode)
.WhereIF(request.Search.IsPresent(), x => x.Name.Contains(request.Search) || x.LeaderUserCode == request.Search)
.Where(x => SqlFunc.Subqueryable<WorkGridUserEntity>()
.LeftJoin<GainfoEntity>((p, pga) => p.UserCode == pga.Code)
.Where(p => p.WorkGridCode == x.Code)
.Where((p, pga) => pga.Factory == factory)
.Where(p => p.IsDeleted == false)
.Any()
.Where(x => SqlFunc.Subqueryable<GainfoEntity>()
.Where(p => p.Code == x.LeaderUserCode && p.Factory == factory)
.Any()
||
SqlFunc.Subqueryable<WorkGridUserEntity>()
.LeftJoin<GainfoEntity>((p, pga) => p.UserCode == pga.Code)
.Where(p => p.WorkGridCode == x.Code)
.Where((p, pga) => pga.Factory == factory)
.Where(p => p.IsDeleted == false)
.Any()
)
.Select((x, ga) => new WorkGridPageResponse
{