/// <summary> /// 根据查询条件获取岗位分页列表 /// </summary> public PagedResultDto <JobPostListDto> GetPagedJobPosts(GetJobPostInput input) { var query = from a in _jobPostRepository.GetAll() join b in userservice.GetAll() on a.CreatorUserId equals b.Id into c from d in c.DefaultIfEmpty() select new JobPostListDto { Id = a.Id, Name = a.Name, CreationTime = a.CreationTime, Enabled = a.Enabled, Sort = a.Sort, CreationName = d.DisplayName }; //TODO:根据传入的参数添加过滤条件 query = query.WhereIf(!input.FilterText.IsNullOrWhiteSpace(), item => item.Name.Contains(input.FilterText)); var jobPostCount = query.Count(); var jobPosts = query .OrderByDescending(t => t.CreationTime) .PageBy(input) .ToList(); var jobPostListDtos = jobPosts.MapTo <List <JobPostListDto> >(); return(new PagedResultDto <JobPostListDto>(jobPostCount, jobPostListDtos)); }
public ActionResult Index() { var model = new GetJobPostInput { FilterText = Request.QueryString["filterText"] }; return(View(model)); }
/// <summary> /// 岗位分布页 /// </summary> /// <param name="keyword"></param> /// <param name="pIndex"></param> /// <returns></returns> public ActionResult GetJobPostDataList(string keyword, int pIndex = 1) { ViewBag.pageName = "GetJobPostDataList"; var input = new GetJobPostInput() { FilterText = keyword, SkipCount = (pIndex - 1) * PageSize, MaxResultCount = PageSize }; var pagedata = jobPostService.GetPagedJobPosts(input); GetPageData(pagedata.TotalCount); return(PartialView("Shared/JobPostDataList", pagedata.Items)); }
public async Task <PagedResultDto <JobPostListDto> > GetPositionForHome(GetJobPostInput input) { var query = _jobPostRepository.GetAll(); //TODO:根据传入的参数添加过滤条件 var jobPositionCount = await query.CountAsync(); var jobPositions = await query.OrderBy(input.Sorting).Skip((input.page - 1) * 10).Take(10).ToListAsync(); //.OrderBy(input.Sorting) //.PageBy(input) //.ToListAsync(); var jobPositionListDtos = jobPositions.MapTo <List <JobPostListDto> >(); return(new PagedResultDto <JobPostListDto>( jobPositionCount / 10 + 1, jobPositionListDtos )); }
/// <summary> /// 根据查询条件获取职位发布分页列表 /// </summary> public async Task <PagedResultDto <JobPostListDto> > GetPagedJobPosts(GetJobPostInput input) { try { var _companyid = Convert.ToInt32(_IAbpSession.UserId); //var query = _jobPostRepositoryAsNoTrack.Where(t=>t.CompanyId==_companyid); var query = from post in _jobPostRepositoryAsNoTrack.Where(t => t.CompanyId == _companyid) join urgent in _jobUrgentRepository.GetAll().Where(a => a.isDelete == false) on post.Id equals urgent.JobId into PostUrgent from urgent in PostUrgent.DefaultIfEmpty() select new { Post = post, //Urgent = urgent JobId = urgent != null ? urgent.JobId :0, Weight = urgent != null ? urgent.Weight : 0, State = urgent != null ? urgent.State : 0, }; var jobPostCount = await query.CountAsync(); var jobPosts = await query .OrderByDescending(t => t.Weight).Skip(input.SkipCount).Take(input.MaxResultCount).ToListAsync(); //.OrderByDescending(t => t.approval.RegisterDate).Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToListAsync(); //var jobPostListDtos = jobPosts.MapTo<List<JobPostListDto>>(); return(new PagedResultDto <JobPostListDto>( jobPostCount, //jobPostListDtos jobPosts.Select( item => { var dto = new JobPostListDto(); dto.Id = item.Post.Id; dto.CompanyId = item.Post.CompanyId; dto.JobName = item.Post.JobName; dto.SalaryMin = item.Post.SalaryMin; dto.SalaryMax = item.Post.SalaryMax; dto.Education = item.Post.Education; dto.Experience = item.Post.Experience; dto.JobAddress = item.Post.JobAddress; dto.SkillRequire = item.Post.SkillRequire; dto.JobType = item.Post.JobType; dto.PublishDate = item.Post.PublishDate; dto.isDelete = item.Post.isDelete; dto.JobId = item.JobId; dto.Weight = item.Weight; dto.state = item.State; return dto; }).ToList() )); } catch (Exception ex) { Logger.Warn(ex.ToString(), ex); return(null); } }