private Expression <Func <Inform, bool> > SearchInformWhere(InformSearchViewModel informSearchViewModel)
        {
            var predicate = WhereExtension.True <Inform>();//初始化where表达式

            if (informSearchViewModel.StartTime != null)
            {
                predicate = predicate.And(p => p.SendTime > informSearchViewModel.StartTime);
            }
            if (informSearchViewModel.EndTime != null)
            {
                predicate = predicate.And(p => p.SendTime < informSearchViewModel.EndTime);
            }
            if (informSearchViewModel.Sender != "")
            {
                predicate = predicate.And(p => p.Sender.Contains(informSearchViewModel.Sender));
            }
            if (informSearchViewModel.Title != "")
            {
                predicate = predicate.And(p => p.InformTitle.Contains(informSearchViewModel.Title));
            }
            if (informSearchViewModel.Status == "1")
            {
                predicate = predicate.And(p => p.Status == "1");
            }
            if (informSearchViewModel.Status == "2")
            {
                predicate = predicate.And(p => p.Status == "2");
            }
            if (informSearchViewModel.Status == "3")
            {
                predicate = predicate.And(p => p.Status != "0");
            }

            return(predicate);
        }
        public List <InformSearchMiddle> Inform_Search(InformSearchViewModel informSearchViewModel)
        {
            var InformSearchResult      = _informRepository.InformSerachByWhere(informSearchViewModel);
            var InformSearchResultModel = _IMapper.Map <List <Inform>, List <InformSearchMiddle> >(InformSearchResult);

            return(InformSearchResultModel);
        }
        public int InformSerachByWhereCount(InformSearchViewModel informSearchViewModel)
        {
            var predicate = SearchInformWhere(informSearchViewModel);
            var result    = DbSet.Where(predicate).ToList()
                            .Count();

            return(result);
        }
        public List <Inform> InformSerachByWhere(InformSearchViewModel informSearchViewModel)
        {
            int SkipNum   = informSearchViewModel.pageViewModel.CurrentPageNum * informSearchViewModel.pageViewModel.PageSize;
            var predicate = SearchInformWhere(informSearchViewModel);
            var result    = DbSet.Where(predicate).ToList().OrderBy(a => a.AddTime)
                            .Skip(SkipNum)
                            .Take(informSearchViewModel.pageViewModel.PageSize).ToList();

            //.OrderBy(o => o.AddDate).ToList();

            return(result);
        }
        public ActionResult <InformSearchResViewModel> Manage_OpinionInfo_Search(InformSearchViewModel informSearchViewModel)
        {
            var SearchResult = _informService.Inform_Search(informSearchViewModel);
            int total        = _informService.Inform_SearchCount(informSearchViewModel);
            var Actionresult = _informFactory.GetInformSearchResViewModel();

            Actionresult.baseViewModel.IsSuccess = true;
            Actionresult.Data                       = SearchResult;
            Actionresult.TotalCount                 = total;
            Actionresult.baseViewModel.Message      = "查询信息成功";
            Actionresult.baseViewModel.ResponseCode = 200;
            _ILogger.Information("查询信息成功");

            return(Ok(Actionresult));
        }
 public int Inform_SearchCount(InformSearchViewModel informSearchViewModel)
 {
     return(_informRepository.InformSerachByWhereCount(informSearchViewModel));
 }