setPagingInfo(..) 수정

master
mjkhan21 3 months ago
parent be6f8ea0b2
commit f7ed5c6b1e

@ -173,24 +173,31 @@ public abstract class AbstractController extends AbstractBean {
* @return ModelAndView * @return ModelAndView
*/ */
protected ModelAndView setPagingInfo(ModelAndView mav, Collection<?> collection, String prefix) { protected ModelAndView setPagingInfo(ModelAndView mav, Collection<?> collection, String prefix) {
Map<String, Object> map = null;
if (collection instanceof BoundedList<?> bounded) { if (collection instanceof BoundedList<?> bounded) {
Map<String, Object> map = Map.of( map = Map.of(
"start", bounded.getStart(), "start", bounded.getStart(),
"dataSize", bounded.size(),
"totalSize", bounded.getTotalSize(), "totalSize", bounded.getTotalSize(),
"fetchSize", bounded.getFetchSize() "fetchSize", bounded.getFetchSize(),
"more", bounded.hasMore(),
"next", bounded.hasNext(),
"prev", bounded.hasPrevious()
); );
mav.addObject(prefix + "List", bounded)
.addObject(prefix + "PagingInfo", map);
} else { } else {
Map<String, Object> map = Map.of( map = Map.of(
"start", 0, "start", 0,
"totalSize", collection.size(), "dataSize", collection.size(),
"fetchSize", collection.size() "totalSize", collection.size(),
); "fetchSize", collection.size(),
mav.addObject(prefix + "List", collection) "more", false,
.addObject(prefix + "PagingInfo", map); "next", false,
"prev", false
);
} }
return mav; return mav.addObject("prefix", prefix)
.addObject(prefix + "List", collection)
.addObject(prefix + "Paging", map);
} }
/** .<br /> /** .<br />

Loading…
Cancel
Save