com.healthy.common.mybatis.pageable.PageablePropertiesLoader Maven / Gradle / Ivy
package com.healthy.common.mybatis.pageable;
import com.healthy.common.model.loader.PagePropertiesLoader;
import lombok.RequiredArgsConstructor;
import java.util.HashMap;
import java.util.Map;
import static com.healthy.common.model.constant.PageConstants.*;
/**
* Pageable自定义分页参数加载
*
* @author xm.z
*/
@RequiredArgsConstructor
public class PageablePropertiesLoader implements PagePropertiesLoader {
private final PageableProperties pageableProperties;
@Override
public Map load() {
Map map = new HashMap<>();
String page = pageableProperties.getPageParameterName();
if (!DEFAULT_PAGE_PARAMETER.equals(page)) {
map.put(DEFAULT_PAGE_PARAMETER, page);
}
String size = pageableProperties.getSizeParameterName();
if (!DEFAULT_SIZE_PARAMETER.equals(size)) {
map.put(DEFAULT_SIZE_PARAMETER, size);
}
String sort = pageableProperties.getSortParameterName();
if (!DEFAULT_SORT_PARAMETER.equals(sort)) {
map.put(DEFAULT_SORT_PARAMETER, sort);
}
return map;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy