@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; }
@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; }
@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; }
@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; }