|
@@ -62,4 +62,20 @@ public class PaginationHelper {
|
|
return PaginationResult.builder().code(0).data(list).count(total).build();
|
|
return PaginationResult.builder().code(0).data(list).count(total).build();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 构造
|
|
|
|
+ *
|
|
|
|
+ * @param data
|
|
|
|
+ * @param total
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ public static PaginationResult create(@NonNull List<?> data, Integer total, Integer page) {
|
|
|
|
+ List<?> list = Lists.newArrayList(data);
|
|
|
|
+ if (list.isEmpty()) {
|
|
|
|
+ return PaginationResult.builder().code(1).msg("No data").data(Lists.newArrayList()).count(0).page(1).build();
|
|
|
|
+ } else {
|
|
|
|
+ return PaginationResult.builder().code(0).data(list).count(total).page(page).build();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|