From dcc1c3aeba554c22b00a8cef0da6f0b7ca5d4fde Mon Sep 17 00:00:00 2001 From: Bright Date: Tue, 16 Sep 2025 16:48:21 +0700 Subject: [PATCH] =?UTF-8?q?Fix=20=E0=B8=A5=E0=B8=9A=E0=B8=A3=E0=B8=B2?= =?UTF-8?q?=E0=B8=A2=E0=B8=81=E0=B8=B2=E0=B8=A3=E0=B8=AA=E0=B8=AD=E0=B8=9A?= =?UTF-8?q?=E0=B8=95=E0=B8=B4=E0=B8=94=20Error=20&=20=E0=B8=9B=E0=B8=A3?= =?UTF-8?q?=E0=B8=B1=E0=B8=9A=20paging=20=E0=B8=AB=E0=B8=99=E0=B9=89?= =?UTF-8?q?=E0=B8=B2=E0=B8=A3=E0=B8=B2=E0=B8=A2=E0=B8=8A=E0=B8=B7=E0=B9=88?= =?UTF-8?q?=E0=B8=AD=20#1811?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Controllers/RecruitController.cs | 35 ++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 15 deletions(-) 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())