@Override
 public Long countByCategory(Integer category) throws Exception {
   if (category != null) {
     return productDao.count(
         null, null, new String[] {"category"}, new Object[] {category}, null, null);
   }
   return productDao.countAll();
 }