@Override
public Pagination findPagination(Map<String, Object> queryMap,
int currentPage, int pageSize) throws ParseException
{
RecommendMerchantCriteria recommendMerchantCriteria = new RecommendMerchantCriteria();
Criteria criteria = recommendMerchantCriteria.createCriteria();
// 设置搜索条件参数
if (queryMap != null)
{
if (queryMap != null)
{
if (queryMap.containsKey("shopName"))
{
criteria.andShopNameLike("%" + (String) queryMap.get("shopName") + "%");
}
if (queryMap.containsKey("startTime"))
{
if(queryMap.containsKey("endTime"))
{
criteria.andSubTimeBetween(
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse((String) queryMap.get("startTime")),
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse((String) queryMap.get("endTime")));
}
else
{
criteria.andSubTimeBetween(
new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse((String) queryMap.get("startTime")),
new Date());
}
}
if(queryMap.containsKey("handleStatus"))
{
criteria.andHandleStatusEqualTo(Short.parseShort((String) queryMap.get("handleStatus")));
}
}
}
// 设置分页参数
recommendMerchantCriteria.setPageSize(pageSize);
recommendMerchantCriteria.setStartIndex((currentPage - 1) * pageSize);
List<RecommendMerchant> items = recommendMerchantMapper.selectByCriteria(recommendMerchantCriteria);
for(RecommendMerchant rm : items)
{
// 推荐人