fix 重复字段问题
This commit is contained in:
@@ -98,7 +98,7 @@ public class GainfoService : IGainfoService
|
||||
null => throw new ArgumentOutOfRangeException(request.SearchType?.ToString()),
|
||||
_ => throw new ArgumentOutOfRangeException(request.SearchType?.ToString())
|
||||
};
|
||||
where = where.And(x => x.Type == userTypeEnumType);
|
||||
where = where.And(gainfo => gainfo.Type == userTypeEnumType);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,21 +120,18 @@ public class GainfoService : IGainfoService
|
||||
? _dbContext.Queryable<GainfoEntity>().AS("GainfoEntity", "gainfo")
|
||||
.Where(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.Search.IsPresent(), gainfo =>
|
||||
gainfo.Name == request.Search
|
||||
|| gainfo.Code == request.Search
|
||||
|| gainfo.IdNo == request.Search)
|
||||
.Select((gainfo, department, type) => new GainfoPageResponse
|
||||
.Select((gainfo, department) => new GainfoPageResponse
|
||||
{
|
||||
DepartmentName = department.Name,
|
||||
CardType = gainfo.CardType,
|
||||
CardTypeName = type.Display
|
||||
}, true)
|
||||
: _gainfoStore.Queryable(request.Status)
|
||||
.WhereIF(request.SearchType.HasValue, where)
|
||||
.WhereIF(request.SearchType.HasValue == true, 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())
|
||||
@@ -143,11 +140,10 @@ public class GainfoService : IGainfoService
|
||||
|| gainfo.Code == request.Search
|
||||
|| gainfo.IdNo == request.Search)
|
||||
.OrderByIF(request.SearchType == GainfoSearchEnumType.Outsource, gainfo => gainfo.ResignationDate, OrderByType.Desc) //外包人员按离职日期倒排
|
||||
.Select((gainfo, department, type) => new GainfoPageResponse
|
||||
.Select((gainfo, department) => new GainfoPageResponse
|
||||
{
|
||||
DepartmentName = department.Name,
|
||||
CardType = gainfo.CardType,
|
||||
CardTypeName = type.Display
|
||||
CardType = gainfo.CardType
|
||||
}, true);
|
||||
|
||||
var page = await queryable.ToPageListAsync(request);
|
||||
@@ -164,6 +160,20 @@ public class GainfoService : IGainfoService
|
||||
page.Data.ForEach(item => { item.DepartmentName = outsourceInfos.FirstOrDefault(x => x.Code == item.Code)?.Supplier; });
|
||||
}
|
||||
|
||||
|
||||
page.Data.ForEach(gainfo =>
|
||||
{
|
||||
if (gainfo.CardType == 1 || gainfo.CardType == 0 || gainfo.CardType.HasValue == false)
|
||||
gainfo.CardTypeName = "全时段";
|
||||
|
||||
gainfo.CardTypeName = gainfo.CardType switch
|
||||
{
|
||||
2 => "行政卡",
|
||||
3 => "车间卡",
|
||||
_ => gainfo.CardTypeName
|
||||
};
|
||||
});
|
||||
|
||||
return page;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ public enum GainfoStatusEnumType
|
||||
Working = 1,
|
||||
|
||||
/// <summary>
|
||||
/// 离职
|
||||
/// 归档
|
||||
/// </summary>
|
||||
[Description("离职")]
|
||||
[Description("归档")]
|
||||
Leave = 2
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user