diff --git a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs index 9e2aad47..301a80ab 100644 --- a/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs +++ b/Src/Dlhis.Basic/Organization/Services/Implements/GainfoService.cs @@ -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().AS("GainfoEntity", "gainfo") .Where(where) .LeftJoin((gainfo, department) => gainfo.DepartmentNo == department.No) - .LeftJoin((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((gainfo, department) => gainfo.DepartmentNo == department.No) - .LeftJoin((gainfo, department, type) => type.Code == SqlFunc.ToString(gainfo.CardType) && type.Type == "timeperiod") .WhereIF(request.SearchType.HasValue == false, gainfo => SqlFunc.Subqueryable() .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; } diff --git a/Src/Dlhis.Entity/Basic/Enums/GainfoStatusEnumType.cs b/Src/Dlhis.Entity/Basic/Enums/GainfoStatusEnumType.cs index 7745368d..78431b13 100644 --- a/Src/Dlhis.Entity/Basic/Enums/GainfoStatusEnumType.cs +++ b/Src/Dlhis.Entity/Basic/Enums/GainfoStatusEnumType.cs @@ -15,8 +15,8 @@ public enum GainfoStatusEnumType Working = 1, /// - /// 离职 + /// 归档 /// - [Description("离职")] + [Description("归档")] Leave = 2 -} +} \ No newline at end of file