public List <ExceptStudentSearchMiddle> SearchExceptStudengSearchService(ExceptStudengSearchInfoVIewModel exceptStudentSearchInfoVIewModel) { var resultsearch = exceptStudentRepository.searchByemploytoclass(exceptStudentSearchInfoVIewModel); var result = _IMapper.Map <List <Except_Info_Student>, List <ExceptStudentSearchMiddle> >(resultsearch); return(result); }
public List <Except_Info_Student> searchByemploytoclass(ExceptStudengSearchInfoVIewModel exceptStudentSearchInfoVIewModel) { var preciate = GetByModelWhere(exceptStudentSearchInfoVIewModel); List <Except_Info_Student> Except_Info_Students = new List <Except_Info_Student>(); if (exceptStudentSearchInfoVIewModel.RoleID == "sys") { var tempresult = DbSet.Where(preciate).Include(a => a.student_Info).Include(m => m.UserFiles_Info).ToList(); Except_Info_Students.AddRange(tempresult); } else { var searchResult = Db.ClassManager_Relate .Where(a => a.facultystaff_InfoId == exceptStudentSearchInfoVIewModel.userKey) .Include(a => a.Class_Info).ToList(); for (int i = 0; i < searchResult.Count(); i++)//通过班级code查询 { if (searchResult[i].Class_Info.ClassCode != null) { var tempresult = DbSet.Where(a => a.student_Info.ClassCode == searchResult[i].Class_Info.ClassCode) .Where(preciate).Include(a => a.student_Info).Include(m => m.UserFiles_Info).ToList(); Except_Info_Students.AddRange(tempresult); } } } //先找到这个人所负责的所有班级 return(Except_Info_Students.OrderByDescending(a => a.CreateDate).ToList()); }
public ActionResult <ExceptStudentSearchResModel> ExceptStudengSearch(ExceptStudengSearchInfoVIewModel exceptStudentSearchInfoVIewModel) { ExceptStudentSearchResModel exceptStudentSearchResModel = new ExceptStudentSearchResModel(); var result = exceptStudentService.SearchExceptStudengSearchService(exceptStudentSearchInfoVIewModel); exceptStudentSearchResModel.IsSuccess = true; exceptStudentSearchResModel.exceptStudentSearchMiddles = result; exceptStudentSearchResModel.baseViewModel.Message = "查询成功"; exceptStudentSearchResModel.baseViewModel.ResponseCode = 200; return(Ok(exceptStudentSearchResModel)); }
public Expression <Func <Except_Info_Student, bool> > GetByModelWhere(ExceptStudengSearchInfoVIewModel exceptStudengSearchInfoVIewModel) { var predicate = WhereExtension.True <Except_Info_Student>();//初始化where表达式SchoolName //姓 predicate = predicate.And(p => p.student_Info.SchoolCode.Contains(exceptStudengSearchInfoVIewModel.SchoolCode)); predicate = predicate.And(p => p.student_Info.ClassCode.Contains(exceptStudengSearchInfoVIewModel.ClassCode)); predicate = predicate.And(p => p.student_Info.GradeCode.Contains(exceptStudengSearchInfoVIewModel.GradeCode)); predicate = predicate.And(p => p.CreateDate.ToString().Contains(exceptStudengSearchInfoVIewModel.CreateDate)); predicate = predicate.And(p => p.Name.Contains(exceptStudengSearchInfoVIewModel.Name)); predicate = predicate.And(p => p.Temperature.Contains(exceptStudengSearchInfoVIewModel.Temperature)); return(predicate); }