public async Task <JsonResult> GetAsync([FromQuery] DepartmentQueryDto condition, int?pageIndex, int?pageSize) { if (pageIndex == null || pageSize == null) { if (condition.DepartmentCode != null || condition.Address != null || condition.ContactPhone != null || condition.DepartmentCode != null || condition.DepartmentName != null || condition.Email != null || condition.Fax != null || condition.Notes != null || condition.PrincipalName != null) { var list = _service.Search(condition); return(new JsonResult(new { code = 20000, list })); } var items = await _service.GetAll(); return(new JsonResult(new { code = 20000, items })); } else { var items = await _service.GetPaginationAsync(pageIndex.Value, pageSize.Value); return(new JsonResult(new { code = 20000, items })); } }