diff --git a/Controllers/RecruitController.cs b/Controllers/RecruitController.cs index 6a7f80a..fb4c9c1 100644 --- a/Controllers/RecruitController.cs +++ b/Controllers/RecruitController.cs @@ -910,19 +910,19 @@ namespace BMA.EHR.Recruit.Service.Controllers var data = await _context.RecruitImports.AsQueryable() .Include(x => x.ImportHostories) .Include(x => x.ImportFile) - .Include(x => x.Recruits) - .ThenInclude(x => x.Addresses) - .Include(x => x.Recruits) - .ThenInclude(x => x.Occupations) - .Include(x => x.Recruits) - .ThenInclude(x => x.Certificates) - .Include(x => x.Recruits) - .ThenInclude(x => x.Educations) - .Include(x => x.Recruits) - .ThenInclude(x => x.Payments) - .Include(x => x.Recruits) - .ThenInclude(x => x.Documents) - .ThenInclude(x => x.DocumentFile) + //.Include(x => x.Recruits) + //.ThenInclude(x => x.Addresses) + //.Include(x => x.Recruits) + //.ThenInclude(x => x.Occupations) + //.Include(x => x.Recruits) + //.ThenInclude(x => x.Certificates) + //.Include(x => x.Recruits) + //.ThenInclude(x => x.Educations) + //.Include(x => x.Recruits) + //.ThenInclude(x => x.Payments) + //.Include(x => x.Recruits) + //.ThenInclude(x => x.Documents) + //.ThenInclude(x => x.DocumentFile) .Include(x => x.ScoreImport) .ThenInclude(x => x.ImportFile) .Include(x => x.ScoreImport) @@ -1693,6 +1693,11 @@ namespace BMA.EHR.Recruit.Service.Controllers cmd.Parameters.Add(new MySqlParameter("@r", req.ExamResult)); } + sb.Append(" ORDER BY examID "); + sb.Append(" LIMIT @PageSize OFFSET @Offset "); + cmd.Parameters.Add(new MySqlParameter("@PageSize", req.PageSize)); + cmd.Parameters.Add(new MySqlParameter("@Offset", ((req.Page - 1) * req.PageSize))); + cmd.CommandText = sb.ToString(); _context.Database.OpenConnection(); @@ -1735,8 +1740,8 @@ namespace BMA.EHR.Recruit.Service.Controllers } - if (data != null && data.Count > 0) - data = data.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList(); + //if (data != null && data.Count > 0) + // data = data.Skip((req.Page - 1) * req.PageSize).Take(req.PageSize).ToList(); dynamic header = null; using (var cmd = _context.Database.GetDbConnection().CreateCommand())