コード例 #1
0
 @Override
 public Result<Map<String, Object>> loadAllReserves() throws ServiceException {
   Result<Map<String, Object>> rs = new Result<Map<String, Object>>();
   rs.setSuccess(false);
   Map<String, Object> map = new HashMap<String, Object>();
   try {
     List<ReserveQuery> list = reserveDao.loadAllReserves();
     int total = reserveDao.loadTotalNum();
     map.put("total", total);
     map.put("rows", list == null ? new ArrayList<ReserveQuery>() : list);
     rs.setSuccess(true);
     rs.setDefaultModel(map);
   } catch (DaoException e) {
     throw new ServiceException(e);
   }
   return rs;
 }
コード例 #2
0
 @Override
 public Result<Integer> deleteReserve(int id) throws ServiceException {
   Result<Integer> rs = new Result<Integer>();
   rs.setSuccess(false);
   if (0 == id) {
     return rs;
   }
   try {
     int row = reserveDao.delete(id);
     if (row == 1) {
       rs.setSuccess(true);
     }
   } catch (DaoException e) {
     throw new ServiceException(e);
   }
   return rs;
 }
コード例 #3
0
 @Override
 public Result<Integer> updateReserve(ReserveDo reserveDo) throws ServiceException {
   Result<Integer> rs = new Result<Integer>();
   rs.setSuccess(false);
   if (null == reserveDo) {
     return rs;
   }
   try {
     int row = reserveDao.update(reserveDo);
     if (row == 1) {
       rs.setSuccess(true);
     }
   } catch (DaoException e) {
     throw new ServiceException(e);
   }
   return rs;
 }
コード例 #4
0
 @Override
 public Result<ReserveDo> findReserveById(int id) throws ServiceException {
   Result<ReserveDo> rs = new Result<ReserveDo>();
   rs.setSuccess(false);
   if (0 == id) {
     return rs;
   }
   try {
     ReserveDo reserveDo = reserveDao.findReserveById(id);
     if (null != reserveDo) {
       rs.setSuccess(true);
       rs.setDefaultModel(reserveDo);
     }
   } catch (DaoException e) {
     throw new ServiceException(e);
   }
   return rs;
 }
コード例 #5
0
 @Override
 public Result<Integer> addReserve(ReserveDo reserveDo) throws ServiceException {
   Result<Integer> rs = new Result<Integer>();
   rs.setSuccess(false);
   if (null == reserveDo) {
     return rs;
   }
   try {
     int id = reserveDao.insert(reserveDo);
     if (id > 0) {
       rs.setSuccess(true);
       rs.setDefaultModel(id);
     }
   } catch (DaoException e) {
     throw new ServiceException(e);
   }
   return rs;
 }