fix 离职查询
This commit is contained in:
@@ -131,43 +131,24 @@ public class GainfoService : IGainfoService
|
||||
CardType = gainfo.CardType,
|
||||
CardTypeName = type.Display
|
||||
}, true)
|
||||
: request.Status == GainfoStatusEnumType.Working
|
||||
? _dbContext.Queryable<GainfoEntity>()
|
||||
.WhereIF(request.SearchType.HasValue, where)
|
||||
.LeftJoin<DepartmentEntity>((gainfo, department) => gainfo.DepartmentNo == department.No)
|
||||
.LeftJoin<BasicTypeEntity>((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod")
|
||||
.WhereIF(request.SearchType.HasValue == false, gainfo => SqlFunc.Subqueryable<BusinessTripEntity>()
|
||||
.Where(p => p.Code == gainfo.Code && factories.Contains(p.Destination) && SqlFunc.DateIsSame(p.BeginDate, today))
|
||||
.Any())
|
||||
.WhereIF(request.Search.IsPresent(), gainfo =>
|
||||
gainfo.Name.Contains(request.Search)
|
||||
|| gainfo.Code == request.Search
|
||||
|| gainfo.IdNo == request.Search)
|
||||
.OrderByIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => gainfo.ResignationDate, OrderByType.Desc) //外包人员按离职日期倒排
|
||||
.Select((gainfo, department, type) => new GainfoPageResponse
|
||||
{
|
||||
DepartmentName = department.Name,
|
||||
CardType = gainfo.CardType,
|
||||
CardTypeName = type.Display
|
||||
}, true)
|
||||
: _dbContext.Queryable<GainfoEntity>().AS("GainfoLeave")
|
||||
.WhereIF(request.SearchType.HasValue, where)
|
||||
.LeftJoin<DepartmentEntity>((gainfo, department) => gainfo.DepartmentNo == department.No)
|
||||
.LeftJoin<BasicTypeEntity>((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod")
|
||||
.WhereIF(request.SearchType.HasValue == false, gainfo => SqlFunc.Subqueryable<BusinessTripEntity>()
|
||||
.Where(p => p.Code == gainfo.Code && factories.Contains(p.Destination) && SqlFunc.DateIsSame(p.BeginDate, today))
|
||||
.Any())
|
||||
.WhereIF(request.Search.IsPresent(), gainfo =>
|
||||
gainfo.Name.Contains(request.Search)
|
||||
|| gainfo.Code == request.Search
|
||||
|| gainfo.IdNo == request.Search)
|
||||
.OrderByIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => gainfo.ResignationDate, OrderByType.Desc) //外包人员按离职日期倒排
|
||||
.Select((gainfo, department, type) => new GainfoPageResponse
|
||||
{
|
||||
DepartmentName = department.Name,
|
||||
CardType = gainfo.CardType,
|
||||
CardTypeName = type.Display
|
||||
}, true);
|
||||
: _gainfoStore.Queryable(request.Status)
|
||||
.WhereIF(request.SearchType.HasValue, where)
|
||||
.LeftJoin<DepartmentEntity>((gainfo, department) => gainfo.DepartmentNo == department.No)
|
||||
.LeftJoin<BasicTypeEntity>((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod")
|
||||
.WhereIF(request.SearchType.HasValue == false, gainfo => SqlFunc.Subqueryable<BusinessTripEntity>()
|
||||
.Where(p => p.Code == gainfo.Code && factories.Contains(p.Destination) && SqlFunc.DateIsSame(p.BeginDate, today))
|
||||
.Any())
|
||||
.WhereIF(request.Search.IsPresent(), gainfo =>
|
||||
gainfo.Name.Contains(request.Search)
|
||||
|| gainfo.Code == request.Search
|
||||
|| gainfo.IdNo == request.Search)
|
||||
.OrderByIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => gainfo.ResignationDate, OrderByType.Desc) //外包人员按离职日期倒排
|
||||
.Select((gainfo, department, type) => new GainfoPageResponse
|
||||
{
|
||||
DepartmentName = department.Name,
|
||||
CardType = gainfo.CardType,
|
||||
CardTypeName = type.Display
|
||||
}, true);
|
||||
|
||||
var page = await queryable.ToPageListAsync(request);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user