/// <summary> /// 查询 /// </summary> /// <param name="identitySearchViewModel"></param> /// <returns></returns> public List <IdentitySearchMiddle> Identity_Search(IdentitySearchViewModel identitySearchViewModel) { var IdentitySearchResult = _identityRepository.IdentitySerachByWhere(identitySearchViewModel).ToList(); var IdentitySearchResultModel = _IMapper.Map <List <ResidentIdentity>, List <IdentitySearchMiddle> >(IdentitySearchResult); return(IdentitySearchResultModel); }
public int IdentitySerachByWhereCount(IdentitySearchViewModel identitySearchViewModel) { var predicate = SearchIdentityWhere(identitySearchViewModel); var result = DbSet //.Include(a => a.ResidentIdentity) //.Include(a=>a.ResidentInfo) .Where(predicate).Count(); return result; }
public List<ResidentIdentity> IdentitySerachByWhere(IdentitySearchViewModel identitySearchViewModel) { int SkipNum = identitySearchViewModel.pageViewModel.CurrentPageNum * identitySearchViewModel.pageViewModel.PageSize; //查询条件 var predicate = SearchIdentityWhere(identitySearchViewModel); var result = DbSet //.Include(a => a.ResidentIdentity) //.Include(a=>a.ResidentInfo) .Where(predicate).ToList() .Skip(SkipNum) .Take(identitySearchViewModel.pageViewModel.PageSize) .OrderBy(o => o.AddTime).ToList(); return result; }
public ActionResult <IdentitySearchResViewModel> Manage_OpinionInfo_Search(IdentitySearchViewModel identitySearchViewModel) { var SearchResult = _identityService.Identity_Search(identitySearchViewModel); int total = _identityService.Identity_SearchCount(identitySearchViewModel); var Actionresult = _inhabitantFactory.GetIdentitySearchResViewModel(); Actionresult.baseViewModel.IsSuccess = true; Actionresult.Data = SearchResult; Actionresult.TotalCount = total; Actionresult.baseViewModel.Message = "查询信息成功"; Actionresult.baseViewModel.ResponseCode = 200; _ILogger.Information("查询信息成功"); return(Ok(Actionresult)); }
private Expression<Func<ResidentIdentity, bool>> SearchIdentityWhere(IdentitySearchViewModel identitySearchViewModel) { var predicate = WhereExtension.True<ResidentIdentity>();//初始化where表达式 if (identitySearchViewModel.Id != null) { predicate = predicate.And(p => p.Id.Equals(identitySearchViewModel.Id)); } if (identitySearchViewModel.IdentityName!="") { predicate = predicate.And(p => p.IdentityName.Equals(identitySearchViewModel.IdentityName)); } predicate = predicate.And(p => p.Status == "1"); return predicate; }
public int Identity_SearchCount(IdentitySearchViewModel identitySearchViewModel) { return(_identityRepository.IdentitySerachByWhereCount(identitySearchViewModel)); }