Exemplo n.º 1
0
        public IEnumerable <Audit.UserIDCard> GetUserIDcardList(Audit.UserIDCard.Criteria criteria)
        {
            var userIDCardList = (from card in _zdDBContext.UserIdcard.Include(x => x.User).FilterBy(criteria, false)
                                  join record in _zdDBContext.AuditRecord.Include(a => a.Operator)
                                  on new
            {
                UserId = card.UserId.ToString(),
                AuditType = AuditType.IDCard.ToValue(),
                UserIdNotEqualsNull = card.UserId != null
            }
                                  equals
                                  new
            {
                UserId = record.AuditId,
                record.AuditType,
                UserIdNotEqualsNull = true
            } into cr
                                  from a in cr.DefaultIfEmpty()
                                  where string.IsNullOrEmpty(criteria.Auditor) || a.Operator.Name == criteria.Auditor
                                  orderby card.UpdateTime descending
                                  select new Audit.UserIDCard
            {
                ID = Guid.NewGuid(),
                UserID = card.UserId,
                UserName = card.UserName,
                Gender = card.Gender ?? 0,
                Nation = card.Nation,
                Birthday = card.Birthday,
                Address = card.Address,
                IdCardNumber = card.IdcardNo,
                IssuingAgency = card.IssuingAgency,
                ValidityStartTime = card.ValidityStartTime,
                ValidityEndTime = card.ValidityEndTime,
                IdcardFrontUrl = card.IdcardFrontUrl,
                IdcardBackUrl = card.IdcardBackUrl,
                CreateTime = card.CreateTime,
                UpdateTime = card.UpdateTime ?? null,
                Status = card.Status ?? 0,
                Phone = card.User.Telphone,
                Auditor = a.Operator.Name,
                AuditDate = a.AuditDate
            });

            return(userIDCardList
                   .Sort(criteria.SortField, criteria.IsOrderByDesc)
                   .PaginationBy(criteria)
                   .AsNoTracking()
                   .ToList());
        }
 public IActionResult ExportUserIDCardList([FromBody] Audit.UserIDCard.Criteria criteria)
 => File(_userIDCardRepo.GetUserIDcardList(criteria.SetMaxPageSize()).ToExcel(ExportMappings.UserIDCardExportConfig), "application/vnd.ms-excel");
 public IActionResult GetUserIdcardList(Audit.UserIDCard.Criteria criteria)
 => criteria.PageOf(x => _userIDCardRepo.GetUserIDcardList(x));