@Override
public Pagination findPagination(Map<String, Object> queryMap,
int currentPage, int pageSize)
{
DistrictCriteria districtCriteria = new DistrictCriteria();
Criteria criteria = districtCriteria.createCriteria();
// 设置搜索条件参数
if (queryMap != null)
{
if (queryMap.containsKey("name"))
{
criteria.andNameLike("%" + (String) queryMap.get("name") + "%");
}
if (queryMap.containsKey("pinyinName"))
{
criteria.andPinyinNameLike("%" + (String) queryMap.get("pinyinName") + "%");
}
if (queryMap.containsKey("pidIsNull"))
{
criteria.andParentIdIsNull();
}
}
// 设置分页参数
districtCriteria.setPageSize(pageSize);
districtCriteria.setStartIndex((currentPage - 1) * pageSize);
List<District> items = districtMapper.selectByCriteria(districtCriteria);
int totalCount = (int) districtMapper.selectCountByCriteria(districtCriteria);
return new Pagination(pageSize, currentPage, totalCount, items);
}