fix 外包人员查询部门和备注
This commit is contained in:
@@ -89,7 +89,7 @@ public class GainfoService : IGainfoService
|
||||
|
||||
if (request.SearchType.HasValue)
|
||||
{
|
||||
GainfoUserTypeEnumType userTypeEnumType = request.SearchType switch
|
||||
GainfoUserTypeEnumType userType = request.SearchType switch
|
||||
{
|
||||
GainfoSearchEnumType.Internal => GainfoUserTypeEnumType.Normal,
|
||||
GainfoSearchEnumType.Outsource => GainfoUserTypeEnumType.Outsource,
|
||||
@@ -98,27 +98,12 @@ public class GainfoService : IGainfoService
|
||||
null => throw new ArgumentOutOfRangeException(request.SearchType?.ToString()),
|
||||
_ => throw new ArgumentOutOfRangeException(request.SearchType?.ToString())
|
||||
};
|
||||
where = where.And(gainfo => gainfo.Type == userTypeEnumType);
|
||||
|
||||
where = where.And(gainfo => gainfo.Type == userType);
|
||||
}
|
||||
|
||||
|
||||
if (request.IsSearchAll)
|
||||
{
|
||||
where = Expressionable.Create<GainfoEntity>()
|
||||
.And(where)
|
||||
.Or(gainfo => SqlFunc.Subqueryable<BusinessTripEntity>()
|
||||
.Where(p => p.Code == gainfo.Code
|
||||
&& factories.Contains(p.Destination)
|
||||
&& SqlFunc.DateIsSame(p.BeginDate, today))
|
||||
.Any()
|
||||
)
|
||||
.ToExpression();
|
||||
}
|
||||
|
||||
|
||||
ISugarQueryable<GainfoPageResponse> queryable = request.IsSearchAll
|
||||
? _dbContext.Queryable<GainfoEntity>().AS("GainfoEntity", "gainfo")
|
||||
.Where(where)
|
||||
.LeftJoin<DepartmentEntity>((gainfo, department) => gainfo.DepartmentNo == department.No)
|
||||
.WhereIF(request.Search.IsPresent(), gainfo =>
|
||||
gainfo.Name == request.Search
|
||||
@@ -127,18 +112,24 @@ public class GainfoService : IGainfoService
|
||||
.Select((gainfo, department) => new GainfoPageResponse
|
||||
{
|
||||
DepartmentName = department.Name,
|
||||
CardType = gainfo.CardType,
|
||||
CardType = gainfo.CardType
|
||||
}, true)
|
||||
: _gainfoStore.Queryable(request.Status)
|
||||
.WhereIF(request.SearchType.HasValue == true, where)
|
||||
.WhereIF(request.SearchType.HasValue, where)
|
||||
.LeftJoin<DepartmentEntity>((gainfo, department) => gainfo.DepartmentNo == department.No)
|
||||
.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)
|
||||
.WhereIF(request.Search.IsPresent() && request.SearchType != GainfoSearchEnumType.Outsource, gainfo =>
|
||||
gainfo.Code == request.Search
|
||||
|| gainfo.IdNo == request.Search
|
||||
|| gainfo.Name.Contains(request.Search))
|
||||
.WhereIF(request.Search.IsPresent() && request.SearchType == GainfoSearchEnumType.Outsource, gainfo =>
|
||||
gainfo.Code == request.Search
|
||||
|| gainfo.IdNo == request.Search
|
||||
|| gainfo.Name.Contains(request.Search)
|
||||
|| gainfo.Remark.Contains(request.Search)
|
||||
|| SqlFunc.Subqueryable<OutsourceEntity>().Where(p => p.Code == gainfo.Code && p.Supplier.Contains(request.Search)).Any())
|
||||
.OrderByIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => gainfo.ResignationDate, OrderByType.Desc) //外包人员按离职日期倒排
|
||||
.Select((gainfo, department) => new GainfoPageResponse
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user