@Test public void testFindByTenantId() { UUID tenantId1 = Uuids.timeBased(); UUID tenantId2 = Uuids.timeBased(); for (int i = 0; i < 20; i++) { createCustomer(tenantId1, i); createCustomer(tenantId2, i * 2); } PageLink pageLink = new PageLink(15, 0, "CUSTOMER"); PageData<Customer> customers1 = customerDao.findCustomersByTenantId(tenantId1, pageLink); assertEquals(15, customers1.getData().size()); pageLink = pageLink.nextPageLink(); PageData<Customer> customers2 = customerDao.findCustomersByTenantId(tenantId1, pageLink); assertEquals(5, customers2.getData().size()); }
@Override public PageData<Customer> findCustomersByTenantId(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData(customerRepository.findByTenantId( tenantId, Objects.toString(pageLink.getTextSearch(), ""), DaoUtil.toPageable(pageLink))); }
JpaCustomerDao extends JpaAbstractSearchTextDao<CustomerEntity, Customer> implements CustomerDao { @Override public PageData<Customer> findCustomersByTenantId(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData(customerRepository.findByTenantId( tenantId, Objects.toString(pageLink.getTextSearch(), ""), DaoUtil.toPageable(pageLink))); } }
JpaCustomerDao extends JpaAbstractSearchTextDao<CustomerEntity, Customer> implements CustomerDao { @Override public PageData<Customer> findCustomersByTenantId(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData(customerRepository.findByTenantId( tenantId, Objects.toString(pageLink.getTextSearch(), ""), DaoUtil.toPageable(pageLink))); }  }
JpaCustomerDao extends JpaAbstractSearchTextDao<CustomerEntity, Customer> implements CustomerDao { @Override public PageData<Customer> findCustomersByTenantId(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData(customerRepository.findByTenantId( tenantId, Objects.toString(pageLink.getTextSearch(), ""), DaoUtil.toPageable(pageLink))); }  @Override PageData<Customer> findCustomersByTenantId(UUID tenantId, PageLink pageLink); @Override Optional<Customer> findCustomersByTenantIdAndTitle(UUID tenantId, String title); }
JpaCustomerDao extends JpaAbstractSearchTextDao<CustomerEntity, Customer> implements CustomerDao { @Override public PageData<Customer> findCustomersByTenantId(UUID tenantId, PageLink pageLink) { return DaoUtil.toPageData(customerRepository.findByTenantId( tenantId, Objects.toString(pageLink.getTextSearch(), ""), DaoUtil.toPageable(pageLink))); }  @Override PageData<Customer> findCustomersByTenantId(UUID tenantId, PageLink pageLink); @Override Optional<Customer> findCustomersByTenantIdAndTitle(UUID tenantId, String title);  }