เพิ่ม paging ระบบบรรจุ แต่งตั้ง ย้าย โอน

This commit is contained in:
Bright 2024-09-13 18:09:56 +07:00
parent bb9e79b06c
commit e59f242427
8 changed files with 152 additions and 15 deletions

View file

@ -69,7 +69,7 @@ namespace BMA.EHR.Placement.Service.Controllers
/// <response code="401">ไม่ได้ Login เข้าระบบ</response>
/// <response code="500">เมื่อเกิดข้อผิดพลาดในการทำงาน</response>
[HttpGet()]
public async Task<ActionResult<ResponseObject>> GetListByAdmin()
public async Task<ActionResult<ResponseObject>> GetListByAdmin(int page = 1, int pageSize = 10, string keyword = "")
{
var getPermission = await _permission.GetPermissionAPIAsync("LIST", "SYS_TEMPDUTY");
var jsonData = JsonConvert.DeserializeObject<JObject>(getPermission);
@ -142,7 +142,27 @@ namespace BMA.EHR.Placement.Service.Controllers
})
.ToListAsync();
return Success(placementOfficers);
if (keyword != "")
{
var data = placementOfficers.Where(x =>
(x.prefix != null && x.prefix.Contains(keyword)) ||
(x.firstName != null && x.firstName.Contains(keyword)) ||
(x.lastName != null && x.lastName.Contains(keyword)) ||
(x.rootShortNameOld != null && x.rootShortNameOld.Contains(keyword)) ||
(x.posMasterNoOld != null && x.posMasterNoOld.ToString().Contains(keyword)) ||
(x.PositionOld != null && x.PositionOld.Contains(keyword)) ||
(x.posTypeNameOld != null && x.posTypeNameOld.Contains(keyword)) ||
(x.posLevelNameOld != null && x.posLevelNameOld.Contains(keyword)) ||
(x.Organization != null && x.Organization.Contains(keyword)))
.OrderByDescending(x => x.CreatedAt)
.Skip((page - 1) * pageSize)
.Take(pageSize)
.ToList();
placementOfficers = data;
}
return Success(new { data = placementOfficers, total = placementOfficers.Count });
}
}