public static List<ProduceRecords> getProduceRecords( Pagination page, int current, String[] key, String[] val) { String keys = ManageUtils.genKeys(key, true); Object[] val_ = ManageUtils.genVals(val); List<ProduceRecords> list; int count; if (key == null) { count = (int) ProduceRecords.count(); page.setTotalRecord(count); page.setCurrentPage(current); list = ProduceRecords.all().from(page.getStartRow()).fetch(page.getDisplayCountOfPerPage()); } else { count = (int) ProduceRecords.count(keys, val_); page.setTotalRecord(count); page.setCurrentPage(current); list = ProduceRecords.find(keys, val_) .from(page.getStartRow()) .fetch(page.getDisplayCountOfPerPage()); } return list; }