public Page<Company> getCompanyListByPagenation(int page, int size, String sort) { String[] temp = sort.split(" "); Pageable pageable = new PageRequest(page, size, new Sort(Direction.fromStringOrNull(temp[1]), temp[0])); Page<Company> companys = companyDao.findAll(pageable); for (Company company : companys) { company.setLeader(userDao.findNameById((long) company.getLeadingUser())); } return companys; }
public Company save(Company company) { company.setPhone(userDao.findPhoneById((long) company.getLeadingUser())); return companyDao.save(company); }