/// <summary>
        /// 根据条件查询计划,返回查询的实体列表
        /// </summary>
        /// <param name="mSearchMember">员工查询类对象</param>
        /// <returns></returns>
        public async Task <NoteInfoDtoPages> GetEntitiesAsync(NoteInfoSearch SearchCondition)
        {
            NoteInfoDtoPages            SearchResult = new NoteInfoDtoPages();
            IQueryable <NoteInfoEntity> Items        = _GhDbContext.dsNotes.AsNoTracking() as IQueryable <NoteInfoEntity>;

            if (SearchCondition != null && !string.IsNullOrWhiteSpace(SearchCondition.UserId))
            {
                if (!string.IsNullOrWhiteSpace(SearchCondition.Id))
                {
                    Items = Items.Where(e => e.Id.Equals(SearchCondition.Id, StringComparison.Ordinal));//对两个字符串进行byte级别的比较,性能好、速度快。
                }
                if (SearchCondition.IsMySelft.Equals("Yes", StringComparison.Ordinal))
                {
                    Items = Items.Where(e => e.UserId.Equals(SearchCondition.UserId, StringComparison.Ordinal));//对两个字符串进行byte级别的比较,性能好、速度快。
                }
                else
                {
                    Items = Items.Where(e => e.CanReadUserIds.Contains(SearchCondition.UserId, StringComparison.Ordinal));//对两个字符串进行byte级别的比较,性能好、速度快。
                }
                if (!string.IsNullOrWhiteSpace(SearchCondition.KeysInMultiple))
                {
                    Items = Items.Where(e => e.Caption.Contains(SearchCondition.KeysInMultiple, StringComparison.Ordinal) || e.TextContent.Contains(SearchCondition.KeysInMultiple, StringComparison.Ordinal));//对两个字符串进行byte级别的比较,性能好、速度快。
                }
                SearchResult.SearchCondition.RecordCount = await Items.CountAsync().ConfigureAwait(false);

                List <NoteInfoEntity> RecordEntities = await Items.OrderByDescending(x => x.UpDateTime).Skip((SearchCondition.PageIndex - 1) * SearchCondition.PageSize).Take(SearchCondition.PageSize).ToListAsync().ConfigureAwait(false);

                SearchResult.RecordList = _Mapper.Map <List <NoteInfoDto> >(RecordEntities);
            }
            return(SearchResult);
        }
Exemple #2
0
 public async Task <NoteInfoDtoPages> GetRecordsAsync([FromQuery] NoteInfoSearch SearchCondition)
 {
     return(await _DataRepository.GetEntitiesAsync(SearchCondition).ConfigureAwait(false));
 }