diff --git a/SGGL/BLL/API/APIPersonService.cs b/SGGL/BLL/API/APIPersonService.cs index f0f1aaa6..9cdb9e4b 100644 --- a/SGGL/BLL/API/APIPersonService.cs +++ b/SGGL/BLL/API/APIPersonService.cs @@ -443,7 +443,7 @@ namespace BLL /// 培训岗位ID /// 培训类型ID /// - public static List getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId) + public static List getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId,string name) { using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString)) { @@ -482,6 +482,11 @@ namespace BLL getPersons = getPersons.Where(x => workPostIdList.Contains(x.WorkPostId)); } + if (!string.IsNullOrEmpty(name)) + { + getPersons = getPersons.Where(x => x.PersonName.Contains(name)); + } + List getTrainPersonList = new List(); var getTrainType = TrainTypeService.GetTrainTypeById(trainTypeId); if (getTrainType != null && (!getTrainType.IsRepeat.HasValue || getTrainType.IsRepeat == false)) diff --git a/SGGL/WebAPI/Controllers/PersonController.cs b/SGGL/WebAPI/Controllers/PersonController.cs index 4629fa07..de30c0c7 100644 --- a/SGGL/WebAPI/Controllers/PersonController.cs +++ b/SGGL/WebAPI/Controllers/PersonController.cs @@ -336,7 +336,38 @@ namespace WebAPI.Controllers var responeData = new Model.ResponeData(); try { - var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId,null).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); + int pageCount = getDataList.Count; + if (pageCount > 0 && pageIndex > 0) + { + getDataList = getDataList.OrderBy(u => u.UnitName).ThenBy(u => u.PersonName).Skip(Funs.PageSize * (pageIndex - 1)).Take(Funs.PageSize).ToList(); ////200 ->Funs.PageSize + } + responeData.data = new { pageCount, getDataList }; + } + catch (Exception ex) + { + responeData.code = 0; + responeData.message = ex.Message; + } + return responeData; + } + + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public Model.ResponeData getTrainingPersonListByTrainTypeId(string projectId, string unitIds, string workPostIds, string trainTypeId,string name, int pageIndex) + { + var responeData = new Model.ResponeData(); + try + { + var getDataList = APIPersonService.getTrainingPersonListByTrainTypeId(projectId, unitIds, workPostIds, trainTypeId,name).OrderBy(x => x.UnitName).ThenBy(x => x.ProjectName).ToList(); int pageCount = getDataList.Count; if (pageCount > 0 && pageIndex > 0) {