/**
  * 删除
  *
  * @param entity
  * @return
  */
 public ResultData delete(Greade greade) {
   ResultData resultData = new ResultData();
   try {
     Integer result = greadeDao.delete(greade);
     if (result > 0) {
       resultData.setStatus(IBaseService.SUCCESS);
     } else {
       resultData.setStatus(IBaseService.FAIL);
     }
   } catch (Exception e) {
     resultData.setStatusException(e.getMessage());
     e.printStackTrace();
   }
   return resultData;
 }
 /**
  * 查询列表
  *
  * @param entity
  * @return
  */
 public ResultData list(Greade greade) {
   ResultData resultData = new ResultData();
   try {
     List<Greade> greadeList = greadeDao.selectList(greade);
     if (greadeList != null) {
       resultData.setStatus(IBaseService.SUCCESS);
       resultData.addObject("greadeList", greadeList);
     } else {
       resultData.setStatus(IBaseService.FAIL);
     }
   } catch (Exception e) {
     resultData.setStatusException(e.getMessage());
     e.printStackTrace();
   }
   return resultData;
 }
 /**
  * 查询单条数据
  *
  * @param entity
  * @return
  */
 public ResultData single(Greade greade) {
   ResultData resultData = new ResultData();
   try {
     Greade greadeTemp = greadeDao.selectOneById(greade);
     if (greadeTemp != null) {
       resultData.setStatus(IBaseService.SUCCESS);
       resultData.addObject("greade", greadeTemp);
     } else {
       resultData.setStatus(IBaseService.FAIL);
     }
   } catch (Exception e) {
     resultData.setStatusException(e.getMessage());
     e.printStackTrace();
   }
   return resultData;
 }
 /**
  * 查询分页列表
  *
  * @param entity
  * @return
  */
 public ResultData paginated(Greade greade) {
   ResultData resultData = new ResultData();
   try {
     List<Greade> greadeList = greadeDao.selectPaginatedList(greade);
     Long greadeCount = greadeDao.getCount(greade);
     if (greadeList != null) {
       long record = greadeCount == null ? 0 : greadeCount;
       int pageCount = (int) Math.ceil(record / (double) greade.getRows());
       Map<String, Object> gridMap = new Hashtable<String, Object>();
       gridMap.put("page", greade.getPage());
       gridMap.put("total", pageCount);
       gridMap.put("records", record);
       gridMap.put("rows", greadeList);
       resultData.setResultMap(gridMap);
       resultData.setStatus(IBaseService.SUCCESS);
     } else {
       resultData.setStatus(IBaseService.FAIL);
     }
   } catch (Exception e) {
     resultData.setStatusException(e.getMessage());
     e.printStackTrace();
   }
   return resultData;
 }