@Override
public Pagination findPagination(Map<String, Object> queryMap,
int currentPage, int pageSize)
{
AdvertCriteria advertCriteria = new AdvertCriteria();
Criteria criteria = advertCriteria.createCriteria();
// 设置搜索条件参数
if (queryMap != null)
{
if (queryMap.containsKey("name"))
{
criteria.andAdvertNameLike("%" + (String) queryMap.get("name") + "%");
}
if (queryMap.containsKey("linkMan"))
{
criteria.andLinkManLike("%" + (String) queryMap.get("linkMan") + "%");
}
if (queryMap.containsKey("type"))
{
criteria.andAdvertTypeEqualTo(Short.parseShort((String) queryMap.get("type")));
}
if (queryMap.containsKey("enabled"))
{
criteria.andAdvertEnabledEqualTo(Short.parseShort((String) queryMap.get("enabled")));
}
}
// 设置分页参数
advertCriteria.setPageSize(pageSize);
advertCriteria.setStartIndex((currentPage - 1) * pageSize);
// 查询并处理数据
List<Advert> items = new ArrayList<Advert>();
for(Advert ad : items)
{
handleAdvert(ad);